[Serusers] Nathelper question

Zeus Ng zeus.ng at isquare.com.au
Sat Jul 10 07:31:29 CEST 2004


The following routine should give you a general idea how to handle this
situation. Basically, don't do rtp proxy when both caller and callee are
behind same NAT. Just change their contact address for signalling.


Flag 4 is set when the caller is behind NAT.
Flag 5 is set when the callee is behind NAT.

 if (method=="INVITE") {
   if (isflagset(4) && isflagset(5)) { /* NAT source & NAT dest. */
     if (!exec_msg('echo $SIP_RURI | cut -d: -f2 | cut -d@ -f2 | grep
"$SIP_SRCIP" > /dev/null')) {
       xlog("L_NOTICE", "UAs behind different NAT devices, forcing
rtpproxy\n");
       force_rtp_proxy();
       t_on_reply("2");
     } else {
       xlog("L_NOTICE", "UAs behind same NAT devices\n");
       t_on_reply("3");
     }
     ... Other situation, NAT -> Public, Public -> NAT ...
 }

 onreply_route[2] {
   if (t_check_status("200") || t_check_status("183")) {
     if (isflagset(5)) {
       fix_nated_contact();
     };
    force_rtp_proxy();
   };
 };

 onreply_route[3] {
   if (t_check_status("200") || t_check_status("183")) {
     if (isflagset(5)) {
       fix_nated_contact();
     };
   };
 };


> 
> Another question, what happen if two people on the SAME LOCAL 
> network try to call each other via my SER server ?
> 
> Their adress will be detected as private and rtpproxy will be 
> use, but it's not needed as they are visible for each other.
> 
> How could i prevent this ?
> 
> Thanks
> 
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
> 




More information about the sr-users mailing list