[asterisk-users] To: Field

Alex Balashov abalashov at evaristesys.com
Mon Jun 1 11:23:06 CDT 2009


Do be aware that routing on the To URI specifically breaks RFC rules.

Routing should be done based only on Request URI, the user part of which
Asterisk sees as an "extension."

Tell your provider to pass you the DNIS in the RURI, or get another
provider.  Most should be able to override your Contact URI with a DID. 
It's a common point of discussion in the service provider community.

> Ah that is brilliant, thanks a lot.
>
> Charles
>
> On Mon, Jun 1, 2009 at 9:35 AM, Administrator TOOTAI
> <admin at tootai.net>wrote:
>
>> Hi
>>
>> Charles Solar a écrit :
>> > Hi guys, I am new here but I have a quick question.
>> >
>> > I have an incoming trunk that sends me calls from various usernames I
>> have
>> > with them.  Only trouble is they send invites as s at my.ip.addr, not as
>> the
>> > username I have with them.  So I cannot match extensions like I would
>> want
>> > to.
>> > Here is a sample invite
>> >
>> > INVITE sip:s at my.ip.ad.dr SIP/2.0
>> > Record-Route: <sip:0.0.0.0;lr=on;ftag=as29ffee59>
>> > Via: SIP/2.0/UDP 0.0.0.0;branch=z9hG4bK7238.25c90fc7.0
>> > Via: SIP/2.0/UDP 0.0.0.0:5060;branch=z9hG4bK1c709971;rport=5060
>> > From: "" <sip:9999999999 at host.ip.addr>;tag=as29ffee59
>> > To:
>> <sip:myusername at mysipprovider.net<sip%3Amyusername at mysipprovider.net><
>> sip%3Amyusername at mysipprovider.net
>> <sip%253Amyusername at mysipprovider.net>
>> >>
>> > Contact: <sip:9999999999 at host.ip.addr>
>> > Call-ID: 6a379af207d78b3b5f2e8c6c55e64009
>> > CSeq: 102 INVITE
>> > User-Agent: Asterisk PBX
>> > Max-Forwards: 69
>> > Date: Fri, 29 May 2009 04:12:09 GMT
>> > Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY
>> > Supported: replaces
>> > Content-Type: application/sdp
>> > Content-Length: 377
>> >
>> > the only distinction between a call to username1 and username2 is in
>> the
>> To:
>> > field, but I cannot find something to route the call based on the To
>> caller
>> > id.
>> >
>> > I think the dialednumber variable would be close to what I want, but
>> > apparently that is broken so I am unsure what to do.
>> >
>> [macro-setDialednumberFromSipHeader]
>> ;
>> ; We extract the DIALEDNUMBER from SIP header
>> ; which is of the form <sip:CALLEDNUMBER at OurAsteriskIPAddress>
>>
>> exten => s,1,Set(__DIALEDNUMBER=${SIP_HEADER(TO):5})
>> exten => s,n,Set(__DIALEDNUMBER=${CUT(DIALEDNUMBER,@,1)})
>> exten => s,n,GotoIf($["${DIALEDNUMBER:0:1}" != "+"]?numberIsOK)
>> exten => s,n,Set(__DIALEDNUMBER=${CUT(DIALEDNUMBER,+,2)})
>>
>> exten => s,n(numberIsOK),NoOp()
>> exten => s,n,Set(CDR(dest)=${DIALEDNUMBER})
>>
>> done ;-)
>>
>> _______________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>   http://lists.digium.com/mailman/listinfo/asterisk-users
>>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users


-- 
Alex Balashov
Evariste Systems
Web    : http://www.evaristesys.com/
Tel    : (+1) (678) 954-0670
Direct : (+1) (678) 954-0671
Mobile : (+1) (678) 237-1775





More information about the asterisk-users mailing list