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