[OpenSIPS-Devel] [opensips] NAT Via Test Failure (#401)
jalung
notifications at github.com
Tue Jan 6 16:17:36 CET 2015
Bogdan, normally the script uses nat_traversal/client_nat_test("3") . I have tested flags 7 & 15 and NAT was still not detected; also tested all the flags incrementally for nathelper/nat_uac_test("127") and also not detected.
I'm tending to think it is something out of the norm with the client's mobile network or the client itself and is a special case.
The script below enables the client to register (effectively client_nat_test("7")). Not yet known how this will affect other clients.
route(CHECKTOPVIA);
if (isflagset(RFC1918) || client_nat_test("3")) {
force_rport();
fix_contact();
if (is_method("REGISTER") ) {
$avp(received_uri) = $source_uri;
setbflag(NAT_BFLAG);
} else {
setflag(NAT);
}
if (!has_totag() && is_method("REGISTER|INVITE|SUBSCRIBE")) {
if (proto==UDP) {
nat_keepalive();
} else {
setflag(TCP_PERSISTENT_FLAG);
}
}
}
<code>
route[CHECKTOPVIA] {
if (pcre_match("$(hdr(via)[0])",".*UDP (172\.\b([1][6-9]|[2][0-9]|[3][0-1])\b\.\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\.\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b).*") || pcre_match("$(hdr(via)[0])",".*UDP (10\.\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\.\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\.\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b).*") || pcre_match("$(hdr(via)[0])",".*UDP (192\.\b([0-9]|[1-9][0-9]|1[0-6][0-8])\b\.\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b\.\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\b).*") ) {
setflag(RFC1918);
}
}
</code>
---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/issues/401#issuecomment-68877883
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20150106/2586818b/attachment.htm>
More information about the Devel
mailing list