Dialing Rules and Patterns - VoIP.ms Wiki

Dialing Rules and Patterns

From VoIP.ms Wiki

Jump to: navigation, search
Article en Français Artículo en Español



Dialing Rules and Patterns

This article explains the difference and usage between the Dialing Rules or Dial Plans (From the trunk outgoing settings) and the Dialing Patterns (From the Outbound routes) in the common asterisk distro.

Dialing Rules

The most common dialing rule that we can find in the trunk outgoing settings (either SIP or IAX) is the following:

(N Represents a Number 2-9 and X Represents Any Number)


What it does is adding the "1" to any pattern like "NXXNXXXXXX"

It is important to understand that the rules will apply as long as the pattern exists, if it doesn't exist the rule will never apply and the call will end in a typical " This call can not be placed as dialed".

For example, if you want to dial 7 digits only:


Replace the 555 digits in the previous line for the area code of your choice.

Useful VoIP.ms Rules

4443 - For calling Echo Test to test call connectivity to our servers and call quality.

4747 - For DTMF Testing.

***XXX - To test MOH (Music on Hold) Categories.

*xx - To access Voicemail Options with our service like *97 and *98.

0441+NXXNXXXXXX or 0331+NXXNXXXXXX - Used to manually dial a Premium (0441) or a Value (0331) Canadian Route.

011+. or 00+. - For International Calling.

044+. and 033+. - To Manually dial (044) Premium International Routes or (033) Value International Routes. Good for Testing a call via different routes on the go.

Dialing Patterns

The Dialing patterns can be found in the Outbound route, whatever you dial from any extension must match a dialing pattern, the most common dialing pattern found here is the following:


The important thing to understand, is that the outbound route will select the trunks it will use, however if you have multiple trunks with the same patterns (which is commonly used), then you will have to select the trunks priority (which is found at the top right of the outbound route screen, as a list of the Outbound routes names with arrows to move up and down as priority).

Now, what happens if you have multiple trunks and you need to force that one extension does come up from an specific trunk? It is a simple play of rules and patterns.

How to configure one extension through a specific trunk

As it has been explained, the extension does not "choose" on which trunk to come out, this is done by the outbound route, what we need to do is to play with the patterns from the Outbound routes and dialing rules for the trunks set.

What we can chose is the outbound route (which contains the specific trunk).


Lets say we have trunk1 and trunk2 for this example. Lets say also we have outbound route1 and outbound route2 for this example. Also lets say we have the extension1.

The trunk1 and trunk2 dialing rules will be the same = 1+NXXNXXXXXX

Now on the outbound route we can determine the specific pattern that will help us to "choose" either trunk from when dialing from an specific [extension].

We can set to the outbound route1 the pattern:


but also (this is the trick) we can add something like X|. (being X any number of your choice)


This means any pattern with a "2" in front will be recognized by that route and use the specific trunk, the pattern also removes the 2 so this number is not sent and the rule in the trunk 1+ remains.

In this manner we dial a regular US/CAN number (10 digits) this way from the extensions.


Note the 2 before the ten digits, this will be stripped out and substitute by 1 according to the dialing rules set in the trunk. By doing this we ensure the use of the trunk1 (which is being chosen in the outbound route).

Now, in the outbound route2 we add the patterns:



This way, when dialing within the extension we only need to add a 3 (that will match the specific route) and use the specific trunk.

like 35626846308

The number 3 will be removed and substitute by the "1" according to the dialing rules in the trunk.

Additionally you can play with the dial rules on the devices that uses the extension, so the 2 or 3 or number chosen is sent automatically without the need of dialing.

Personal tools
VoIP.ms Wiki
VoIP.ms Blog
Guides (English)
Guides (Français)
Guías (Español)