Hi Bogdan,
I understand that 200 OK should not be fixed by proxyA. Maybe what I don't understand is what nat_uac_test("2") does and when to use it.
Following is an example where clientA = demo1@altecnet.gr clientB = sip_test_1@i-call.gr proxyA = 213.5.43.4 proxyB = 213.5.43.134
When proxyA goes in the onreply_route for the 200 OK, nat_uac_test("23") returns true (I guess because of the "2" flag) and proxyA fixes the contact again which is wrong. So, would it be safe to use nat_uac_test("23") for the requests and nat_uac_test("21") for the replies? I am afraid this would break the simple case with 2 NATed clients and only one proxy: clientA ------> proxyA ------> clientC
thank you for your help
George
# U 2007/08/08 10:11:34.233164 213.5.43.134:5060 -> 213.5.43.4:5060 SIP/2.0 200 Ok. Via: SIP/2.0/UDP 213.5.43.4;rport=5060;branch=z9hG4bK322.eea78413.0. Via: SIP/2.0/UDP 192.168.1.39;received=213.5.17.226;rport=5060;branch=z9hG4bKc0a801270000 002c46b96cbb000000a000000087. Record-Route: sip:213.5.43.134;lr=on;ftag=109517115931019. Record-Route: sip:213.5.43.4;lr=on;ftag=109517115931019. From: "222" sip:demo1@altecnet.gr;tag=109517115931019. To: sip:sip_test_1@i-call.gr;tag=0r8u9ziv3g. Call-ID: 000029DD-5407-0000-3452-00006A3B0000@192.168.1.39. CSeq: 2 INVITE. Contact: sip:sip_test_1@213.5.17.236:5060;transport=udp;line=9yt55o5b. User-Agent: snom190-3.56w. Allow: INVITE, ACK, CANCEL, BYE, REFER, OPTIONS, NOTIFY, SUBSCRIBE, PRACK, MESSAGE, INFO. Allow-Events: talk, hold, refer. Supported: timer, 100rel, replaces. Content-Type: application/sdp. Content-Length: 208. . v=0. o=root 1592588598 1592588598 IN IP4 213.5.17.236. s=call. c=IN IP4 213.5.17.236. t=0 0. m=audio 10116 RTP/AVP 8 101. a=rtpmap:8 pcma/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=sendrecv.
# U 2007/08/08 10:11:34.234013 213.5.43.4:5060 -> 213.5.17.226:5060 SIP/2.0 200 Ok. Via: SIP/2.0/UDP 192.168.1.39;received=213.5.17.226;rport=5060;branch=z9hG4bKc0a801270000 002c46b96cbb000000a000000087. Record-Route: sip:213.5.43.134;lr=on;ftag=109517115931019. Record-Route: sip:213.5.43.4;lr=on;ftag=109517115931019. From: "222" sip:demo1@altecnet.gr;tag=109517115931019. To: sip:sip_test_1@i-call.gr;tag=0r8u9ziv3g. Call-ID: 000029DD-5407-0000-3452-00006A3B0000@192.168.1.39. CSeq: 2 INVITE. Contact: sip:sip_test_1@213.5.43.134:5060;transport=udp;line=9yt55o5b. User-Agent: snom190-3.56w. Allow: INVITE, ACK, CANCEL, BYE, REFER, OPTIONS, NOTIFY, SUBSCRIBE, PRACK, MESSAGE, INFO. Allow-Events: talk, hold, refer. Supported: timer, 100rel, replaces. Content-Type: application/sdp. Content-Length: 208. P-hint: NATed reply. . v=0. o=root 1592588598 1592588598 IN IP4 213.5.17.236. s=call. c=IN IP4 213.5.17.236. t=0 0. m=audio 10116 RTP/AVP 8 101. a=rtpmap:8 pcma/8000. a=rtpmap:101 telephone-event/8000. a=fmtp:101 0-15. a=sendrecv.
-----Original Message----- From: Bogdan-Andrei Iancu [mailto:bogdan@voice-system.ro] Sent: Wednesday, August 08, 2007 9:50 AM To: Papadopoulos Georgios Cc: users@openser.org Subject: Re: [OpenSER-Users] NAT question
Hi George,
each proxy should fix what it detects. ProxyA will take care of the traffic related to A (since it detects A as NATed) and ProxyB should take care of traffic for B (as it sees B as nated). So, the 200 OK must be fixed only by proxyB.
Regards, bogdan
Papadopoulos Georgios wrote:
Hello all,
I need some advice from all you NAT experts. Assume that we
have two
OpenSER proxies serving two different domains and they both use nathelper. Also assume that their configuration is
identical and looks
roughly like:
route { ... record_route();
if (nat_uac_test("23")) { if (method!="REGISTER" &&
!is_present_hf("Record-Route")) { fix_nated_contact(); } }
t_on_reply("1");
}
onreply_route[1] { if (nat_uac_test("23")) { fix_nated_contact(); }; } clientA and clientB are both behind NAT. clientA@domainA mailto:clientA@domainA sends an INVITE to clientB@domainB mailto:clientB@domainB through proxyA:
clientA@domainA mailto:clientA@domainA -----> ProxyA
-----> ProxyB
------> clientB@domainB mailto:clientB@domainB
ProxyA detects that clientA is behind NAT and fixes the contact. ProxyB finds the Record-Route header, so it does not fix
the contact.
My question is about how to handle the 200 OK. With this
configuration
both proxies detect that clientB is behind NAT and the contact gets fixed twice. Is there a way to avoid this?
thank you
George
Disclaimer
The information in this e-mail and any attachments is
confidential. It
is intended solely for the attention and use of the named addressee(s). If you are not the intended recipient, or person responsible for delivering this information to the intended
recipient,
please notify the sender immediately. Unless you are the intended recipient or his/her representative you are not authorized to, and must not, read, copy, distribute, use or retain this message or any part of it. E-mail transmission cannot be guaranteed to be
secure or
error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses.
--
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
El Wednesday 08 August 2007 10:30:54 Papadopoulos Georgios escribió:
Hi Bogdan,
I understand that 200 OK should not be fixed by proxyA. Maybe what I don't understand is what nat_uac_test("2") does and when to use it.
Following is an example where clientA = demo1@altecnet.gr clientB = sip_test_1@i-call.gr proxyA = 213.5.43.4 proxyB = 213.5.43.134
When proxyA goes in the onreply_route for the 200 OK, nat_uac_test("23") returns true (I guess because of the "2" flag) and proxyA fixes the contact again which is wrong. So, would it be safe to use nat_uac_test("23") for the requests and nat_uac_test("21") for the replies? I am afraid this would break the simple case with 2 NATed clients and only one proxy: clientA ------> proxyA ------> clientC
Good point. As I think, the correct NAT test for replies is: nat_uac_test("1") so we just check if Contact: header does contain an RFC1918 IP address (private IP address).
In your case it will work since the <Contact> modified by proxyB will contain a non private IP so the NAT check (nat_uac_test("1")) in proxyA wont detect the repliy as behind NAT.
Maybe others test could be done, but I think they should no valid test that just compare the received IP with the IP of the contact since both could be public IP but different, in which case shouldn't be applied "fix_nat_contact".
Regards.