-----Original Message----- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Stephen Reese Sent: Sunday, December 19, 2010 12:49 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] Specifying DID for outbound calls
> 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/${ext...@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/${ext...@vitel-outbound) > exten => _1NXXNXXXXXX,n,Goto(h,1) > > But in my case I had two different domains. E.g. > Dial(SIP/${ext...@provider-id1) and Dial(SIP/${ext...@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 Thanks Jeroen, though it is still not firing correct, I have provided a little more information. Here are the channel-names: SIP/201-0000000a SIP/101-00000012 Here is the extension information from the sip.conf: [101] type=friend username=101 secret=0000 mailbox=101 callerid="User One" <101> host=dynamic nat=yes dtmfmode=rfc2833 canreinvite=no reinvite=no qualify=yes [201] type=friend username=201 secret=0000 mailbox=201 callerid="User Two" <201> host=dynamic nat=yes dtmfmode=rfc2833 canreinvite=no reinvite=no qualify=yes Here is the updated outgoing context that you provided with a few updates. [outgoing] exten => _1NXXNXXXXXX,1,Set(Outgoing=${CUT(CHANNEL,/,2)}) exten => _1NXXNXXXXXX,n,Set(Outgoing=${CUT(Outgoing,-,1)}) exten => _1NXXNXXXXXX,n,GotoIf($["${Outgoing}" = "User Two"]?20:10) exten => _1NXXNXXXXXX,10,Set(CALLERID(num)=3012323434) exten => _1NXXNXXXXXX,n,Set(CALLERID(name)="User One") exten => _1NXXNXXXXXX,n,Dial(SIP/${ext...@vitel-outbound) exten => _1NXXNXXXXXX,n,Goto(h,1) exten => _1NXXNXXXXXX,20,Set(CALLERID(num)=3013232322) exten => _1NXXNXXXXXX,n,Set(CALLERID(name)="User Two") exten => _1NXXNXXXXXX,n,Dial(SIP/${ext...@vitel-outbound) exten => _1NXXNXXXXXX,n,Goto(h,1) Based on the information above, what should be altered to correctly associated the number with the relevant extension? Thanks You can also just use an agi script to look up their current caller-id in a database, and set it to the correct caller-id needed. exten => _NXXNXXXXXX,1,AGI(getcid.pl,${CALLERID(NUM)},1) exten => _NXXNXXXXXX,n,Dial(SIP/+1${ext...@providerx,60) exten => _NXXNXXXXXX,n,congestion() my getcid.pl expects two values, extension callerid, and a type. 911 gets 0, inhouse gets 1, outside 2 etc. (as I ust the getcid for different Dial() options. The script then looks up there "station" callerid, and set it to an apporiate value, 911 always gets local in house direct number, regular stuff gets a toll number, inhouse gets there extension number, and if there callerid is not found in the database it returns a 'default' value. This way every user can have multiple caller id's . -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users