[OpenSIPS-Users] Accounting Problem

Dilip dilip.m at renovau.com
Thu Nov 20 13:46:36 CET 2008


Hello Everybody,
I am using freeradius+Openser for the accounting purpose.
I explain using example.
1) This  is working perfectly.
                     A    ===call to=>   B 
                   Accounting is starting
             When A hangup the call then Accounting is stop and it makes 
the Entry in the db.
                Accounting  stop message is generated and total session 
time is calculated.
2) This scenario is not working.

                     A    ===call to=>   B 
                   Accounting is starting .
             When B hangup the call then Accounting is not happening and 
didnt get any msg at radius server side.
             So that the TotalSession time is becomes zero.


For that i have  attached my openser.cfg   here.



#openser version 1.1
# ----------- global configuration parameters ------------------------

debug=9          # debug level (cmd line: -dddddddddd
fork=yes
log_stderror=yes  # (cmd line: -E)
#log_facility=LOG_LOCAL5
check_via=no    # (cmd. line: -v)
dns=no          # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)

#listen=0.0.0.0
listen=udp:192.168.1.1
port=3300
children=8
#fifo="/tmp/openser_fifo"

#unix_sock_children=2

# ------------------ module loading ----------------------------------
mpath="/usr/local/lib/openser/modules"

loadmodule "mysql.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "xlog.so"
loadmodule "uri.so"
loadmodule "acc.so"
loadmodule "auth.so"
loadmodule "auth_radius.so"
loadmodule "dispatcher.so"
loadmodule "nathelper.so"
loadmodule "enum.so"
#loadmodule "mediaproxy.so"
#loadmodule "uri_db.so"
# ----------------- setting module-specific parameters ---------------
#------------------ registrar testing---------------------------------
modparam("registrar", "default_expires", 2250000)

#------------------Dialog Module--------------------------------------

# -- usrloc params --
modparam("dispatcher", "list_file", 
"/usr/local/etc/openser/dispatcher.list")
modparam("usrloc","db_url","mysql://openser:openserrw@localhost/openser")
modparam("usrloc","db_mode", 3)
modparam("usrloc", "timer_interval", 30)
#modparam("usrloc", "expires_column", "225000")
#modparam("usrloc", "cseq_delay", 60)
#modparam("usrloc", "timer_interval", 30)
#modparam("usrloc","desc_time_order", 1)
#modparam("usrloc", "matching_mode", 1)
#modparam("registrar", "desc_time_order", 1)
modparam("usrloc", "desc_time_order", 0)    
#modparam("registrar", "max_contacts", 1)

# -- acc params --

#################################################################################
#modparam("acc", "failed_transaction_flag", 1)
#modparam("acc", "report_cancels",     0)
#modparam("acc", "report_ack",         0)
#modparam("acc", "early_media",        0)

#modparam("acc", "log_level",          1)
modparam("acc", "log_flag",           1)
modparam("acc", "log_missed_flag",    2)

modparam("acc", "service_type", 15)
modparam("acc|auth_radius", 
"radius_config","/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "radius_flag",        1)
modparam("acc", "radius_missed_flag", 1)

modparam("acc", "radius_extra", "
                                       Called-Station-Id=$tu;
                                       Calling-Station-Id=$fu;
                                       Canonical-URI=$tu;
                                        User-Name=$au;
                                        Sip-User-Realm=$ar;
                                      Source-IP=$si;
                                        Source-Port=$sp;
                                      From-Header=$hdr(from);
                                        User-Agent=$hdr(user-agent);
                                        Contact=$hdr(contact);
                                        ENUM-TLD=$avp(s:enum_tld);
                                        Event=$hdr(event)")



# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
#modparam("nathelper", "rtpproxy_disable_tout", 1)

#modparam("nathelper", "received_avp", "$avp(i:42)")

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

# main routing logic

route{
        xdbg("\n\n---- Start -----\n\n");
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        };

        if (msg:len >=  2048 ) {
                sl_send_reply("513", "Message too big");
                exit;
        };
   
        if (!method=="REGISTER"){
                record_route();
        };

        xdbg("\n\n---- Before Loose route  ----\n\n");
        if (loose_route()){
                xdbg("\n\n---- Loose route  ----\n\n");
                xdbg("\n\n-------- Stop Accounting   --------\n\n");
                setflag(1);     #Stop accounting
                route(1);
                exit;
        };

        if ((src_ip==192.168.1.5) ) {

                xdbg("\n\n---- From sip proxy server urmi -----\n\n");
                route(2);
                exit;
        };


        if (method=="REGISTER"){
                xdbg("\n\n---- Register  ----\n\n");
                route(3);
                exit;
        };
        if (method=="INVITE")
        {
                xdbg("\n\n---- Invite  ----\n\n");
                xdbg("\n\n-------- Start Accounting   --------\n\n");

                if (nat_uac_test("19"))
                {
                        xdbg("\n\n-------- Nated  --------\n\n");
                        fix_nated_contact();
                        force_rport();
                };

                xdbg("\n\n---- Invite  INSIDE.............----\n\n");

                if (!radius_www_authorize(""))
                {
                        xdbg("\n\n---- Inside RADIUS  ----\n\n");
                        www_challenge("", "0");
                        exit;
                };

                acc_rad_request("Start");

                xdbg("\n\n---- AFTER RADIUS  ----\n\n");


        };

#       exit;



        ds_select_dst("1", "0");
        forward();
        exit;
}

# generic forward
route[1]
{
        if (!t_relay()) {
            sl_reply_error();
        };
}

route[2]
{
        if (lookup("location"))
        {
                route(1);
        }else{
                sl_send_reply("404", "Not Found");
          xdbg("\n\n-------- To sip proxy ---urmi  --------\n\n");
          ds_select_dst("3", "0");
          forward();

        };
}

#Register
route[3]
{
        if (nat_uac_test("18"))
        {
                xdbg("\n\n-------- Nated  --------\n\n");
                fix_nated_register();
                force_rport();
        };

        if (!radius_www_authorize(""))
        {
        xdbg("\n\n--- Inside Route 3  ----\n\n");
                www_challenge("", "0");
                exit;
        };

        save("location");
}

Is there anything is missing please help me.


Regards,
Dilip Modi

               





More information about the Users mailing list