# 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="/files/tYsBgqXvD9DV5euOc4N0" alt=""><figcaption><p>System file customization</p></figcaption></figure>

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

<figure><img src="/files/R61HVwQh4xX75UmmNNdE" 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="/files/YPpDw5WSj3UoMIWQcQGw" 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="/files/uaGJWT3locoDlr3MxQa6" alt=""><figcaption><p>New dialplan</p></figcaption></figure>

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

<figure><img src="/files/KCmXnmxxCtr27T1lti5M" 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="/files/jgop6QuKNscVk9O6Egj7" 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="/files/PIDJbyBtbiKE0wIN4JEB" 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: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

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

The question should be specific, self-contained, and written in natural language.
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.
