[Asterisk-Users] Interesting Dial-Plan Question
Jay Milk
ast-users at skimmilk.net
Thu Apr 27 08:04:12 MST 2006
Matt wrote:
> That will work? So if I have:
>
> CALLERIDNUM = 5705551212
> exten => _NXXXXXX,1,Goto(${CALLERIDNUM::0:3}${EXTEN},1)
> exten => _570NXXXXXX,1,Dial(Zap/g1/${EXTEN},1)
>
> And if CALLERIDNUM = 7175551212
> exten => _717NXXXXXX,1,Dial(Zap/g2/${EXTEN},1)
>
> (Notice 717 calls go out g2.. and 570 go out g1).
>
> That seems as though it should work, however it still would seem I
> have to dork up my current dial-plan. That's why I'm wondering if I
> should do that EXTEN and CALLERIDNUM stuff in another context, and
> then transfer to my outdial context?
>
> The problem I see doing it this way is that not ALL area code 717 or
> 570 calls go out g1 or g2. Some calls in the same are code are long
> distance and need to route out the LD provider... even though they are
> still 717-555-1212 format.
>
> Right now.. if someone dials 1-570-555-1212, 570-555-1212, or 555-1212
> it routes correctly (wether it is long distance or not). My goal is
> to artificially make the person dial '570' or '717' even if they dial
> 555-1212 by looking at the originating number. Unless someone thinks
> of a good reason not too.. it seems a context flip woudl be the way to
> go.
>
You're on the right track. Do something like this:
[userdial]
exten => _NXXNXXXXXX,1,Goto(dial_us,${EXTEN},1)
exten => _NXXXXXX,1,Goto(dial_us,${CALLERIDNUM::0:3}${EXTEN},1)
[dial_us]
exten => _570NXXXXXX,1,Dial(Zap/g1/1${EXTEN},60)
exten => _717NXXXXXX,1,Dial(Zap/g2/1${EXTEN},60)
exten => _NXXNXXXXXX,1,Dial(Zap/g3/1${EXTEN},60)
Users will dial out of "userdial". 7-digit numbers are prepended with
the first 3 digits of their caller-id, then sent to "dial_us". 10-digit
numbers are sent there directly. "dial_us" chooses a trunk-group (or
IAX, SIP, whatever you want), based on the dialed area code(s).
A macro would probably be cleaner than a Goto, but either works in this
case.
FWIW, I'm a big fan of 1+10 dialing, as it removes some of the potential
ambiguity from the dial-plan.
More information about the asterisk-users
mailing list