<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2523" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>I am new to SER and I am looking for how to 
determine whether the caller and the callee are behind NAT. I found some example 
code from Zeus. But I do not understand how I can distinguished whether the 
caller is the caller and the callee is the callee. Here is the 
code:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial 
size=2>/**************************************************************************************************************************/</FONT></DIV>
<DIV><PRE>Jan,

See below. Also, always CC the list so that other people can help you.

Zeus


&gt;<I> &gt; 
</I>&gt;<I> &gt; Flag 4 is set when the caller is behind NAT.
</I>&gt;<I> &gt; Flag 5 is set when the callee is behind NAT.
</I>

&gt;<I> Would you be so kind and tell me how do you test messages to 
</I>&gt;<I> set these 
</I>&gt;<I> flags?
</I>
        /*
        Check for UAC behind NAT
        This is done by nat_uac_test("7") which checks for
        1. RFC 1918 address in Contact - 01
        2. different src_ip and Via header - 02
        3. RFC1918 in Top Via - 04
        */
</PRE><PRE>/*********************************************************************************************************************</PRE><PRE>1. Right here - it seems to me that if both the caller and the callee are behind NAT. It will be flag as (4) and do the force_rport.</PRE><PRE>*********************************************************************************************************************/</PRE><PRE>        if (nat_uac_test("3")) {        /* 1 + 2 = 3 */
                xlog("L_NOTICE", "%rm: Client is behind NAT\n"); 
                setflag(4);     /* Flag it's a nated R-URI */
                if (method=="REGISTER" || !search("^Record-Route:")) {
                        force_rport();
                        if (!method=="MESSAGE") {       /* MESSAGE has no Contact header, see RFC 3428 */
                                fix_nated_contact();
                        };
                };
        } else {
                xlog("L_NOTICE", "%rm: Client is not behind a NAT\n");
        };</PRE><PRE>... Other checking ...</PRE><PRE>/********************************************************************************************************************</PRE><PRE>2. Then down here - it seems to me that the caller and the callee will be mark as flag 5. Then save into the location. Later on, how can I tell if</PRE><PRE>the packet comes to SER is a caller or the callee ????. I could not understand this.</PRE><PRE>********************************************************************************************************************/
        if (method=="REGISTER") {
                if (isflagset(4)) {     
                        setflag(5);     /* Turn on NAT Ping and flag it as a NAT callee */
                };

                if (!save("location")) {
                        xlog("L_ERR", "%rm: Failed\n");
                        sl_reply_error();
                };
                break;
        };

/********************************************************************************************************************/

</PRE><PRE>I am trying to make SER works with two UAs behind a same NAT. Any help would be very appreciated.</PRE><PRE>&nbsp;</PRE><PRE>Regards,</PRE><PRE>Trong
</PRE><!--endarticle--></DIV></BODY></HTML>