– Kamailio SIP Server –

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
examples:caller-callee-behind-same-nat [2007/06/25 17:56]
213.96.13.38 Make correct the use of "avp_printf"
examples:caller-callee-behind-same-nat [2007/06/25 19:56] (current)
Line 1: Line 1:
 +====== How to set up nathelper/rtpproxy when both SIP UA's are behind same NAT ======
  
 +
 +The suggestion below is from Klaus Darilion
 +
 +This should work as long as there is only one client registered. 
 +If there are multiple branches, step 2 must be done in the branch route.
 +
 +<code>
 +  #incoming call
 +  # step 1
 +  write src_ip $si to AVP
 +  lookup("location");
 +  # step 2
 +  write destination IP $dd into AVP
 +  compare AVPs
 +  if AVP1!=AVP2 && natflag {use rtpproxy}
 +</code>
 +
 +The following code snippet was presented by Tavis P.
 +
 +<code>
 +  else if ( isflagset(2) and isflagset(3) )
 +  {
 +    log(1, "Both Clients are behind NAT");
 +    # Store the destination domain into an AVP
 +    avp_printf("$avp(i:450)", "$dd");
 +    if ( avp_check("i:450", "eq/$src_ip/g") )
 +    {
 +      xlog("L_INFO", "Detected Two Clients Behind the Same NAT - Disabling Mediaproxy");
 +      # Do not use mediaproxy as the clients seem to be behind the same NAT
 +      resetflag(2);
 +      resetflag(3);
 +    }
 +  }
 +<code>