[asterisk-users] Dial Plan - Routing via Caller ID

Chad Wallace cwallace at lodgingcompany.com
Thu Apr 5 13:01:57 CDT 2012

On Thu, 5 Apr 2012 13:35:51 -0400
<lists65 at gmail.com> wrote:

> If I wanted to route a call from a particular DID and the CALLERID
> from a specific A/C this doesn't seem to work for me:
> exten => 6140000000/_702XXXXXXX,n,Goto(context1,s,1)
> exten => 6140000000/6149999999,n,Goto(context2,s,1)
> exten => 6140000000/6149999998,n,Goto(context3,s,1)
> exten => 6140000000/6149999997,n,Dial(SIP/7777,25)

I think the n's should all be 1's, like so:

exten => 6140000000/_702XXXXXXX,1,Goto(context1,s,1)
exten => 6140000000/6149999999,1,Goto(context2,s,1)
exten => 6140000000/6149999998,1,Goto(context3,s,1)
exten => 6140000000/6149999997,1,Dial(SIP/7777,25)

The 'n' priority is used for subsequent lines (after the first) in the
same extension, but the first one for each extension should be 1.

> I have seen examples where I could use a pattern like (not specifying
> a Caller ID info, and that works fine):
> exten => _X!,n,Goto(context1,s,1)
> exten => _X!,n,Goto(context2,s,1)
> exten => _X!,n,Goto(context3,s,1)

I suggest you don't use _X! or _X. as a pattern, until you fully
understand the security risks.  In the asterisk-1.8 tarball, there's a
file called README-SERIOUSLY.bestpractices.txt that explains it all.
You should read that before you do anything.

> I am confused on how to use patterns.
> I would like to learn how I can take either DID and route the calls to
> various contexts via the CallerID (which couild be the entire DID
> number, an NPA only or an NPANXX.

You have an example for NPA only in the line that handles area code 702.

Similar for NPANXX:

exten => 6140000000/_614999XXXX,1,Goto(context,s,1)

This is all covered quite well on the voip-info wiki:



C. Chad Wallace, B.Sc.
The Lodging Company
OpenPGP Public Key ID: 0x262208A0

More information about the asterisk-users mailing list