> 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/manual/routing/incoming-routing.md).

# Incoming routing

Description and configuration of incoming routing

In this section, you need to create rules and templates for distributing incoming calls for providers created in MikoPBX. The rules for incoming calls describe the route of a call from the moment it arrives at the PBX to the moment it is completed. You can create an unlimited number of inbound routing rules. You can create several rules for one provider.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FBkzwd5WpUOXYKPg5VyhS%2FIncomingRoutingSection.png?alt=media&amp;token=9c15976d-a5f8-4414-b01f-2d9109ad9dac" alt=""><figcaption><p>"Call Routing" -> "Incoming Routing" section</p></figcaption></figure>

{% hint style="info" %}
Additional examples of configuring incoming routing are available in the [FAQ ](/mikopbx/english/faq/incoming-routing.md)section.
{% endhint %}

## Routing rule priority and default route

Rules are listed in order of priority. If no one answers the incoming call within the time interval specified in the rule, the call will be routed to the next priority rule. Rules can be moved up and down in the list, that is, their priority can be changed by dragging them by the arrows.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F0MAWBE2r0TY3mWTZWg43%2FPriorityScheme.png?alt=media&amp;token=7dfbe887-1a7c-4f13-9234-121e5752086e" alt=""><figcaption><p>Priority Scheme</p></figcaption></figure>

If the call is not answered according to any of the rules, the **Default incoming route** is used.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2F0k2BFyNsimO4uXPlGDfa%2FdefaultRoute.png?alt=media&amp;token=d8199271-a888-47db-8f84-c92885018e0e" alt=""><figcaption><p>Default incoming route</p></figcaption></figure>

The following actions are available and can be specified as the default rule:

* **Play busy signa**l - the client will play a busy signal and the incoming call will be ended;
* **Hang up**;
* **Redirect the call** - the call can be transferred to a number that you can select in the field located to the right of the action. You can select an IVR menu, call queue, conference, or employee extension number as the number for transfer.

## Multiple routes for one provider

For one provider, you can describe **several** incoming routes.

First, the call goes along the upper route. If the client does not get through, then the call goes according to the lower rule (lower priority). If the client does not get through via the second route, then the call goes through the **default route.**

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FSEO240k0F95sXXiGyTvz%2FPriority.png?alt=media&amp;token=4fb1d359-1b57-4fcc-a964-856c2a772119" alt=""><figcaption><p>Several incoming routes for one provider</p></figcaption></figure>

## Create a routing rule

To add a new incoming routing rule, click the **Add a new rule** button.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FvtDpodTlJ5CTBRlpEKzO%2FnewRule.png?alt=media&amp;token=d875e10b-de1f-438b-8cd2-338ec8337f89" alt=""><figcaption><p>New Rule</p></figcaption></figure>

In the **Note** field, describe the route you want to implement. In the future, this will help you debug the call circuit.

Select the **Provider** for which you are creating a new incoming call distribution template.

The additional **DID number** is the number the client called you on. This field is optional and should be completed if you need to route calls more accurately.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FCf6JZCUThmgXpGVY55yL%2Fparameters1.png?alt=media&amp;token=b57db410-c8f0-4ae7-88f9-bcfeacf58f67" alt=""><figcaption><p>Parameters for a new rule</p></figcaption></figure>

At the next step, you need to indicate to which **phone number** the incoming call from the client will be sent. The telephone number can be IVR menu numbers, call queues, conferences, or employee internal numbers.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2Fa6FXssMBcnxSRBlviy5C%2Fparameters2.png?alt=media&amp;token=57eed711-d1e4-4b40-b503-8842801d6dbf" alt=""><figcaption><p>Parameters for a new rule</p></figcaption></figure>

Specify the time during which the call will be sent to the phone number you specified.

<figure><img src="https://835495363-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsZ8acWnNlSalIHQjMFu1%2Fuploads%2FElm4FYieQjOJoLRkzjh7%2Fparameters3.png?alt=media&amp;token=314f6846-cfe7-4bb8-9e8f-499d81090134" alt=""><figcaption><p>Parameters for a new rule</p></figcaption></figure>

If after the specified time interval no one answers the incoming call, the call will be routed to the next priority rule.

## DID number field templates and CallerID restriction <a href="#did-cid-templates" id="did-cid-templates"></a>

The **`Additional DID number`** field can be set as an exact number, as an Asterisk pattern, or additionally restricted by the caller's number (CallerID).

### DID templates

The field is matched against the number the client dialed (DID). If the value consists only of pattern characters, MikoPBX treats it as an Asterisk pattern; exact numbers are entered as-is.

| DID field value | What it matches                      | Examples          |
| --------------- | ------------------------------------ | ----------------- |
| empty or `X!`   | any incoming call (default route)    | all calls         |
| `XZZ`           | 3 digits, 2nd and 3rd are 1–9        | 711, 923          |
| `3XX`           | 300–399                              | 300, 350, 399     |
| `4XX`           | 400–499                              | 400, 455          |
| `[3-4]XX`       | 300–499                              | 312, 489          |
| `NXX`           | first digit 2–9, then any two digits | 234, 900          |
| `74952293042`   | exact DID                            | only 74952293042  |
| `+79066643322`  | exact DID with `+`                   | only +79066643322 |

Notation: `X` — digit 0–9, `Z` — digit 1–9, `N` — digit 2–9, `[a-b]` — range, `.` — one or more of any character, `!` — zero or more characters.

{% hint style="warning" %}
Use only **uppercase** `X`, `Z`, `N`. Lowercase (e.g. `3xx`) is treated by MikoPBX as an exact number, not a pattern.
{% endhint %}

### CallerID restriction

Asterisk lets you specify both the DID and the allowed caller's number in a single field using `/`: the part before `/` is matched against the dialed number (DID), the part after — against the caller's number (CallerID).

| DID field value            | What it matches                                        |
| -------------------------- | ------------------------------------------------------ |
| `74951234567/+79261234567` | DID = 74951234567 **and** CallerID = +79261234567      |
| `_X!/+79261234567`         | any DID **and** CallerID = +79261234567                |
| `_3XX/_79XXXXXXXXX`        | DID in 300–399 **and** CallerID matching `79XXXXXXXXX` |

{% hint style="info" %}
Without `_` both parts are treated as exact matches. To use a pattern, start the corresponding part with `_` (e.g. `_X!` — "any DID", `_79XXXXXXXXX` — a CallerID pattern).
{% endhint %}


---

# 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/manual/routing/incoming-routing.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.
