[SR-Users] call not being accounted when rejected by global blacklist

Panagiotis Skoulikaritis pskoul at algonet.gr
Thu Apr 15 15:54:22 CEST 2010


Dear list members

I'm using kamailio 3
and the problem that I'm facing is that when a call is rejected by 
global blacklist, kamailio does not generate an accounting record.
Is this normal behavior or I need to configure something somewhere ?


Below are parts of the config file


# ----- acc params -----
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "detect_direction", 0)
modparam("acc", "failed_transaction_flag", 3)
#!ifdef WITH_ACCDB
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)
modparam("acc", "db_url",
        "mysql://username:password@localhost/openser")
modparam("acc", "db_extra",
        
"src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
#!endif


----------------------
 if (has_totag()) {
                # sequential request withing a dialog should
                # take the path determined by record-routing
                if (loose_route()) {
                        if (is_method("BYE")) {
                                setflag(1); # do accounting ...
                                setflag(3); # ... even if the 
transaction fails
                        }

-------------------------
if (is_method("INVITE")) {
                setflag(1); # do accounting
                setflag(2); # log missed calls
                setflag(3); # log failed calls
                setflag(4); # do siptrace
                setflag(5); # log dialog

-------------
route[name] {

# --- Remove # or %23 from rU ---
        bm_start_timer("hash_remove");
        if($rU =~ "^.*%+")     
        {              
                xlog("------- The number contains %23 ---- ");
                $rU = $(rU{re.subst,/^(.*)%23(.*)/\1\2/});
                xlog(" ------- The perl  $rU ------- ");
        }  

        if($rU =~ "^.*#+")     
        {              
                xlog("------- The number contains # ----");
                $rU = $(rU{re.subst,/^(.*)#(.*)/\1\2/});
                xlog("------- The perl  $rU ------- ");
        }  
        bm_log_timer("hash_remove");
        # --- PDT section ------ get service prefix to be appended 
before is send  out
        bm_start_timer("pdt_lookup");
        if(!prefix2domain("2", "0"))
        {
                sl_send_reply("404", "Prefix not found");
                exit;
        }
        $var(dstgrp) = 0;
        $var(dstgrp) = $(rd{s.int});
        if($var(dstgrp)==0)
        {
                sl_send_reply("404", "Service not found");
                exit;
        }
        $avp(s:service_prefix) = $var(dstgrp);
        xlog("--$rU----------- $avp(s:service_prefix) --- PDT ---------\n");

        bm_log_timer("pdt_lookup");

        # --- DialPlan section --- get the routing group id

        xlog("----- The rU is $rU before DP -----\n");
        bm_start_timer("dialplan_lookup");
        if(dp_translate("1", "$rU/$rU"))
        {
                $avp(s:dstgrp) = $(var(dpattrs){s.int});
                xlog("----- The destination Drouting GroupID is 
$avp(s:dstgrp)  -----\n ");
        }

        bm_log_timer("dialplan_lookup");
        xlog("----- The rU is $rU after DP -----\n");
       
        # --- Global Blacklist section ---
        bm_start_timer("blacklist_lookup");
       if(!check_blacklist("globalblacklist")){
                xlog("----- The number is blacklisted globaly! -----");
                sl_send_reply("403", "Forbidden");
                exit;
       }
        bm_log_timer("blacklist_lookup");
        # --- Dynamic routing section ---  route the call based on the 
routing group id
        bm_start_timer("drouting_lookup");
        if (!do_routing("$avp(s:dstgrp)")) {
         xlog("----- DRouting don't match dstgrp $avp(s:dstgrp) -----\n");

                sl_send_reply("404","Route Not Found -$rU-");
                exit;
        }
        bm_log_timer("drouting_lookup");
        xlog("-----DRouting with $rU and $avp(s:dstgrp) -and 
$avp(s:service_prefix)----\n");
        # Append service prefix in front of number
        $ru = "sip:" + $avp(s:service_prefix)  + $rU + "@" + $rd;

        xlog(" ------ $ru ----$rU- $avp(s:user)---\n");

        t_on_failure("FAIL_ONE");
        route(RELAY);
        exit;
        return;
}

Regards

Panagiotis








More information about the sr-users mailing list