Asterisk Priorities that have a possibility of matching
I want to be able to isolate only toll free numbers from my dialplan and route then through SIP instead of through a local trunk. My question is the priority numbering and it seems the toll free number would also match up with the trunk extension.
Currently: `
exten => _1XXXXXXXXXX,1,SetCallerID(${DEFAULT_CIDName} <${DEFAULT_CIDNum}>)
exten => _1XXXXXXXXXX,n,Dial(${TRUNK_OB}/${EXTEN:0:11})
exten => _1XXXXXXXXXX,n,Hangup
`
I want to be able to add:
exten => _1800NXXXXXX,1,Dial(SIP/sip.server.com/${EXTEN})
(as well as 开发者_高级运维888, 855, 877 & 866)
but the toll free number matches the trunk Dial as well.
If I set the addition as Priority 2 and then set the trunk dial as Priority 3, would it only dial the SIP and skip the trunk or is it possible to have them both as Priority 1 and then if it's a toll free, only dial the SIP?
I have looked everywhere and can not come up with the conclusion. Any advice would be greatly appreciated!!
In your example you overwrite priority 1 and dialplan continues with priority 2 within the "broader" extension pattern. In your case, when you dial 18001234567, the following dialplan will execute:
exten => _1800NXXXXXX,1,Dial(SIP/sip.server.com/${EXTEN})
exten => _1XXXXXXXXXX,2,Dial(${TRUNK_OB}/${EXTEN:0:11})
exten => _1XXXXXXXXXX,3,Hangup
The SetCallerID() is overwritten by the toll-free extension. There are two ways to solve this problem:
Overwrite extension 2, not 1
exten => _1XXXXXXXXXX,1,SetCallerID(${DEFAULT_CIDName} <${DEFAULT_CIDNum}>) exten => _1XXXXXXXXXX,n,Dial(${TRUNK_OB}/${EXTEN:0:11}) exten => _1XXXXXXXXXX,n,Hangup ; overwrite priority 2 (Dial) for toll free numbers exten => _1800NXXXXXX,2,Dial(SIP/sip.server.com/${EXTEN})
This may not be the cleanest solution as you will get confused by priorites when moving code around.
Set a "dialstring" variable in priority 1 which you can overwrite and use later.
exten => _1XXXXXXXXXX,1,Set(DIALOUTSTRING=${TRUNK_OB}/${EXTEN:0:11}) exten => _1XXXXXXXXXX,n,SetCallerID(${DEFAULT_CIDName} <${DEFAULT_CIDNum}>) exten => _1XXXXXXXXXX,n,Dial(${DIALOUTSTRING}) exten => _1XXXXXXXXXX,n,Hangup ; use another dialout for toll free numbers exten => _1800NXXXXXX,1,Set(DIALOUTSTRING=SIP/sip.server.com/${EXTEN})
精彩评论