[Serusers] NAT & Madia Proxy.

Mohamed Omar amatek2004 at yahoo.ca
Mon Dec 20 02:41:31 CET 2004


I'm currently run ser with media proxy and it working fine if I force all calls throught the the media proxy...
 
I want only calls destine to PSTN gateway to go through the media proxy for billing purpose and all other calls, I just want to fix the NAT and setup the call.  I dont want the  media to go throught my server if it not destine to PSTN network. 
 
Let me know how my config should be...Am new with SER and am stuck on this.  below is my configure for NAT.
 
Thanks in Advance.
 

# -- nat ping --

modparam("mediaproxy", "natping_interval", 10)

modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock")

 

# -------------------------  request routing logic -------------------

 

# main routing logic

 

        record_route();

        # loose-route processing

 

        if (loose_route()) {

                t_relay();

                break;

        };

 

# -- nat code --

                if (method == "BYE" || method == "CANCEL") {

                        end_media_session();

                };

 

            if (client_nat_test("3")) {

                        if (method == "REGISTER" || ! search("^Record-Route:")) {

                                fix_contact();

                                force_rport();

                        };

                };

 

        if (method=="INVITE") {

                        use_media_proxy();

                        t_on_reply("1");

                        setflag(6);

       };

 

 

 

        # if the request is for other domain use UsrLoc

        # (in case, it does not work, use the following command

        # with proper names and addresses in it)

        if (uri==myself) {

 

                if (method=="REGISTER") {

 

                        save("location");

                        break;

                };

 

  #            setflag(1);

 

                # native SIP destinations are handled using our USRLOC DB

                 if (!lookup("location")) {

        log (1, "**********************  Rewriting the host:port ***********************************");

 

                        rewritehostport ("PSTN Gateway Ip:5060");

                };

 

        };

        if (method == "INVITE"){

                t_relay();

                sl_send_reply ("180", "Ringing");

                break;

        }

        if (!t_relay()) {

                 sl_send_reply("404", "Not Found");

                 break;

        };

 

# -- nat code ----

}

 

 

onreply_route[1] {

    if (status=~"(183)|2[0-9][0-9]") {

        if (client_nat_test("1")) {

            fix_contact();

        };

        use_media_proxy();

    };

    if (status=~"[3-4]0[0-9]") {

        end_media_session();

        break;

    };

}

 

 

 
 
 
 
 



---------------------------------
Post your free ad now! Yahoo! Canada Personals
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20041219/01534ffa/attachment.htm>


More information about the sr-users mailing list