– Kamailio SIP Server –

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.

  #incoming call
  # step 1
  write src_ip $si to AVP
  # step 2
  write destination IP $dd into AVP
  compare AVPs
  if AVP1!=AVP2 && natflag {use rtpproxy}

The following code snippet was presented by Tavis P.


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