Hi

I'm still struggling with this problem. My setup is:

mobile  ----  sipproviderA   ----  kamailio1  ----- kamailio2 ----- SIP user 20111101

The SIP user calls the mobile and every thing works fine until the mobile hangup and the sipproviderA sends a BYE to kamailio1. That bye message has to "Route" headers:

Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr>.   <---- IP of kamailio1

Kamilio1 just forwards that message to kamailio2 and sends it back to kamailio1. BYE is then never send to the SIP user. I don't know why sipproviderA would send such a message. Maybe it si because I'm sending something strange to sipproviderA when the call is established or maybe sipproviderA is just sending a strange BYE message. Any ideas?

(I have testet with another SIP provider where everything is working fine)


I can solve the problem by doing very ugle hack in kamailio1 and I think this can be done better?

-----
dns_query("sip.sipproviderA.com", "sipproviderA");
if (is_method("BYE") && $si==$dns(sipproviderA =>addr) && search("Route: <sip:188.226.200.111")) {
        xlog("L_INFO", "MS: RELAY remove double route from $rm si=$dns(sipproviderA =>addr) from ($fu:$sp) to $ru\n");
        remove_hf_value("Route[-1]");
}

if (!t_relay()) {
        sl_reply_error();
}
-----

I have included an ngrep from kamailio1 below.

Cheers,
Martin


----------
$ ngrep -d eth0 -W byline port 5060    (from kamailio1)


U 188.166.3.25:5060 -> 188.226.200.111:5060
INVITE sip:4526170000@trunk.test.com SIP/2.0.
Record-Route: <sip:188.166.3.25;lr=on;nat=yes>.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>.
Max-Forwards: 69.
Contact: "20111101" <sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Type: application/sdp.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
Content-Length: 376.
.
v=0.
o=20111101-jitsi.org 0 0 IN IP4 188.166.3.25.
s=-.
c=IN IP4 188.166.3.25.
t=0 0.
m=audio 13268 RTP/AVP 0 8 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=rtcp-xr:voip-metrics.
a=sendrecv.
a=rtcp:13269.
m=video 13300 RTP/AVP 96.
a=rtpmap:96 H263-1998/90000.
a=fmtp:96 CUSTOM=1920,1200,2;VGA=2;CIF=1;QCIF=1.
a=recvonly.
a=rtcp:13301.

#
U 188.226.200.111:5060 -> 188.166.3.25:5060
SIP/2.0 100 trying -- your call is important to us.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
Server: kamailio (4.2.4 (x86_64/linux)).
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 77.72.169.128:5060
INVITE sip:000014526170000@sip.siptraffic.com:5060 SIP/2.0.
Record-Route: <sip:188.226.200.111;lr=on>.
Record-Route: <sip:188.166.3.25;lr=on;nat=yes>.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>.
Max-Forwards: 68.
Contact: "20111101" <sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Type: application/sdp.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
Content-Length: 376.
.
v=0.
o=20111101-jitsi.org 0 0 IN IP4 188.166.3.25.
s=-.
c=IN IP4 188.166.3.25.
t=0 0.
m=audio 13268 RTP/AVP 0 8 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=rtcp-xr:voip-metrics.
a=sendrecv.
a=rtcp:13269.
m=video 13300 RTP/AVP 96.
a=rtpmap:96 H263-1998/90000.
a=fmtp:96 CUSTOM=1920,1200,2;VGA=2;CIF=1;QCIF=1.
a=recvonly.
a=rtcp:13301.

#
U 77.72.169.128:5060 -> 188.226.200.111:5060
SIP/2.0 100 Trying.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr>,<sip:188.166.3.25;lr;nat=yes>.
Content-Length: 0.
.

#
U 77.72.169.128:5060 -> 188.226.200.111:5060
SIP/2.0 183 Session progress.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 195.
.
v=0.
o=CARRIER 1430313091 1430313091 IN IP4 62.41.83.53.
s=SIP Call.
c=IN IP4 62.41.83.53.
t=0 0.
m=audio 9002 RTP/AVP 0 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.

