[Serusers] Accounting Problem

Rommel Catabian rommel329 at yahoo.com
Fri Nov 11 05:25:49 CET 2005


Thanks for the immediate reply. We have this on the
file ser.cfg: 

  modparam("acc", "radius_flag", 2)
  setflag(2);   ---->>> could this be on the wrong
location?


To route traffic to PSTN, we have this on the ser
config:
-----
        if (uri=~"^sip:90087(.+)@.*") {
               
rewritehostport("XXX.XXX.XXX.XXX:5060");
                forward(uri:host, uri:port);
               
exec_msg('(/usr/local/etc/ser/logs.csh)');
        break;
------ 


Here is our ser.cfg file:
--------------------------

debug=3
fork=yes
log_stderror=yes
check_via=no
dns=no
rev_dns=no
port=5060
children=4
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://XXXX:XXXX@localhost/ser"

loadmodule "/usr/local/lib/ser/modules/mysql.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/textops.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/exec.so"

modparam("usrloc", "db_mode", 2) # 0 Disable
Authentication ; 2 Enable Authentication
modparam("usrloc", "db_url",
"mysql://XXXX:XXXX@localhost/ser")
modparam("auth_db", "db_url",
"mysql://XXXX:XXXX@localhost/ser")

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

modparam("registrar", "nat_flag", 6)
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)

modparam("acc",
"radius_config","/usr/local/etc/radiusclient-ng/radiusclient.conf")
modparam("acc", "service_type", 15)
modparam("acc", "radius_flag", 2)
modparam("acc", "radius_missed_flag", 3)
modparam("acc", "failed_transactions", 1)
modparam("acc", "report_ack", 0)

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 too
big");
                break;
        };

        if (nat_uac_test("3")) {
                if (method == "REGISTER" || !
search("^Record-Route:")) {
                        fix_nated_contact();
                        if (method == "INVITE") {
                                fix_nated_sdp("1");
                        };
                force_rport();
                setflag(6);
                };
        };

        lookup("aliases");

        if (!method=="REGISTER") record_route();

        if (loose_route()) {
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
                break;
        };

        setflag(2);
        setflag(5);

        if (method=="INVITE") {
               
exec_msg('(/usr/local/etc/ser/record.pl)');
        };

        if (!uri==myself) {
                append_hf("P-hint: outbound\r\n");
                route(1);
                break;
        };

        if (uri=~"^sip:90087(.+)@.*") {
               
rewritehostport("202.64.248.209:5060");
                forward(uri:host, uri:port);
               
exec_msg('(/usr/local/etc/ser/logs.csh)');
        break;
        };


#--------- IVR Start -----------

        if (uri=~"^sip:222 at .*") {
                if (!t_newtran()) {
                        log("could not create new
transaction\n");
                        sl_send_reply("500","could not
create new transaction");
                        break;
                };

                if (method=="ACK"){
                        t_relay();
                        break;
                };

                t_reply("100","Trying -- just wait a
minute !");

               
if(!t_write_unix("/tmp/am_sock","ivr")) {
                t_reply("500","error contacting
sems");
                };
        break;
        };

#--------- IVR End -----------

        if (uri==myself) {
                if (method=="REGISTER") {
                        if
(!www_authorize("sip.easy.net.ph","subscriber")) {
                               
www_challenge("sip.easy.net.ph", "0");
                                break;
                        };
                        save("location");
                        break;
                };

                if (method=="INVITE") {
                       
exec_msg('(/usr/local/etc/ser/record.pl)');
                };

                lookup("aliases");
                if (!uri==myself) {
                        append_hf("P-hint: outbound
alias\r\n");
                        route(1);
                        break;
                };

                if (!lookup("location")) {
                        sl_send_reply("404", "Not
Found");
                        break;
                };
        };
        append_hf("P-hint: usrloc applied\r\n");
        route(1);
}

route[1]
{
                if (method=="INVITE") {
                       
exec_msg('/usr/local/etc/ser/record.pl');
                };
                if (method=="CANCEL") {
                       
exec_msg('/usr/local/etc/ser/record.pl');
                };
                if (method=="BYE") {
                       
exec_msg('/usr/local/etc/ser/record.pl');
                };
                if (method=="ACK") {
                       
exec_msg('/usr/local/etc/ser/record.pl');
                };

        setflag(2);
        if
(uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)"
&& !search("^Route:")){
                sl_send_reply("479", "We don't forward
to private IP addresses");
                break;
        };

        if (isflagset(6)) {
                force_rtp_proxy();
        };

        t_on_reply("1");
        if (!t_relay()) {
                sl_reply_error();
        };
}

onreply_route[1] {
        if (isflagset(6) && status =~
"(183)|2[0-9][0-9]") {
                fix_nated_contact();
                force_rtp_proxy();
        } else if (nat_uac_test("1")) {
                fix_nated_contact();
        };
}


--- Matt Simpson <msimpson at commpartners.us> wrote:

> 
> >My question:
> >What triggers the SER to send START accounting
> request
> >to the RADIUS? 
> >
> >Thanks,
> >
> >Rommel
> 
> Rommel, there should be a statement at the top like:
> modparam("acc","radius_flag",1)
> 
> The "1" is the flag to account for a call in radius
> 
> Then you would use:
> setflag(1);
> 
> to account for the call.  It is hard to tell you
> where to put the
> statement without seeing your conf but that should
> help.
> 
> 



	
		
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com




More information about the sr-users mailing list