Tutorial- Understanding Dial Patterns

Written by rgower on Aug 25, 2006 - 02:13 PM

A surprising number of people have problems creating dial patterns for AAH/TrixBox, so on the grounds that a little understanding goes a long way towards self-help we present a short tutorial on creating dial patterns that do not get confused:-

There are two places in AAH/TrixBox where you need to create dial patterns: Outbound Routing and Trunks.

Outbound Routes
Outbound routes is used to select which trunk route to use.

What to do with it?
Usually PBXs are set to require a prefix code before dialling an external number (commonly a 9) to prevent any number dialled getting confused with system functions. This prefix must be stripped at the Outbound Route.

You may also decide to have differing routes for different call destinations and Outbound routes can cater for this as well.

How to do it
First you will need to identify what numbers you dial and how they can be identified, usually this is fairly simple: Local (usually no more than 6 digits), National and International.

For our example we will create three routes to cover the three types:
Local numbers are six figure starting with either 3 or 7
National are eleven or twelve figures, starting with 0
International are longer starting 00
And because it is more normal, we'll use a 9 prefix for an outside line.

Using FreePBX Go to Outbound Routes and create a Route called Local.

In the Dial Patterns box, we need to recognise it is an outbound call (9 prefix), that it is local (six figures starting 3 or 7), then strip our prefix before passing it to Trunks to dial
We can lose our prefix by starting the rule with 9|
To recognise the local nature we need to match with to look for a six figure number beginning 3 or 7. We aren't worried about the value of the rest, so we can simply match each character with an X
Putting this together we end with one entry for the box
Quote:
9|[37]XXXXX

The [] forces Asterisk to look for either a 3 or a 7 as the first digit
Finally select at least one trunk for the Trunk Sequence and save.

We do a similar thing with routes called National and International. Though we are especially interested in the 2 digits after the prefix.

For National the third digit must not be a zero.
Because of inconsistencies in the way different providers like their numbers to be dialled, it is a good idea to strip the first zero as well.
So the dial plan for National will look like
Quote:

90|Z.

The Z looks for a value of 1 or greater and we aren't worried about the rest so we terminate with a full stop as a catch all wild card.

For International the third digit must be a zero so our rule looks like
Quote:
90|0.

Note I have not stripped the second zero. We will do that later when dialling from the trunk. For the time being we need to have something to show it is an International number.

Order of Routes and Patterns
Our three routes have been carefully written to apply a level of belt and braces to the selection criteria, as such their order of use is not of great importance.
However as the patterns become more complex, the order in which the patterns and routes are listed becomes important.
In general the more digits you are matching, the higher up the list the pattern must sit. For instance if we were to find say that a call to an international number starting 0035 cannot be made using our preferred route, than an additional route would have to be created to specifically trap those numbers e.g. 90|035. this special route must appear above International, or Asterisk will never use it.

Trunks
The Trunks section is principly used to add any prefixes needed before the call is allowed out onto the PSTN.

A Note about Carriers
There is no standard about how numbers are dialled amongst phone call providers. Some require the full international STD to be dialled all the time, others will accept national calls to use national STD and obviously the local phone company will often allow you to dial the local number direct.
Not providing what the carrier expects and your call will not work.

In our case we shall assume we need to dial the full international code and we have three types of number to trap as provided by our three Routing rules:
Six figures starting 3 or 7- Local
Eleven figures starting with anything but a zero- National
Any number of figures starting with a zero- International
Each has to be trapped slightly differently, but can be applied to the same Trunk.

Again the order of the rules is important for them to work and we need to start with the local number first. Here we need to add the International code (e.g. 44) and Area code (e.g. 1248) to the six figure number.
We can do this with 441248+[37]XXXXX. The + indicating that we are adding the prefix.

For National numbers, we only need to add the International dial prefix to a number that does not start with zero, like this 44+Z.

And international numbers, we simply remove the zero at the front like 0|.

Thus our dial rules become:
Quote:

441248+[37]XXXXX
44+Z.
0|.


Obviously there are a lot more rules that can be added to make dialling simpler, or even to choose the most economical route for a call
Add To Delicious Print this Thread Grab our feed
Voip User Forum Index » Asterisk Forum » TrixBox
Reply to topic
Forum Rules and Guidelines | About VoIP User | Privacy Policy


All logos and trademarks in this site are property of their respective owner.
Comments and posts are property of the poster, all the rest (c) 2003-2008 VoIP User Limited.

VoIP User Limited is incorporated in England and Wales under Company Number 6694577.

No part of this site may be reproduced without our prior consent.