[SR-Users] Kamailio and rtpengine - client behind NAT

Martin Schiøtz malinux at gmail.com
Fri Apr 24 02:44:09 CEST 2015


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 at 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
> INVITE sip:4526666600 at 188.166.3.25 SIP/2.0.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 0:0:0:0:0:0:0:0.
> CSeq: 2 INVITE.
> From: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>.
> Max-Forwards: 70.
> Contact: "20111101" <sip:20111101 at 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 at 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 at 0:0:0:0:0:0:0:0.
> CSeq: 2 INVITE.
> From: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>.
> 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.
> .
>
> #
> U 188.166.3.25:5060 -> 188.226.200.111:5060
> INVITE sip:4526666600 at trunk.worldconnect.dk SIP/2.0.
> Record-Route: <sip:188.166.3.25;lr=on;nat=yes>.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 0:0:0:0:0:0:0:0.
> CSeq: 2 INVITE.
> From: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>.
> 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.
>
> #
> U 188.226.200.111:5060 -> 188.166.3.25:5060
> SIP/2.0 100 trying -- your call is important to us.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 0:0:0:0:0:0:0:0.
> CSeq: 2 INVITE.
> From: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>.
> 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.
> .
>
> #
> 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;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 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>;tag=20313ac55080273a8c463.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>;tag=20313ac55080273a8c463.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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
> ....
> #
> 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;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 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>;tag=20313ac55080273a8c463.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>;tag=20313ac55080273a8c463.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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
> ACK sip:4526666600 at 77.72.169.128:5060 SIP/2.0.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 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 at 10.0.0.100:5060
> ;transport=udp;registering_acc=188_166_3_25>.
> User-Agent: Jitsi2.8.5426Mac OS X.
> Content-Length: 0.
> .
>
> #
> U 188.166.3.25:5060 -> 188.226.200.111:5060
> ACK sip:4526666600 at 77.72.169.128:5060 SIP/2.0.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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 at 188.166.3.25>;tag=2d76288c.
> To: <sip:4526666600 at 188.166.3.25>;tag=20313ac55080273a8c463.
> Max-Forwards: 69.
> Route: <sip:188.226.200.111;lr;nat=yes>.
> Contact: "20111101" <sip:20111101 at 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
>
>
> #
> U 188.226.200.111:5060 -> 188.166.3.25:5060
> BYE sip:20111101 at 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 at 188.166.3.25>;tag=20313ac55080273a8c463.
> To: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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.
> .
>
> #
> U 188.166.3.25:5060 -> 188.226.200.111:5060
> BYE sip:20111101 at 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 at 188.166.3.25>;tag=20313ac55080273a8c463.
> To: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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.
> .
>
> #
> U 188.226.200.111:5060 -> 188.166.3.25:5060
> BYE sip:20111101 at 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 at 188.166.3.25>;tag=20313ac55080273a8c463.
> To: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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.
> .
>
> #
> U 188.166.3.25:5060 -> 188.226.200.111:5060
> BYE sip:20111101 at 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 at 188.166.3.25>;tag=20313ac55080273a8c463.
> To: "20111101" <sip:20111101 at 188.166.3.25>;tag=2d76288c.
> Contact: sip:4526666600 at 77.72.169.128:5060.
> Call-ID: f2d3bcbe62094af688e506d641589455 at 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 at 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 at pocos.nl | Service: servicedesk at pocos.nl
>> http://www.pocos.nl/ | Croy 9c, 5653 LC Eindhoven | Kamer van Koophandel
>> 17097024
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20150424/f0e23f69/attachment.html>


More information about the sr-users mailing list