[OpenSER-Users] OpenSER 1.2.X - Is it possible to check if callee in NAT-ed network?

David Loh davidloh at vyke.com
Thu Feb 14 11:44:34 CET 2008


Hi Guys,

I've encountered one-way voice situation, where caller on Public IP make 
a P2P call to callee behind NAT, wondering is there any OpenSER 
module/function that could actually query callee's network type, if 
OpenSER can detect callee network (whether it's NAT or not), I can use 
rtp proxy to overcome the one-way voice.

Currently my setup works on following:
Caller --- Callee
1) WAN to WAN
2) NAT to NAT (force_rtp_proxy)
3) NAT to WAN (force_rtp_proxy)

but for the WAN to NAT case, due to the caller aren't behind NAT, I 
didn't run force_rtp_proxy, but whenever the P2P call established, it 
result one-way voice.

I'm thinking of querying the callee detail from database via AVP, but it 
doesn't sound feasible; wondering if there's any better solution.

P/S:
My openser.cfg (INVITE route)
-------------------------------
route[3] {
   if(nat_uac_test("19")) {
       fix_nated_contact();
   }

  # 10*  = P2P call
   if(uri=~"^sip:10\*.+ at .*") {
       strip(3);

       if(!lookup("location")) {
           xlog("L_INFO", "DBG: P2P Peer not found [$tu] from [$fu]($si)");
           sl_send_reply("404", "User Offline");
           exit;
       }

       xlog("L_INFO", "DBG: P2P Call [$fu]($si) to [$tu]");

      # For NAT-to-WAN or NAT-to-NAT, supposedly WAN-to-NAT should run 
this too :(
       if(nat_uac_test("19") || search("^Route:.*;nat=yes")) {
          # onreply_route[2] will do a "force_rtp_proxy"
           t_on_reply("2");
           force_rtp_proxy();
           xlog("L_INFO", "DBG: NAT-ed P2P Call, RTP Proxy Forced 
[$fu]($si)");
       }
   } else
       if(!proxy_authorize("", "subscriber")) {
           xlog("L_INFO", "DBG: INVITE [$fu]($si) PROXY authentication 
FAILED");
           proxy_challenge("", "1");
           exit;
       }

       if(!check_from()) {
           xlog("L_INFO", "INVITE Spoofed From-URI detected - RURI=$ru 
F=$fu T=$tu IP=$si ID=$ci\n");
           sl_send_reply("403", "Spoofed From-URI Detected");
           exit;
       }

       rewritehost("1.2.3.4");
   }

   t_on_reply("1");
   t_on_failure("1");
   t_relay();
   xlog("L_INFO", "DBG: INVITE F-[$fu] T-[$tu] IP-[$si] UA-[$ua] 
SUCCESSFUL");
}
-------------------------------



Thanks,
David Loh





More information about the Users mailing list