#
U 188.226.200.111:5060 -> 188.166.3.25:5060
SIP/2.0 183 Session progress.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 195.
.
v=0.
o=CARRIER 1430313091 1430313091 IN IP4 62.41.83.53.
s=SIP Call.
c=IN IP4 62.41.83.53.
t=0 0.
m=audio 9002 RTP/AVP 0 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.

#
U 77.72.169.128:5060 -> 188.226.200.111:5060
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 195.
.
v=0.
o=CARRIER 1430313102 1430313102 IN IP4 62.41.83.53.
s=SIP Call.
c=IN IP4 62.41.83.53.
t=0 0.
m=audio 9002 RTP/AVP 0 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.

#
U 188.226.200.111:5060 -> 188.166.3.25:5060
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.6e47f27f72a51e0a556d44c52407e608.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-69fcd8010ce9974b6339836ce5ffa19a.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 195.
.
v=0.
o=CARRIER 1430313102 1430313102 IN IP4 62.41.83.53.
s=SIP Call.
c=IN IP4 62.41.83.53.
t=0 0.
m=audio 9002 RTP/AVP 0 101.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.

#
U 188.166.3.25:5060 -> 188.226.200.111:5060
ACK sip:4526170000@77.72.169.128:5060 SIP/2.0.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 ACK.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.f7d715aa12609cd69c14240306531c9c.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-e619ba80aa9706d16d736d8d345411f8.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
Max-Forwards: 69.
Route: <sip:188.226.200.111;lr>.
Contact: "20111101" <sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 77.72.169.128:5060
ACK sip:4526170000@77.72.169.128:5060 SIP/2.0.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 2 ACK.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bKf4cd.499fde07c98618e26e3381195f8d0dc6.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKf4cd.f7d715aa12609cd69c14240306531c9c.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=20578;received=80.71.132.145;branch=z9hG4bK-333935-e619ba80aa9706d16d736d8d345411f8.
From: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
To: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
Max-Forwards: 68.
Contact: "20111101" <sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Length: 0.
.

-------------> mobile hangup


#
U 77.72.169.128:5060 -> 188.226.200.111:5060
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 70.
Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr>.
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 188.166.3.25:5060
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 69.
Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr>.
Content-Length: 0.
.

#
U 188.166.3.25:5060 -> 188.226.200.111:5060
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bK25cd.0d0182e8ec6af3861b81fb66c2c53fed.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 68.
Route: <sip:188.226.200.111;lr>.
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 80.71.132.145:20578
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bK25cd.225265ec743545685dd849cc3e0153b9.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bK25cd.0d0182e8ec6af3861b81fb66c2c53fed.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 67.
Content-Length: 0.
.

#
U 188.166.3.25:5060 -> 188.226.200.111:5060
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bK25cd.0d0182e8ec6af3861b81fb66c2c53fed.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 68.
Route: <sip:188.226.200.111;lr>.
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 188.166.3.25:5060
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 69.
Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr>.
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 80.71.132.145:20578
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bK25cd.225265ec743545685dd849cc3e0153b9.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bK25cd.0d0182e8ec6af3861b81fb66c2c53fed.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 67.
Content-Length: 0.
.

#
U 188.166.3.25:5060 -> 188.226.200.111:5060
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bK25cd.0d0182e8ec6af3861b81fb66c2c53fed.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 68.
Route: <sip:188.226.200.111;lr>.
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 188.166.3.25:5060
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 69.
Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr>.
Content-Length: 0.
.

#
U 188.226.200.111:5060 -> 80.71.132.145:20578
BYE sip:20111101@80.71.132.145:20578;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bK25cd.225265ec743545685dd849cc3e0153b9.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bK25cd.0d0182e8ec6af3861b81fb66c2c53fed.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bK25cd.9061966270be463b49b821a0fe0e52e2.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;branch=z9hG4bKf4cd.d3de4986b90b75bf9449ec324740d8c1.0.
From: <sip:4526170000@188.166.3.25>;tag=10313ac553de79dc3406.
To: "20111101" <sip:20111101@188.166.3.25>;tag=3fefe0a8.
Contact: sip:4526170000@77.72.169.128:5060.
Call-ID: 0d190b50e45cf14206a715e69f4e3910@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 67.
Content-Length: 0.
----------


Med venlig hilsen
Martin Schiøtz

On Fri, Apr 24, 2015 at 2:44 AM, Martin Schiøtz <malinux@gmail.com> wrote:
Arhhh, I see the problem now in the BYE message send to 188.166.3.25.
188.166.3.25 will the send it back to 188.226.200.111

Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr;nat=yes>.

Actually 188.226.200.111 is an upstream kamailio test server but it dosen't remove "Route: <sip:188.226.200.111;lr;nat=yes>" (route to itself).
How can I tell it remove exactly that route field?

Chers,
Martin


Med venlig hilsen
Martin Schiøtz

On Fri, Apr 24, 2015 at 12:01 AM, Martin Schiøtz <malinux@gmail.com> wrote:
I did try rtpengine_manage() but rtpengine still saves 10.0.0.100 in redis. I did also try without asymmetric with no luck.

I changed flags in my rtpengine_answer() and rtpengine_offer() to "replace-session-connection replace-origin" that saved the public ip correctly and forwarded SDP correctly. The call is now established 

Now I have problem when the remote user B-end hangs up. Why would kamailio 188.166.3.25 just send the BYE message back to 188.226.200.111 instead of sending it to 80.71.132.X A-end behind NAT?
(the last 4 packeges in the dump)

The problem must be aroung t_relay() ?

Cheers,
Martin

------
route[RELAY] {
#!ifdef WITH_NAT
        if (check_route_param("nat=yes")) {
                setbflag(FLB_NATB);
        }
        if (isflagset(FLT_NATS) || isbflagset(FLB_NATB)) {
                xlog("L_INFO", "MS: RELAY NAT RTPPROXY $rm from $fu:$sp) to $ru\n");
                route(RTPPROXY);
        }
#!endif

        #if (!isflagset(FLT_NATS) && !isbflagset(FLB_NATB) && is_method("INVITE")) {
        #       xlog("L_INFO", "MS: RELAY ALWAYS RTPPROXY $rm from $fu:$sp) to $ru\n");
        #       route(RTPPROXY);
        #}

        #rtpengine_manage();

        /* example how to enable some additional event routes */
        if (is_method("INVITE")) {
                #t_on_branch("BRANCH_ONE");
                t_on_reply("REPLY_ONE");
                t_on_failure("FAIL_ONE");
        }

        if (!t_relay()) {
                xlog("L_INFO", "MS: RELAY !t_relay() $rm from $fu:$sp) to $ru\n");
                sl_reply_error();
        }
        xlog("L_INFO", "MS: RELAY exit $rm from $fu:$sp) to $ru\n");
        exit;
}
------


------
U 80.71.132.X:31934 -> 188.166.3.25:5060
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Max-Forwards: 70.
Contact: "20111101" <sip:20111101@10.0.0.100:5060;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Type: application/sdp.
Via: SIP/2.0/UDP 10.0.0.100:5060;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84.
Proxy-Authorization: Digest username="20111101",realm="188.166.3.25",nonce="VTlkW1U5Yy9YrrUTtVeUzvw+xFmEGaYs",uri="sip:4526666600@188.166.3.25",response="ccc55d6c635dcb4d6d1b94b670c89d9d".
Content-Length: 327.
.
v=0.
o=20111101-jitsi.org 0 0 IN IP4 10.0.0.100.
s=-.
c=IN IP4 10.0.0.100.
t=0 0.
m=audio 5097 RTP/AVP 8 0 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=extmap:1 urn:ietf:params:rtp-hdrext:csrc-audio-level.
a=extmap:2 urn:ietf:params:rtp-hdrext:ssrc-audio-level.
a=rtcp-xr:voip-metrics.

#
U 188.166.3.25:5060 -> 80.71.132.X:31934
SIP/2.0 100 trying -- your call is important to us.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Via: SIP/2.0/UDP 10.0.0.100:5060;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84;rport=31934;received=80.71.132.X.
Server: kamailio (4.2.4 (x86_64/linux)).
Content-Length: 0.
.

