> For the complete documentation index, see [llms.txt](https://docs.mikopbx.com/mikopbx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mikopbx.com/mikopbx/english/faq/outbound-routing/outgoing-with-internal-number-dialing.md).

# Outgoing with internal number dialing

Let's say there is a certain number **+371 (2) 637‑23‑33**, by calling to which and dialing an extension you can get to a specific employee. This can be extremely convenient, especially if the extension number is longer than 3 characters. Next, we describe an example of the implementation of the task.

1. To solve the problem, additional contexts should be described through the [Customization of System Files](/mikopbx/english/manual/system/custom-files.md) menu.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fn06cIfMIqk6wJhcxD3gW%2FSystemFileCustomization.png?alt=media&amp;token=4edfbfbf-6903-46c5-b1b5-d2a62131f59e" alt=""><figcaption><p>System file customization</p></figcaption></figure>

2. We will edit the **extensions.conf** file.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FNuELWVzuFh5rThr08jvu%2FEditExtensions.conf.png?alt=media&amp;token=567dc075-00ed-45a7-bc10-915ccc1dc97f" alt=""><figcaption><p>Extensions.conf</p></figcaption></figure>

3. Add the following text to the end of the file:

```php
[z-outgoing]
exten => _X!,1,Ringing()
  same => n,Gosub(${ISTRANSFER}dial,${EXTEN},1)
  same => n,Dial(PJSIP/${EXTEN}@${ZPROVIDERID},600,${DOPTIONS}TKU(z-dial-answer)b(dial_create_chan,s,1))
  same => n,ExecIf($["${ISTRANSFER}x" != "x"]?Gosub(${ISTRANSFER}dial_hangup,${EXTEN},1))
  same => n,Set(pt1c_UNIQUEID=${EMPTY_VALUE})
  same => n,ExecIf($["${BLINDTRANSFER}x" != "x"]?AGI(check_redirect.php,${BLINDTRANSFER}))
  same => n,Hangup()

[z-dial-answer]
exten => s,1,NoOp(Answered send DTMF...)
  same => n,Gosub(dial_answer,${EXTEN},1)
  same => n,SendDTMF(${ZDTMF})
  same => n,return
```

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F0108yDq0jzytZ7ZXcEeF%2FCodeForExtensions.png?alt=media&amp;token=9c5d69c2-8705-4c3e-98d7-226a9243841f" alt=""><figcaption><p>Code for extensions,conf</p></figcaption></figure>

4. Next, it is necessary to describe the [Applications of dialplans](/mikopbx/english/manual/modules/dialplan-applications.md)

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FS6mZS39XCPs3O2iIsUi2%2FNewDialplan.png?alt=media&amp;token=0b3add55-158e-4821-bb01-d894d59cf0e7" alt=""><figcaption><p>New dialplan</p></figcaption></figure>

5. Select "**Type of code**" - "**Asterisk Dialplan**"

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FgolD7wwUbLynf7PzFgCO%2FtypeOfCodeAsterisk.png?alt=media&amp;token=cb277e51-553f-4058-a68c-400f15308ebc" alt=""><figcaption><p>Type of code for dialplan</p></figcaption></figure>

6. Let's say you need to "dial" the number 3542331, set this value to "**Number to call the application"**

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FVINOSdCaVrZ2Bgb2jvnJ%2FnumberForDialplan.png?alt=media&amp;token=bc5c8fc6-ce2e-416d-92d1-bd9382197280" alt=""><figcaption><p>Number to call the application</p></figcaption></figure>

7. Go to the "**Programme Code**" tab and insert the template:

```php
1,Set(_ZDTMF=${EXTEN})
n,Set(_ZDST=37126372333)
n,Set(_ZPROVIDERID=SIP-1601534775)
n,Goto(z-outgoing,${ZDST},1)
```

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FtJFXDNv1vxBwDrHZ3ZqY%2FcodeForDialplan.png?alt=media&amp;token=03448fdf-c2a5-4ece-a06b-3f13cf6011e8" alt=""><figcaption><p>Code for dialplan</p></figcaption></figure>

* If you specify the **9XXXX** template in the "**Application call number**" field, it will be possible to "dial" any five-digit numbers starting with the digit "**9**"
* In the application, assign the variable "ZDST" the number to which the call should be made In the "**ZDTMF**" variable, specify the number for the additional set
* In the "**ZPROVIDERID**" variable, specify the ID of the provider through which the outgoing call should be made. ID can be peeped in the browser address bar when editing the provider


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mikopbx.com/mikopbx/english/faq/outbound-routing/outgoing-with-internal-number-dialing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
