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
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to