<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-9">
<META content="MSHTML 6.00.2900.2668" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><PRE><PRE>Dear List,</PRE><PRE>&nbsp;</PRE><PRE>This is a big explanation with enough information except ngrep/ethereal captures, in both cases :</PRE><PRE>&nbsp;</PRE><PRE>ADSL Connection Speed : 512/128,</PRE><PRE>&nbsp;</PRE><PRE>ATA's : Zyxel P2002,</PRE><PRE>Codec : G729,</PRE><PRE>RTP Port Range : 19000-20000,</PRE><PRE>&nbsp;</PRE><PRE>and OpenSER on Public IP without NAT etc.</PRE><PRE>&nbsp;</PRE><PRE>I think i should change the ser.cfg to use MediaProxy just for SIP2SIP calls not for PSTN calls and i do not know how to do it, any clues ?</PRE><PRE>&nbsp;</PRE><PRE>Thanks,</PRE><PRE>Ozan</PRE><PRE>&nbsp;</PRE><PRE>* A Side client use Zoom 4X, port forwarding to ATA in modem setting i register as port:5060 (openserctl ul show),</PRE><PRE>* B Side client use Zyxel 660R, port forwarding to ATA in modem setting and register as port:10XXX (openserctl ul show),</PRE><PRE>* Make a call to other sip client it's okay voice quality is acceptable most of time, but caller or callee losts ADSL connection after 30-60 seconds,</PRE><PRE>* >From A Side (Zoom 4X), make a call to PSTN, ADSL crashes, everything locks up,</PRE><PRE>* From B Side (Zyxel 660R), make a call to PSTN, everything is normal, connection never down.</PRE><PRE>&nbsp;</PRE><PRE>ps: If i change A Side client modem to Zyxel 660R too as B Side client, the problems are totaly same.</PRE><PRE>&nbsp;</PRE><PRE>here is my basic ser.cfg &gt;&gt;&gt;</PRE></PRE><PRE>debug=3<BR>fork=yes<BR>log_stderror=no<BR>check_via=no<BR>listen=212.XXX.104.XXX&nbsp;&nbsp;&nbsp; # OpenSER Server on Public IP
<BR>port=5060<BR>children=4<BR>dns=no<BR>rev_dns=no<BR>fifo="/tmp/openser_fifo"</PRE><PRE>loadmodule "/usr/local/lib/openser/modules/sl.so"<BR>loadmodule "/usr/local/lib/openser/modules/tm.so"<BR>loadmodule "/usr/local/lib/openser/modules/rr.so"<BR>loadmodule "/usr/local/lib/openser/modules/maxfwd.so"<BR>loadmodule "/usr/local/lib/openser/modules/usrloc.so"<BR>loadmodule "/usr/local/lib/openser/modules/registrar.so"</PRE><PRE>modparam("usrloc", "db_mode",&nbsp;&nbsp; 0)<BR>modparam("rr", "enable_full_lr", 1)</PRE><PRE>route {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!mf_process_maxfwd_header("10")) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply("483", "Too Many Hops");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (msg:len &gt; max_len) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply("513", "Message Overflow");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };</PRE><PRE>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (method!="REGISTER") {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; route(1);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>}</PRE><PRE>route[1] {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!t_relay()) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_reply_error();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>}</PRE><PRE>route[2] {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!save("location")) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_reply_error();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<BR>}</PRE><PRE>In my advanced SER.CFG ;</PRE><PRE><PRE>* A Side client use Zoom 4X, port forwarding to ATA in modem setting i register as port:1XXXX (openserctl ul show),</PRE><PRE>* B Side client use Zyxel 660R, port forwarding to ATA in modem setting and register as port:1XXXX (openserctl ul show),</PRE><PRE>* Make a call to other sip client it's okay voice quality is worse then first case most of time, connection never down,</PRE><PRE>* From A Side (Zoom 4X), make a call to PSTN, everything is normal, connection never down,</PRE><PRE>* From B Side (Zyxel 660R), make a call to PSTN, everything is normal, connection never down.</PRE><PRE>&nbsp;</PRE><PRE>ps : If i change both A Side client and B Side client modems not to do port forwarding, problems are totaly same.</PRE><PRE>&nbsp;</PRE><PRE>here is my advanced ser.cfg &gt;&gt;&gt;</PRE><PRE>&nbsp;</PRE></PRE><PRE>debug=3
fork=yes
log_stderror=no

listen=212.XXX.104.XXX&nbsp;&nbsp;&nbsp; # OpenSER Server on Public IP
port=5060
children=4

alias=212.XXX.104.XXX&nbsp;&nbsp;&nbsp; # OpenSER Server on Public IP

dns=no
rev_dns=no

fifo="/tmp/openser_fifo"
fifo_db_url="mysql://openser:openserrw@localhost/openser"

loadmodule "/usr/local/lib/openser/modules/mysql.so"
loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/auth.so"
loadmodule "/usr/local/lib/openser/modules/auth_db.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/uri_db.so"
loadmodule "/usr/local/lib/openser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/openser/modules/nathelper.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/domain.so"
loadmodule "/usr/local/lib/openser/modules/acc.so"

modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "use_domain", 1)

modparam("domain", "db_mode", 1)

modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "natping_interval", 180)

modparam("mediaproxy","natping_interval", 30)
modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock")
modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/openser/sip-asymmetric-clients")
modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/openser/rtp-asymmetric-clients")

modparam("usrloc", "db_mode", 2)
modparam("usrloc", "use_domain", 1)

modparam("registrar", "default_expires", 60)
modparam("registrar", "min_expires", 30)
modparam("registrar", "nat_flag", 6)
modparam("registrar", "use_domain", 1)

modparam("rr", "enable_full_lr", 1)

modparam("acc", "db_url", "mysql://openser:openserrw@localhost/openser")
modparam("acc", "failed_transactions", 1)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "db_flag", 1)

route {

        # -----------------------------------------------------------------
        # Sanity Check Section
        # -----------------------------------------------------------------
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483", "Too Many Hops");
                break;
        };

        if (msg:len &gt; max_len) {
                sl_send_reply("513", "Message Overflow");
                break;
        };

        # -----------------------------------------------------------------
        # Record Route Section and Acc section
        # -----------------------------------------------------------------
        if (method=="INVITE" &amp;&amp; client_nat_test("3")) {
                record_route_preset("212.XXX.104.XXX:5060;nat=yes");
        } else if (method!="REGISTER") {        
        if!(uri=~"^sip:833[0-9]*@") {
                record_route(); 
                setflag(1);
                }
        };

        # -----------------------------------------------------------------
        # Call Tear Down Section
        # -----------------------------------------------------------------
        if (method=="BYE" || method=="CANCEL") {
                end_media_session();
        };

        # -----------------------------------------------------------------
        # Loose Route Section
        # -----------------------------------------------------------------
        if (loose_route()) {

                if (has_totag() &amp;&amp; (method=="INVITE" || method=="ACK")) {

                        if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
                                setflag(6);
                                use_media_proxy();
                        };
                };

                route(1);
                break;
        };

        # -----------------------------------------------------------------
        # Call Type Processing Section
        # -----------------------------------------------------------------

        if (uri!=myself) {
                route(1);
                break;
        };

        if (uri==myself) {

                if (method=="CANCEL") {
                        route(3);
                        break;
                } else if (method=="INVITE") {
                        route(3);
                        break;
                } else  if (method=="REGISTER") {
                        route(2);
                        break;
                };

                lookup("aliases");
                if (uri!=myself) {
                        route(1);
                        break;
                };

                if (!lookup("location")) {
                        sl_send_reply("404", "User Not Found");
                        break;
                };
        };

        route(1);
}

route[1] {

        # -----------------------------------------------------------------
        # Default Message Handler
        # -----------------------------------------------------------------

        t_on_reply("1");

        if (!t_relay()) {

                if (method=="INVITE" || method=="ACK") {
                        end_media_session();
                };

                sl_reply_error();
        };
}

route[2] {

        # -----------------------------------------------------------------
        # REGISTER Message Handler
        # ----------------------------------------------------------------

        if (!search("^Contact:\ +\*") &amp;&amp; client_nat_test("7")) {
                setflag(6);
                fix_nated_register();
                force_rport();
        };

        sl_send_reply("100", "Trying");        

        if (!www_authorize("","subscriber")) {
                www_challenge("","0");
                break;
        };

        if (!check_to()) {
                sl_send_reply("401", "Unauthorized");
                break;
        };

        consume_credentials();

        if (!save("location")) {
                sl_reply_error();
        };
}

route[3] {

        # -----------------------------------------------------------------
        # CANCEL and INVITE Message Handler
        # -----------------------------------------------------------------

        if (client_nat_test("3")) {
                setflag(7);
                force_rport();
                fix_nated_contact();
        };

        lookup("aliases");
        if (uri!=myself) {
                route(1);
                break;
        };

        if (uri=~"^sip:0[0-9]*@*") {
                 rewritehost("195.XXX.122.XXX");&nbsp;&nbsp;&nbsp; # PSTN Gateway on Public IP
             route(1);
             break;
        };

        if (!lookup("location")) {
                sl_send_reply("404", "User Not Found");
                break;
        };

        if (method=="CANCEL") {
                route(1);
                break;
        };

        if (!proxy_authorize("","subscriber")) {
                proxy_challenge("","0");
                break;
        } else if (!check_from()) {
                sl_send_reply("403", "Use From=ID");
                break;
        };

        consume_credentials();

        if (isflagset(6) || isflagset(7)) {
                use_media_proxy();
        };

        route(1);
}

onreply_route[1] {

        if ((isflagset(6) || isflagset(7)) &amp;&amp; (status=~"(180)|(183)|2[0-9][0-9]")) {

                if (!search("^Content-Length:\ +0")) {
                        use_media_proxy();
                };
        };

        if (client_nat_test("1")) {
                fix_nated_contact();
        };
}</PRE></DIV></BODY></HTML>