[Serusers] Missed BYE

Ryan Pagquil rpagquil at philonline.com
Fri Aug 19 08:10:59 CEST 2005


Guys,

          I'm accounting INVITE and BYE but what I get is INVITE and ACK 
only, BYE doesn't get in my database. I ngrep 5060 and I saw BYE on the 
request but it doesn't get accounted. Please Help!

This is my ser.cfg...

debug=3
fork=yes
log_stderror=no

listen=202.84.24.107
port=5060
children=4

dns=no
rev_dns=no

fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"

#load module part

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

#module parameter setup

modparam("usrloc", "db_mode", 0)
modparam("rr", "enable_full_lr", 1)
modparam("auth_db|uri_db|usrloc", "db_url", 
"mysql://ser:heslo@localhost/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("usrloc", "db_mode", 2)

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

modparam("mediaproxy", "natping_interval", 30)
modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock")
modparam("mediaproxy", "sip_asymmetrics", "/usr/local/etc/ser/sip-clients")
modparam("mediaproxy", "rtp_asymmetrics", "/usr/local/etc/ser/rtp-clients")
modparam("registrar", "nat_flag", 6)

modparam("acc", "log_level", 1)
modparam("acc", "log_fmt", "cdfimorstup")
modparam("acc", "report_ack", 1)
modparam("acc", "failed_transactions", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 3)
modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser")

#our routing logic

route {

        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483", "Too many hops");
                break;
        };

        if (msg:len > max_len) {
                sl_send_reply("513", "Message overflow");
                break;
        };



###record route####

        if (method=="INVITE" && client_nat_test("3")) {
                record_route_preset("202.84.24.107:5060;nat=yes");
        } else if (method!="REGISTER") {
                record_route();
        };

###call tear down section###
        if (method=="BYE" || method=="CANCEL") {
                end_media_session();
        };


###loose route###

        if (loose_route()) {

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

                route(1);
                break;
        };

###call type processing###

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

        if (uri==myself) {

                if (method=="INVITE" || method=="ACK" || method=="BYE") 
record_route();
                setflag(1);

                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);
}

##Default message handler##
route[1] {

        t_on_reply("1");

        if (!t_relay()) {

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

                sl_reply_error();
        };
}

##Register message handler##
route[2] {

        sl_send_reply("100", "Trying");

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

        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();
        };
}

##INVITE message Handler##
route[3]
        {

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


        lookup("aliases");
        if (uri!=myself) {
                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", "User From=ID");
                break;
        };

        consume_credentials();

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

        route(1);
}

onreply_route[1] {

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

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

        if (client_nat_test("1")) {
                fix_nated_contact();
        };

}

Please correct me if any wrong configuration in my config.

Thanks,

-- 
Ryan Pagquil
Infodyne Inc. - PhilOnline.com
3603 Antel Global Corporate Center
Doña Julia Vargas Ave.
Ortigas Center Pasig City
Tel: 687-0715
Web: www.philonline.com




More information about the sr-users mailing list