[asterisk-users] Toll free pattern matching

Richard Mudgett rmudgett at digium.com
Fri Aug 5 09:26:03 CDT 2016


On Fri, Aug 5, 2016 at 9:06 AM, D'Arcy J.M. Cain <darcy at vex.net> wrote:

> I have this in my config:
>
> exten => _800XXXXXXX,1,Verbose(0,${CHANNEL(peername)} Calling ${EXTEN})
>   same => n,Dial(SIP/tollfree/1${EXTEN})
> exten => _1800XXXXXXX,1,Verbose(0,${CHANNEL(peername)} Calling ${EXTEN})
>   same => n,Dial(SIP/tollfree/${EXTEN})
> exten => _NXXNXXXXXX,1,Verbose(0,${CHANNEL(peername)} Calling ${EXTEN})
>   same => n,Dial(SIP/trunk/1${EXTEN})
> exten => _1NXXNXXXXXX,1,Verbose(0,${CHANNEL(peername)} Calling ${EXTEN})
>   same => n,Dial(SIP/trunk/${EXTEN})
>
> I came across
> http://stackoverflow.com/questions/7235291/asterisk-
> priorities-that-have-a-possibility-of-matching
> which seems to imply that the above won't work and that all the calls
> would go to the trunk.  However, this is working as expected for me.
> Did the behaviour change in the last four years or could I run into
> problems with this setup?  Perhaps I am misunderstanding the poster's
> issue.
>

Dialplan will stay on the current series of extensions until it runs out.
If there isn't an explicit hangup
to stop execution it will look for the next priority match.  You can easily
test this yourself by creating
some test dialplan to match your situation.

Given the below dialplan:

exten = _800XXXXXX,1,NoOp(Start of 800 series)
same = n,NoOp(Next in 800 series)

exten = _NXXNXXXX,1,NoOp(Generic series)
same = n,NoOp(next in generic series)
same = n,NoOp(third in generic series)

If you have an 800 number starting in dialplan then these are the priorities
executed:
1, Start of 800 series
2, Next in 800 series
Since we have run out of the 800 series Asterisk looks for a priority 3
that matches the extension
and finds priority 3 of the generic series.
3, third in generic series
There is no priority 4 so the call is hung up.

Richard


[1]
https://wiki.asterisk.org/wiki/display/AST/Contexts%2C+Extensions%2C+and+Priorities
[2] https://wiki.asterisk.org/wiki/display/AST/Pattern+Matching
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20160805/7ec7fe5b/attachment.html>


More information about the asterisk-users mailing list