[OpenSIPS-Users] two UACs behind the same nat

Bogdan-Andrei Iancu bogdan at opensips.org
Tue Mar 19 16:10:23 CET 2013


Hi Nick,

So, your opensips should do the NAT traversal for the signaling 
(fix_nated_contact() stuff), but it should not do anything in regards to 
media (rtpproxy) if caller and callee are behind the same NAT - how to 
test that ? after lookup(location), when you know the destination IP of 
the callee, you can simply check if SRC IP of the call is the same with 
the destination IP - if so, it means caller and callee are behind the 
same NAT.

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com


On 03/18/2013 04:20 PM, Nick wrote:
> Hello
>
> I checked it. It don't to go to the route[nat_fixups].
> But My UACs both behind the same NAT.
>
> How to check why not go to the route[nat_fixups]??
>
> Thanks
> Nick
>
>
> 2013/3/18 Nick Khamis <symack at gmail.com <mailto:symack at gmail.com>>
>
>     It will change it if fired. Make sure that you get to
>     "route[nat_fixups]" for the call. And for testing, try removing the
>     flags" (isflagset(5) || isbflagset(6))" etc... xlog("Why me god:
>     $ru\n") always seems to have mercy on our souls. ;)
>
>
>     Nick.
>
>     On 3/18/13, Nick <nick.chang at kland.com.tw
>     <mailto:nick.chang at kland.com.tw>> wrote:
>     > Hello
>     >
>     > I modify my config.
>     >
>     > route[nat_fixups] {
>     > xlog("L_NOTICE","4 NAT FIXED - $fu call $ru ");
>     >         #---- RTP Proxy handling ---#
>     >         if (is_method("BYE|CANCEL")) {
>     >                 unforce_rtp_proxy();
>     >         } else if (is_method("INVITE")){
>     >                 #---- Activates the RTP Proxy for the CALLEE ---#
>     >                 rtpproxy_offer("c","61.67.128.46");
>     >         };
>     >         # catch and fix replies
>     >         t_on_reply("2");
>     > }
>     >
>     > onreply_route[2] {
>     >         #xlog("incoming reply\n");
>     >
>     >         #---- Handling of the SDP for the 200 or 183 reply ----#
>     >         #---- If behind nat (flags 5 or 6) start RTP Proxy ----#
>     >         #----    Activates the RTP Proxy for the CALLER    ----#
>     >         if ( is_method("INVITE") &&
>     >         (isflagset(5) || isbflagset(6)) &&
>     >         has_body("application/sdp") ){
>     >                 rtpproxy_answer("c","61.67.128.46");
>     >         }
>     >
>     >         #---- If the CALLEE is behind NAT, fix the CONTACT HF ----#
>     >         if (isbflagset(6)) {
>     >                 fix_nated_contact();
>     >                 search_append('Contact:.*sip:[^>[:cntrl:]]*',
>     ';nat=yes');
>     >         }
>     >         exit;
>     > }
>     >
>     > Then, I used ngrep get packet.
>     >
>     > Connection Information still not Opensips SERVER of IP.
>     > It's not change to my setting.
>     >
>     > Do you have any suggestion??
>     >
>     > Thanks
>     > Nick
>     >
>     >
>     >
>     > 2013/3/15 Nick Khamis <symack at gmail.com <mailto:symack at gmail.com>>
>     >
>     >> Hello Nick,
>     >>
>     >> As Bogdan pointed out please look at the important parts of
>     your SDP
>     >> payload:
>     >>
>     >> sip:55688 at 61.67.128.46:5060 <http://sip:55688@61.67.128.46:5060>
>     >> Contact: <sip:55688 at 211.75.166.164:5060
>     <http://sip:55688@211.75.166.164:5060>>
>     >> c=IN IP4 211.75.166.164
>     >>
>     >> sip:9999 at 61.67.128.46 <mailto:sip%3A9999 at 61.67.128.46>
>     >> Contact: <sip:9999 at 192.168.4.197:5060
>     <http://sip:9999@192.168.4.197:5060>>
>     >> c=IN IP4 192.168.4.197
>     >>
>     >> Kind Regards,
>     >>
>     >> Nick.
>     >>
>     >> On 3/15/13, Bogdan-Andrei Iancu <bogdan at opensips.org
>     <mailto:bogdan at opensips.org>> wrote:
>     >> > Hi Nick,
>     >> >
>     >> > But in the SDP-s received by the UACs, in the "c" line, you
>     see the IP
>     >> > of the other UAC and not the IP of OpenSIPS, right ?
>     >> >
>     >> > Regards,
>     >> >
>     >> > Bogdan-Andrei Iancu
>     >> > OpenSIPS Founder and Developer
>     >> > http://www.opensips-solutions.com
>     >> >
>     >> >
>     >> > On 03/15/2013 03:28 AM, Nick Chang wrote:
>     >> >>
>     >> >> Hello Bodgan
>     >> >>
>     >> >> 2 UACs behind the same nat, I check my routing.
>     >> >>
>     >> >> UAC don't route to nat_fixups.
>     >> >>
>     >> >> But UACs checked My OpenSIPS private IP (10.10.12.111), Not
>     Public IP.
>     >> >>
>     >> >> I don't know why? Do you have any suggestion??
>     >> >>
>     >> >> My Config
>     >> >>
>     >> >> route[generic_relay] {
>     >> >>
>     >> >> xlog("L_NOTICE","3 invite $si");
>     >> >>
>     >> >>         # for INVITEs enable some additional helper routes
>     >> >>
>     >> >>         #---- Helper route, if nat=yes in the R-URI  set
>     flag 6 ----#
>     >> >>
>     >> >>         #----        This is used to Process REINVITES      
>        ----#
>     >> >>
>     >> >>         if (subst_uri('/((sip:.*)||(sip:.*:.*));nat=yes/\1/')){
>     >> >>
>     >> >>                 setbflag(6);
>     >> >>
>     >> >>         };
>     >> >>
>     >> >>         #---- If caller(flag 5) or callee(flag 6) are behind
>     NAT  ---#
>     >> >>
>     >> >>         #---- Call the route(6) to force the use of the RTP
>     Proxy ---#
>     >> >>
>     >> >>         if (isflagset(5) || isbflagset(6)) {
>     >> >>
>     >> >>                 route(nat_fixups);
>     >> >>
>     >> >>         };
>     >> >>
>     >> >>         if (!t_relay()) {
>     >> >>
>     >> >>                 sl_reply_error();
>     >> >>
>     >> >>         };
>     >> >>
>     >> >>         exit;
>     >> >>
>     >> >> }
>     >> >>
>     >> >> route[nat_fixups] {
>     >> >>
>     >> >> xlog("L_NOTICE","4 NAT FIXED - $fu call $ru ");
>     >> >>
>     >> >>         #---- RTP Proxy handling ---#
>     >> >>
>     >> >>         if (is_method("BYE|CANCEL")) {
>     >> >>
>     >> >>                 unforce_rtp_proxy();
>     >> >>
>     >> >>         } else if (is_method("INVITE")){
>     >> >>
>     >> >>                 #---- Activates the RTP Proxy for the CALLEE
>     ---#
>     >> >>
>     >> >>                 rtpproxy_offer();
>     >> >>
>     >> >>         };
>     >> >>
>     >> >>         # catch and fix replies
>     >> >>
>     >> >>         t_on_reply("2");
>     >> >>
>     >> >> }
>     >> >>
>     >> >> Thanks
>     >> >>
>     >> >> Nick
>     >> >>
>     >> >> *From:*Bogdan-Andrei Iancu [mailto:bogdan at opensips.org
>     <mailto:bogdan at opensips.org>]
>     >> >> *Sent:* Friday, March 15, 2013 12:32 AM
>     >> >> *To:* OpenSIPS users mailling list
>     >> >> *Cc:* Nick Chang
>     >> >> *Subject:* Re: [OpenSIPS-Users] two UACs behind the same nat
>     >> >>
>     >> >> Hi Nick,
>     >> >>
>     >> >> Assuming routing is possible between the 2 UACs, you need to
>     double
>     >> >> check that the IPs in SDP are not changed by proxy and
>     points to the
>     >> >> actual UACs.
>     >> >>
>     >> >> Regards,
>     >> >>
>     >> >> Bogdan-Andrei Iancu
>     >> >> OpenSIPS Founder and Developer
>     >> >> http://www.opensips-solutions.com
>     >> >>
>     >> >>
>     >> >> On 03/11/2013 11:40 AM, Nick Chang wrote:
>     >> >>
>     >> >> Hello
>     >> >>
>     >> >> I have two UACs behind the same nat.
>     >> >>
>     >> >> A call B is OK. But it's not voice.
>     >> >>
>     >> >> Can everyone give me a suggestion??
>     >> >>
>     >> >> Thanks
>     >> >>
>     >> >> Nick
>     >> >>
>     >> >>
>     >> >>
>     >> >> _______________________________________________
>     >> >> Users mailing list
>     >> >> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     <mailto:Users at lists.opensips.org <mailto:Users at lists.opensips.org>>
>     >> >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>     >> >
>     >>
>     >> _______________________________________________
>     >> Users mailing list
>     >> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     >> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>     >>
>     >
>
>     _______________________________________________
>     Users mailing list
>     Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>     http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20130319/b5c64dde/attachment-0001.htm>


More information about the Users mailing list