[asterisk-users] Specifying DID for outbound calls

Jonathan Thurman jonathan at thurmantech.com
Sun Dec 19 23:15:37 UTC 2010


On Sun, Dec 19, 2010 at 2:57 PM, Stephen Reese <rsreese at gmail.com> wrote:
> I believe I have made a little headway. I have two outgoing DID
> contexts and have changed the GotoIf statement to the extension name.
> User One acts as expected and User two now displays unknown when
> calling so I believe it is trying to to goto 20 but it's not quite
> making it. Any tips? Thanks
>
> [outgoing]
> 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)="User One" <3012323434>)
> exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)
> exten => _1NXXNXXXXXX,n,Goto(h,1)
> exten => _1NXXNXXXXXX,20,Set(CALLERID(num)="User Two" <3013232322>)

This should either be CALLERID(all) or just set the number on the line
above.  As a side note, I prefer to use labels an not line numbers.
Less to change later...

> exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound2)
> exten => _1NXXNXXXXXX,n,Goto(h,1)

I'll also give a +1 to using setvar.  It allows you to abstract the
dial plan much more.  I use this feature a lot in both static and
Realtime configurations.  For example (not tested, but based on live
production code):

sip.conf:
[101]
...
setvar=EXTERNAL_CALLERID="User One <3012323434>"

[201]
...
setvar=EXTERNAL_CALLERID="User Two <3013232322>"



extensions.conf:
[outgoing]
exten => _1NXXNXXXXXX,1,Verbose(1, Someone is making a call out)
exten => _1NXXNXXXXXX,n,ExecIf($[${EXISTS(${EXTERNAL_CALLERID})}]?Set(CALLERID(all)=${EXTERNAL_CALLERID}))
exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)


But then I am sure there are 100 other ways to do this same thing.

-Jonathan



More information about the asterisk-users mailing list