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 [email protected], 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:[email protected] 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:[email protected]>;tag=as29ffee59
> To: <sip:[email protected] <sip%[email protected]>>
> Contact: <sip:[email protected]>
> 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:callednum...@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