[OpenSIPS-Users] How to know whether callee is behind a NAT?
Rodrigo Pimenta Carvalho
pimenta at inatel.br
Fri Mar 4 20:53:53 CET 2016
Hi.
Thank you for the hint.
I think that search_body will search a string in SDP body. In this case, for the first INVITE, SDP doesn't have information about the callee. So, maybe I have to use a way of checking the register of the callee (table location) and see if the contact and received columns give me some information.
Any idea?
Best regards.
RODRIGO PIMENTA CARVALHO
Inatel Competence Center
Software
Ph: +55 35 3471 9200 RAMAL 979
________________________________
De: users-bounces at lists.opensips.org <users-bounces at lists.opensips.org> em nome de Dragomir Haralambiev <goup2010 at gmail.com>
Enviado: sexta-feira, 4 de março de 2016 15:24
Para: OpenSIPS users mailling list
Assunto: Re: [OpenSIPS-Users] How to know whether callee is behind a NAT?
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<mailto: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<tel:%2B55%2035%203471%209200> RAMAL 979
_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto: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/7f8bd80f/attachment.htm>
More information about the Users
mailing list