[asterisk-users] Pattern matching....
Kevin P. Fleming
kpfleming at digium.com
Fri Feb 29 08:20:17 CST 2008
Tony Mountifield wrote:
> In article <47BDD86E.1090005 at fnords.org>, Eric Wieling <eric at fnords.org> wrote:
>> No that will not work. You would want three exten => lines, one for
>> each area code.
>
> And if you have a lot of common dialplan that you don't want to duplicate
> between the three extension patterns, put the common stuff up at a higher
> priority and use Goto to get there:
>
> exten => _404NXXXXXX,1,Goto(200)
> exten => _770NXXXXXX,1,Goto(200)
> exten => _678NXXXXXX,1,Goto(200)
>
> exten => _NXXNXXXXXX,200,NoOp(Start of common instructions)
> exten => _NXXNXXXXXX,n,etc....
Actually you can do this a lot more simply without using Goto (which
might mess with your CDR):
exten => _404NXXXXXX,1,NoOp
exten => _770NXXXXXX,1,NoOp
exten => _678NXXXXXX,1,NoOp
exten => _NXXNXXXXXX,2,NoOp(Start of common instructions)
exten => _NXXNXXXXXX,n,etc....
Since there is an implicit 'Goto' from priority 1 to priority 2 anyway,
you might as well take advantage of it :-)
--
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)
More information about the asterisk-users
mailing list