[asterisk-users] Specifying DID for outbound calls
Stephen Reese
rsreese at gmail.com
Sun Dec 19 22:57:15 UTC 2010
On Sun, Dec 19, 2010 at 4:36 AM, Jeroen Eeuwes <jeroeneeuwes at gmail.com> wrote:
> Hi Stephen,
>
>> Thanks for the heads up, I have been setting the caller-ID but the
>> trouble I'm running into is specifying the which number to call out
>> as. How can an extension specify a different number? See below for my
>> current extension.conf, thanks.
>
> You can check the channel-name to see which extension is making the
> call and set the CallerID accordingly. The channel-name will be
> something like "SIP/201-abc23ef34" or "SIP/User1-def34abc51". The 201
> or User1 part depends on how you put the username in sip.conf You can
> use the CUT function to get the calling extension and then jump to the
> correct CallerID. I've used something like this:
>
> [outgoing]
> exten => _1NXXNXXXXXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)})
> exten => _1NXXNXXXXXX,n,Set(Outgoing=${CUT(Outgoing,-,1)})
> exten => _1NXXNXXXXXX,n,GotoIf($["${Outgoing}" = "User2"]?20:10)
> exten => _1NXXNXXXXXX,10,Set(CALLERID(num)=3012323434)
> exten => _1NXXNXXXXXX,n,Set(CALLERID(name)="User1")
> exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)
> exten => _1NXXNXXXXXX,n,Goto(h,1)
> exten => _1NXXNXXXXXX,20,Set(CALLERID(num)=3013232322)
> exten => _1NXXNXXXXXX,n,Set(CALLERID(name)="User2")
> exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound)
> exten => _1NXXNXXXXXX,n,Goto(h,1)
>
> But in my case I had two different domains. E.g.
> Dial(SIP/${EXTEN}@provider-ID1) and Dial(SIP/${EXTEN}@provider-ID2)
> instead of setting the CallerID.
>
> Not that the Cut doesn't work correctly if you use a minus-sign in the username.
>
> Best regards,
> Jeroen Eeuwes
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>)
exten => _1NXXNXXXXXX,n,Dial(SIP/${EXTEN}@vitel-outbound2)
exten => _1NXXNXXXXXX,n,Goto(h,1)
More information about the asterisk-users
mailing list