We had some similar problems. Our configuration is:
SIP client 1 <-> Kamailio <-> Asterisk <->Kamailio<->SIP client 2
My solution was to check $td and $si and if they are same as Kamailio, to forward call to Asterisk.
Because I planed to use more then 1 Asterisk, I keep in variable which one to use.



On Thu, Jun 6, 2013 at 5:28 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,

the incoming ACK has the top Route with lr parameter, meaning is loose routing. By that, the proxy removes the top route header, preserves the R-URI and sends to the URI in the next Route header.

From what I can see in the Route stack, it seems a spiral back to the proxy because ip 81.21.38.34 is two times there.

If you can't sort it out, send the full SIP trace taken on the proxy from the initial INVITE to the ACK. Then we can see how Record-Route headers are set and the signaling flow.

Cheers,
Daniel

On 6/6/13 3:30 PM, phillman25 wrote:
Dear list further to the above problem i observed the following:

ACK message coming from PABX1:

Via: SIP/2.0/UDP 192.168.10.189:5060;branch=z9hG4bK76f8f103;rport*
Max-Forwards: 70*
From: "22498045" <sip:22498045@192.168.10.189>;tag=as181922af*
To: <sip:94294294@81.21.38.34>;tag=3d95248-37261551-13c4-50022-1c3096-5cc2673d-1c3096*
CSeq: 102 ACK*
User-Agent: FPBX-2.8.1(1.8.21.0)*
Content-Length: 0*



ACK message sent to PGW from Kamailio1

Via: SIP/2.0/UDP 81.21.38.34;branch=z9hG4bKc526.9402c2edbc3ef96d9e405408364506a9.0*
Via: SIP/2.0/UDP 192.168.10.189:5060;branch=z9hG4bK76f8f103;rport=5060*
Max-Forwards: 16*
From: "22498045" <sip:22498045@192.168.10.189>;tag=as181922af*
To: <sip:94294294@81.21.38.34>;tag=3d95248-37261551-13c4-50022-1c3096-5cc2673d-1c3096*
CSeq: 102 ACK*
User-Agent: FPBX-2.8.1(1.8.21.0)*
Content-Length: 0*




Shouldn't the ACK  message to the PGW have the header ACK sip:94294294@81.21.38.5;pgw-call=call-2aa6 and the Route: <sip:81.21.38.34;lr=on;ftag=as181922af>*   ???




Your help is much appreciated!!

Phillip



On Thu, Jun 6, 2013 at 12:26 PM, phillman25 <phillman25@gmail.com> wrote:
Dear List

I upgraded from Kamailio v 3.3 to 4.0.1 and am now facing an issue for the below scenario:

PABX1 ==> Kamailio1 ==> Cisco PGW ==> Kamailio1 ==> PABX2


I understand that this is a hairpin scenario but was working normally on v 3.3.

Checking in the syslog i see:
ERROR: <core> [receive.c:230]: ERROR: receive_msg: no via found in reply

Checking the sip trace i see that when calling from PABX1 to PABX2. After PABX2 answers and the the 200 OK  is eventually sent  to PABX1 , PABX1 answers with ACK but seems like its not sent back to PABX2  as a result PABX resends a 200 OK and the cycle continues until PABX2 sends a BYE message. Please see below the ACK received from PABX1:

ACK sip:94294294@81.21.38.55 SIP/2.0
Via: SIP/2.0/UDP 192.168.10.189:5060;branch=z9hG4bK6bffe37c;rport
Route: <sip:81.21.38.34;lr=on;ftag=as1cd4f8f1;did=e36.c471>,<sip:94294294@81.21.38.5;pgw-call=call-26eb>,<sip:81.21.38.34;lr=on;ftag=as1cd4f8f1>
Max-Forwards: 70
From: "22498045" <sip:22498045@192.168.10.189>;tag=as1cd4f8f1
To: <sip:94294294@81.21.38.34>;tag=3d94f08-37261551-13c4-50022-1c1e67-87fe958-1c1e67
Contact: <sip:22498045@192.168.10.189:5060>
Call-ID: 03042a717e27a87e759f7f4879e70377@192.168.10.189:5060
CSeq: 102 ACK
User-Agent: FPBX-2.8.1(1.8.21.0)
Content-Length: 0


Is there an issue with the above ACK message? Is there any way to solve this issue quickly perhaps by disabling loose route?
I have observed that this issue occurs only when hairpinned. 


Thanking you in advance!

Phillip




_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla - http://www.asipto.com
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, San Francisco, USA - June 24-27, 2013
  * http://asipto.com/u/katu *

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users