[OpenSIPS-Users] How to know whether callee is behind a NAT?
Dragomir Haralambiev
goup2010 at gmail.com
Fri Mar 4 19:24:09 CET 2016
Here is simple way to check NAT devices:
if ( search_body('IN IP4 10.') ) { setflag(NAT); }
if ( search_body("IN IP4 192.168.") ) { setflag(NAT); }
if ( search_body("IN IP4 172.16.") ) { setflag(NAT); }
2016-03-04 19:31 GMT+02:00 Rodrigo Pimenta Carvalho <pimenta at inatel.br>:
> Hi.
>
>
> Nowadays I'm having problems to take right control of SIP messages, in a
> situation with user agents present in the LAN and WAN (some of them are
> behind NAT, to the point of view of OpenSIPS).
>
> To control everything, I'm using local domain and public domain registered
> in the Domain table. In addiction I intend to implement the following
> algorithm:
>
>
>
> If message == SIP INVITE
>
> {
>
> //Tries to guess if client's request originated behind a nat. The
> parameter determines what heuristics is used
>
> // *2* - the "received" test is used: address in Via is compared
> against source IP address of signaling .
>
> // *32* - address in Contact is compared against source IP address of
> signaling.
>
> If ( ! nat_uac_test(2 + 32))
>
> {
>
> //caller is in local network
>
>
> If callee is behind a NAT from the point of view of opensips
>
> {
>
> avp_db_query("select domain from domain where attrs = public",
> "$avp(DOMAIN)");
>
> set_advertised_address ("$avp(DOMAIN));
>
> }
>
> else
>
> {
>
> avp_db_query("select domain from domain where attrs = local",
> "$avp(DOMAIN)");
> set_advertised_address ("$avp(DOMAIN));
>
> }
>
> }
>
> else
>
> {
>
> avp_db_query("select domain from domain where attrs = public",
> "$avp(DOMAIN)");
> set_advertised_address ("$avp(DOMAIN));
>
> }
>
> }
>
> However, how can I know whether the callee is not in the same network area
> as the caller, so the callee is behind a NAT?
>
>
> Any hint will be very helpful!
>
>
> RODRIGO PIMENTA CARVALHO
> Inatel Competence Center
> Software
> Ph: +55 35 3471 9200 RAMAL 979
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160304/fe4c3476/attachment.htm>
More information about the Users
mailing list