#
Record-Route: <sip:188.166.3.25;lr=on;nat=yes>.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Max-Forwards: 69.
Contact: "20111101" <sip:20111101@80.71.132.X:31934;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Type: application/sdp.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKa816.083b127267ff147c8a09c9ae30fcb874.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=31934;received=80.71.132.X;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84.
Content-Length: 246.
.
v=0.
o=20111101-jitsi.org 0 0 IN IP4 188.166.3.25.
s=-.
c=IN IP4 188.166.3.25.
t=0 0.
m=audio 13432 RTP/AVP 8 0 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:0 PCMU/8000.
a=rtpmap:101 telephone-event/8000.
a=rtcp-xr:voip-metrics.
a=sendrecv.
a=rtcp:13433.

#
SIP/2.0 100 trying -- your call is important to us.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKa816.083b127267ff147c8a09c9ae30fcb874.0;rport=5060.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=31934;received=80.71.132.X;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84.
Server: kamailio (4.2.4 (x86_64/linux)).
Content-Length: 0.
.

#
SIP/2.0 183 Session progress.
Via: SIP/2.0/UDP 188.166.3.25;rport=5060;branch=z9hG4bKa816.083b127267ff147c8a09c9ae30fcb874.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=31934;received=80.71.132.X;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
To: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr;nat=yes>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 386.
.
v=0.
o=CARRIER 1429824303 1429824303 IN IP4 188.226.200.111.
s=SIP Call.
c=IN IP4 188.226.200.111.
t=0 0.
m=audio 12864 RTP/AVP 8 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.
a=sendrecv.
a=rtcp:12865.
a=candidate:sNvfjlaEd7h5acsi 1 UDP 2130706431 188.226.200.111 12864 typ host.
a=candidate:sNvfjlaEd7h5acsi 2 UDP 2130706430 188.226.200.111 12865 typ host.

#
U 188.166.3.25:5060 -> 80.71.132.X:31934
SIP/2.0 183 Session progress.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=31934;received=80.71.132.X;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
To: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr;nat=yes>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 224.
.
v=0.
o=CARRIER 1429824303 1429824303 IN IP4 188.166.3.25.
s=SIP Call.
c=IN IP4 188.166.3.25.
t=0 0.
m=audio 13454 RTP/AVP 8 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.
a=sendrecv.
a=rtcp:13455.

#
U 188.166.3.25:5060 -> 80.71.132.X:31934
....
#
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP 188.166.3.25;rport=5060;branch=z9hG4bKa816.083b127267ff147c8a09c9ae30fcb874.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=31934;received=80.71.132.X;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
To: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr;nat=yes>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 386.
.
v=0.
o=CARRIER 1429824314 1429824314 IN IP4 188.226.200.111.
s=SIP Call.
c=IN IP4 188.226.200.111.
t=0 0.
m=audio 12864 RTP/AVP 8 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.
a=sendrecv.
a=rtcp:12865.
a=candidate:sNvfjlaEd7h5acsi 1 UDP 2130706431 188.226.200.111 12864 typ host.
a=candidate:sNvfjlaEd7h5acsi 2 UDP 2130706430 188.226.200.111 12865 typ host.

#
U 188.166.3.25:5060 -> 80.71.132.X:31934
SIP/2.0 200 Ok.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=31934;received=80.71.132.X;branch=z9hG4bK-393535-db2bbc818477010e12d836bb407d9d84.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
To: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 INVITE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Record-route: <sip:188.226.200.111;lr;nat=yes>,<sip:188.166.3.25;lr;nat=yes>.
Content-Type: application/sdp.
Content-Length: 224.
.
v=0.
o=CARRIER 1429824314 1429824314 IN IP4 188.166.3.25.
s=SIP Call.
c=IN IP4 188.166.3.25.
t=0 0.
m=audio 13454 RTP/AVP 8 101.
a=rtpmap:8 PCMA/8000.
a=rtpmap:101 telephone-event/8000.
a=ptime:20.
a=sendrecv.
a=rtcp:13455.

#
U 80.71.132.X:31934 -> 188.166.3.25:5060
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 ACK.
Via: SIP/2.0/UDP 10.0.0.100:5060;branch=z9hG4bK-393535-25734851e5c67dbd09ec9cf4d795b81e.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
To: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
Max-Forwards: 70.
Route: <sip:188.166.3.25;lr;nat=yes>,<sip:188.226.200.111;lr;nat=yes>.
Contact: "20111101" <sip:20111101@10.0.0.100:5060;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Length: 0.
.

