######## NAT Traversal module - signaling functions ######## #!ifndef NATHELPER-LOADED loadmodule "nathelper.so" #!endif modparam("nathelper", "received_avp", "$avp(AVP_RECV_PARAM)") modparam("nathelper", "sipping_from", "sip:sipcheck@MY_IP_ADDRESS") # modparam("nathelper", "natping_socket", "MY_IP_ADDRESS:5060") ####### NAT Traversal Logic ######## route[NAT_TEST_AND_CORRECT] { if (is_present_hf("Record-Route")) { $var(i) = $rr_count; ## We witnessed this loop execute more than ## 500 times, probably do to inability to ## allocate rr_count or the parser. Either ## way ensure the while loop is not unbound'd while($var(i) > 0 && $var(i) < 30) { $var(i) = $var(i) - 1; $var(rr) = $(hdr(Record-Route)[$var(i)]); if (!is_myself("$(var(rr){nameaddr.uri})")) { setflag(FLAG_SKIP_NAT_CORRECTION); } } } else if ($Rp == "5080") { setflag(FLAG_SKIP_NAT_CORRECTION); } if (isflagset(FLAG_SKIP_NAT_CORRECTION)) { return(); } if (nat_uac_test("3")) { force_rport(); fix_nated_contact(); } if (has_body("application/sdp") && nat_uac_test("8")) { fix_nated_sdp("10"); } } # vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab