[OpenSIPS-Users] How to know whether callee is behind a NAT?

Rodrigo Pimenta Carvalho pimenta at inatel.br
Fri Mar 4 18:31:30 CET 2016


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20160304/9190963e/attachment-0001.htm>


More information about the Users mailing list