Hello,

On 8/28/13 8:22 PM, Marc Soda wrote:
Thanks, I appreciate it.

In this setup the there are 2 endpoints (700 and 701) peered up to an Asterisk server (172.16.60.6) via a Kamailio proxy (172.16.60.20).  700 (172.16.60.28) is calling 701 (172.16.3.65).  When 701 answers the OK is sent to the proxy and then to Asterisk.  Asterisk is then ACKing the OK.  The ACK is being sent to the proxy and then the proxy should be sending it back to the endpoint.  It is not.  The ACK is being sent to the proxy and then the proxy is sending to itself again, via the loopback interface.  I believe loose_route() should be re-writing the destination to be the endpoint, but it not.
what device is at 701? The 200ok receved from it has the contact address with the IP of kamailio:

U 172.16.3.65:5060 -> 172.16.60.20:5060
SIP/2.0 200 OK.
Via: SIP/2.0/UDP 172.16.60.20;received=172.16.60.20;branch=z9hG4bK9381.d7d662b.0.
Via: SIP/2.0/UDP 172.16.60.6:5060;rport=5060;branch=z9hG4bK0919ead7.
Record-Route: <sip:172.16.60.20;lr;ftag=as5e1a80d8;nat=yes>.
Call-ID: 64a513d30fc6a51e54e8255b7169345c@172.16.60.6:5060.
From: "Alpha" <sip:700@172.16.60.6>;tag=as5e1a80d8.
To: <sip:sip701_tbs@172.16.60.20>;tag=64c37e7e-19b8-46ae-ad0d-f2a4abe667bc.
CSeq: 102 INVITE.
Allow: PRACK, SUBSCRIBE, NOTIFY, REFER, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, REGISTER, OPTIONS, MESSAGE.
Contact: <sip:sip701_tbs@172.16.60.20:5060>.
.....

It should be its IP address, otherwise Kamailio doesn't know where to sent requests within dialog.

It seems there is a NAT between your kamailio and 701, as kamailio adds alias parameter to Contact in 200ok. That can be used to route the ack, like:

handle_ruri_alias();
$ru = $du;
$du = $null;

Do the above for the ACK before calling loose_route(). Then it will get out of kamailio, but might not solve the overall routing, if the 701 is not at next hop or it doesn't like the r-uri, because it is not what it has set.

The best is to ask for the proper fix on 701 device.

Cheers,
Daniel
-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Trainings - Berlin, Oct 21-24; Miami, Nov 11-13, 2013
  - more details about Kamailio trainings at http://www.asipto.com -