[asterisk-users] Simplifying dial-plan

Stephen Reese rsreese at gmail.com
Wed Dec 22 14:04:13 UTC 2010


On Wed, Dec 22, 2010 at 2:01 AM, Jeroen Eeuwes <jeroeneeuwes at gmail.com> wrote:
> Hi Stephen,
>
>> _NXXNXXXXXX
>> _NXXXXXX
>> _011.
>> _911
>
> Of course it can, but it depends on what you want to do when those
> numbers are called...
>
> I didn't know about the setvar in the sip.conf and actually I think it
> is a much "cleaner" solution. Since you are already using it I would
> suggest to not only use it for CallerID but also for the
> @vitel-outbound like this:
>
> exten => _1NXXNXXXXXX,1,Set(CALLERID(all)=${EXTERNAL_CALLERID})
> exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@${Outbound})
> exten => _1NXXNXXXXXX,n,Goto(h,1)
>
> Of course you'll need to set setvar=Outbound=vitel-outbound or
> setvar=Outbound=vitel-outbound2 in sip.conf.
>
> What do you want to do with the other numbers? If you want to do the
> same as with _1NXXNXXXXXX you can just add things like this in your
> extensions.conf:
>
> exten => _NXXNXXXXXX,1,Goto(_1NXXNXXXXXX,1)
> exten => 911,1,Goto(_1NXXNXXXXXX,1)
>
> Or you can do different things if you want that like this:
>
> exten => _NXXXXXX,1,Set(CALLERID(all)="No one cares" <0>)
> exten => _NXXXXXX,n,Dial(SIP/${EXTEN}@abcdefgh)
> exten => _NXXXXXX,n,Goto(h,1)
>
> Best regards,
> Jeroen Eeuwes

Jeroen, I'm trying to avoid rewriting the outgoing block for the
patterns mentioned above. I've placed a pseudo dial-plan below. The
plan needs to dial the 1 and/or also the area code depending on the
pattern they enter. Any tips, thanks.

exten => _1NXXNXXXXXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
exten => _1NXXNXXXXXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
exten => _1NXXNXXXXXX,n,GotoIf($["${Outgoing}" = "201"]?20:10)
exten => _1NXXNXXXXXX,10,Set(CALLERID(all)=${EXTERNAL_CALLERID})
exten => _NXXNXXXXXX,10,Set(CALLERID(all)=${EXTERNAL_CALLERID})
exten => _NXXXXXX,10,Set(CALLERID(all)=${EXTERNAL_CALLERID})
exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)
exten => _NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)
exten => _NXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)
exten => _1NXXNXXXXXX,n,Goto(h,1)
exten => _NXXNXXXXXX,n,Goto(h,1)
exten => _NXXXXXX,n,Goto(h,1)
exten => _1NXXNXXXXXX,20,Set(CALLERID(all)=${EXTERNAL_CALLERID})
exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound2)
exten => _1NXXNXXXXXX,n,Goto(h,1)



More information about the asterisk-users mailing list