Asterisk Management Portal & Call Routing

Patterns

Basically, the same characters as Asterisk Dialplan Patterns?, but adds the pipe | symbol.

Special Characters for Pattern Matching

X matches any digit from 0-9
Z matches any digit form 1-9
N matches any digit from 2-9
[1237-9] matches any digit or letter in the brackets (in this example, 1,2,3,7,8,9)
. wildcard, matches one or more characters
| seperates dialing prefix from number

Simple Examples

9|NXXXXXX Matches “95551234” but passes “5551234”
[2-7]XX Matches numbers 200-799

MORE…

Outgoing calls in AMP are sent out using Trunks, according to the Outgoing Routing configuration.

Examples

Local calls on POTS, Long-distance on IAX2 (North America)

This is a basic setup with two trunks, with local calls on area code 613.

Configure ZAP trunk as follows:
Dial rules:
1817|NXXXXXX

Zap Identifier:
g0

This dial rule will match numbers “1817NXXXXX” and drop the “1817” to place the call locally (dialing 1+areacode on a POTS line generally causes Mabell to play an error message).

IAX trunk:
Dial rules:
1817+NXXXXXX
1+NXXNXXXXXX

Name:
myiaxprovider

Max Channels:
3

These rules will add “1817” to any 7-digit number, or 1 to a 10-digit number.

We also need two routes:

“local” route:
Dial patterns:
1817NXXXXXX
817NXXXXXX
1800NXXXXXX
1866NXXXXXX
1877NXXXXXX
1888NXXXXXX
NXXXXXX
911

Trunk priority:
ZAP/g0
IAX/myiaxprovider

This will send numbers dialed as “1817NXXXXXX” or “817NXXXXX”, toll-free numbers, 7-digit numbers, and 911 to be matched by this route. Calls will first be sent on our POTS lines, and if they’re all used up, our IAX trunk.

“longdistance” route:
Dial Patterns:
1NXXNXXXXXX
NXXNXXXXXX
011.

Trunk Priority:
IAX/myiaxprovider
ZAP/g0

Any numbers dialed as 10 or 11 digit long-distances numbers, as well as overseas calls will be sent on this route, using our IAX first. Since we set max channels to 3, after 3 calls, it will use our POTS line(s).

Two offices, extensions only

This example is just simply linking extensions at two offices, each with a * box. We’re only linking extensions, not sharing lines.

Let’s say we have the following extensions at each office:

* Office A: 100-199 (with the exception of below)
* Office B: 103, 104, 105, 119, 200-299,

At both offices, we need to setup an IAX trunk, and put the context as from-internal.

Route dial pattern at office A:

10[3-5]
119
2XX

Route dial pattern at office B:

10[126-9]
11[0-8]
2XX

Then at both, set the only trunk to be the IAX trunk configured to connect at the other office. By setting max channels on those trunks, you can limit calls. Once the limit has been reached (with no other trunks to use) the caller will just hear a busy signal.

Leave a comment