[OpenSIPS-Users] Fix_nated_sdp

Lawrence Na (MY-RND@Vyke) lawrence at vyke.com
Thu Nov 19 16:25:55 CET 2009


Hi All,

I¹ve got a problem with fix_nated_sdp, whenever I call the method in the
request route it doesn¹t seems to take effect. My INVITE c= & o= list the
proxy IP instead of the IP which I¹ve set in the method 2nd argument. The
weird thing, fix_nated_sdp in my reply route seems to work just fine. Below
are part of my scripts:

Route[4] {
if(to_uri=~"^sip:([A-Z][a-z])([A-Z][a-z]).+@*")
    {
        xlog("L_INFO", "DBG: P2P Call [$fu] -> [$tu]");
       
        if(!lookup("location"))
        {
                   xlog("L_INFO", "DBG: P2P Peer not found [$tu] from
[$fu]($si)");
                   sl_send_reply("404", "User Offline");
                   exit;
        }
       
               if(isbflagset(6))
        {
                   xlog("L_INFO", "DBG: NATed P2P Call [$fu] -> [$tu], force
RTP");
                    fix_nated_sdp(³10², ³$si²);
               }
     }
}

onreply_route[1]
{
        if(client_nat_test("7"))
        {
            fix_contact();
            setbflag(6);
        }
    
        if(status=~"(180)|(183)|2[0-9][0-9]")
        {
            if(search("^Content-Type:[ ]*application/sdp"))
            {
                if(isbflagset(6) && (!to_uri=~"sip:[+][0-9][0-9][0-9].+@*"))
                {
                    xlog("L_INFO", "DBG: Reply - S=$rs D=$rr F=$fu T=$tu
[$rm], force RTP");
                    fix_nated_sdp(³10², ³$si²);
                    exit;
                }
            }    
        }

    xlog("L_INFO", "DBG: Reply - S=$rs D=$rr F=$fu T=$tu [$rm]");
}

E.g:
INVITE
 y.y.y.y              202.202.202.202               x.x.x.x(external IP)
A ------------------> Proxy ------------------> B
c=192.168.1.2                                             c=202.202.202.202
o=192.168.1.2                                            o=202.202.202.202

200 response
x.x.x.x             202.202.202.202              y.y.y.y (external IP)
B ------------------> Proxy ------------------> A
c=192.168.0.2                                            c=x.x.x.x
o=192.168.0.2                                           o=x.x.x.x

Hope there is some gurus out there able to shade some lights.

-------------------------------------------------------------------
Regards,
Lawrence Na Chong Guan
-------------------------------------------------------------------

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20091119/91354c44/attachment.htm 


More information about the Users mailing list