<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi All<br>
    <br>
    I've had a system setup for a long time, but one issue has always
    been there and its come to a head.<br>
    <br>
    I've always has problems with Asterisk not correctly selecting the
    call route for inbound DID's because the INVITE sent to it via my
    core (openSIPs) has the 'service number' not the DID in the INVITE.<br>
    <br>
    As per below<br>
    <meta charset="utf-8">
    <pre style="color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">INVITE <a class="moz-txt-link-freetext" href="sip:111610@150.10.10.10:49640">sip:111610@150.10.10.10:49640</a> SIP/2.0
Record-Route: <a class="moz-txt-link-rfc2396E" href="sip:202.11.11.11;lr=on;ftag=1ca96a43-co774-INS001;did=781.c6890334">&lt;sip:202.11.11.11;lr=on;ftag=1ca96a43-co774-INS001;did=781.c6890334&gt;</a>
Via: SIP/2.0/UDP 202.11.11.11;branch=z9hG4bK2ad4.58ca31d3.0
Via: SIP/2.0/UDP 202.13.13.13:5060;branch=z9hG4bK1ca53b72111cfdd3INV1ca96a43306
Max-Forwards: 34
Contact: <a class="moz-txt-link-rfc2396E" href="sip:0882229300@202.13.13.13:5060">&lt;sip:0882229300@202.13.13.13:5060&gt;</a>
To: <a class="moz-txt-link-rfc2396E" href="sip:0883622272@202.11.11.11;user=phone">&lt;sip:0883622272@202.11.11.11;user=phone&gt;</a>
From: "0882229300"<a class="moz-txt-link-rfc2396E" href="sip:0882229300@202.13.13.13;user=phone;noa=national">&lt;sip:0882229300@202.13.13.13;user=phone;noa=national&gt;</a>;tag=1ca96a43-co774-INS001
Call-ID: 6f75-572-026197035530-IMG01-0-27.34.224.68
CSeq: 77401 INVITE
Allow: INVITE,ACK,CANCEL,BYE,REFER,OPTIONS,NOTIFY,SUBSCRIBE,PRACK,INFO
Content-Type: application/sdp
Date: Wed, 17 Oct 2012 03:09:42 GMT
User-Agent: ENSR3.0.66.21-IS1-RMRG109-RG2100-CPO46
Content-Length: 309

On an inbound call from our wholesale supplier I run a command alias_db_lookup which I think changes the DID the service number.

if (is_method("INVITE")) {
...
...
...
if(alias_db_lookup("dbaliases","d")) {
...
...
}
</pre>
    I'm moved to supplying a commercially support Asterisk install for
    our customers and they (the commercial asterisk company) are saying
    that this rewrite is not correct and the INVITE should look like
    this.<br>
    <br>
    <pre style="color: rgb(0, 0, 0); font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">INVITE <a class="moz-txt-link-freetext" href="sip:0883622272@150.10.10.10:49640">sip:0883622272@150.10.10.10:49640</a> SIP/2.0

Any idea on how I might correct this ?
What should the above INVITE really look like ?

Thanks
Mike
</pre>
  </body>
</html>