#
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 2 ACK.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKa816.6d3ec17b79aa6b68203112f50caf5b1a.0.
Via: SIP/2.0/UDP 10.0.0.100:5060;rport=31934;received=80.71.132.X;branch=z9hG4bK-393535-25734851e5c67dbd09ec9cf4d795b81e.
From: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
To: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
Max-Forwards: 69.
Route: <sip:188.226.200.111;lr;nat=yes>.
Contact: "20111101" <sip:20111101@80.71.132.X:31934;transport=udp;registering_acc=188_166_3_25>.
User-Agent: Jitsi2.8.5426Mac OS X.
Content-Length: 0.
.



--------->>>  remote user hangs up


#
BYE sip:20111101@80.71.132.X:31934;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bKd816.412aface6cc6573fb6f2d579443cf1fe.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;rport=5060;branch=z9hG4bKa816.dae0d2c4c9faf3eb3df105cb8f083cb8.0.
From: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
To: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 69.
Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr;nat=yes>.
Content-Length: 0.
.

#
BYE sip:20111101@80.71.132.X:31934;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKd816.82ed60f84de90b0b5231c65e64e52394.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bKd816.412aface6cc6573fb6f2d579443cf1fe.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;rport=5060;branch=z9hG4bKa816.dae0d2c4c9faf3eb3df105cb8f083cb8.0.
From: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
To: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 68.
Route: <sip:188.226.200.111;lr;nat=yes>.
Content-Length: 0.
.

#
BYE sip:20111101@80.71.132.X:31934;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.226.200.111;branch=z9hG4bKd816.412aface6cc6573fb6f2d579443cf1fe.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;rport=5060;branch=z9hG4bKa816.dae0d2c4c9faf3eb3df105cb8f083cb8.0.
From: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
To: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 69.
Route: <sip:188.166.3.25;lr;nat=yes>.
Route: <sip:188.226.200.111;lr;nat=yes>.
Content-Length: 0.
.

#
BYE sip:20111101@80.71.132.X:31934;transport=udp;registering_acc=188_166_3_25 SIP/2.0.
Via: SIP/2.0/UDP 188.166.3.25;branch=z9hG4bKd816.82ed60f84de90b0b5231c65e64e52394.0.
Via: SIP/2.0/UDP 188.226.200.111;rport=5060;branch=z9hG4bKd816.412aface6cc6573fb6f2d579443cf1fe.0.
Via: SIP/2.0/UDP 77.72.169.128:5060;rport=5060;branch=z9hG4bKa816.dae0d2c4c9faf3eb3df105cb8f083cb8.0.
From: <sip:4526666600@188.166.3.25>;tag=20313ac55080273a8c463.
To: "20111101" <sip:20111101@188.166.3.25>;tag=2d76288c.
Call-ID: f2d3bcbe62094af688e506d641589455@0:0:0:0:0:0:0:0.
CSeq: 1 BYE.
Server: (Very nice Sip Registrar/Proxy Server).
Allow: ACK,BYE,CANCEL,INVITE,REGISTER,OPTIONS,INFO,MESSAGE.
Max-Forwards: 68.
Route: <sip:188.226.200.111;lr;nat=yes>.
Content-Length: 0.
.
------



On Thu, Apr 23, 2015 at 10:12 AM, Daniel Tryba <d.tryba@pocos.nl> wrote:
On Thursday 23 April 2015 01:40:17 Martin Schiøtz wrote:
> I thought that "fix_nated_sdp("2")" would do the job before
> "rtpengine_offer("asymmetric")" but it dosen't have any effect?

My understanding of the docs is that the asymmetric flag introduces the
problem you are experiencing:
asymmetric - flags that UA from which message is received doesn't support
symmetric RTP. Disables learning of endpoint addresses in the Sipwise
rtpengine proxy.

Getting rtp_engine to work with the standard kamailio.cfg is to simply add
rtpengine_manage();
at the top of the NATMANAGE route so it will handle all rtp regardless of
source being natted (in your config in the NAT router.

--

Telefoon: 088 0100 700
Sales: sales@pocos.nl | Service: servicedesk@pocos.nl
http://www.pocos.nl/ | Croy 9c, 5653 LC Eindhoven | Kamer van Koophandel
17097024