Hi Daniel,

Adding setflag(2) in Failure Route everything works PERFECT! ;-)
All my failure attempts are added in the database, in table missed_calls.

Thank you very match
Alex



On Tue, Jan 26, 2010 at 12:00 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hi Alex,

ok, checked the sources and in fact seems that the missed calls events can be accounted on each serial fork step. Try to set missed calls flags for each failure step and see if you get records in missed_calls table.

Cheers,
Daniel


On 1/25/10 2:15 PM, alex pappas wrote:


 
Hi Daniel,

This is my ACC configuration:

# ----- acc params -----
/* what sepcial events should be accounted ? */
modparam("acc", "early_media", 1)
modparam("acc", "report_ack", 1)
modparam("acc", "report_cancels", 1)
/* by default ww do not adjust the direct of the sequential requests.
   if you enable this parameter, be sure the enable "append_fromtag"
   in "rr" module */
modparam("acc", "detect_direction", 0)
/* account triggers (flags) */
modparam("acc", "failed_transaction_flag", 3)
modparam("acc", "log_flag", 1)
modparam("acc", "log_missed_flag", 2)
modparam("acc", "log_extra",
       "src_user=$fU;src_domain=$fd;dst_to_user=$tU;dst_user=$rU;dst_domain=$rd;diversion_uri=$di;destination_uri=$du;display_name=$fn;orig_src_domain=$od;orig_req_uri=$ou;orig_username=$oU;prefered_identity=$pd;display_name_pref_ident=$pn;proxy_ip=$Ri;proxy_port=$Rp;src_ip=$si;dst_dom_uri=$td;user_agent=$ua")
/* uncomment the following lines to enable DB accounting also */
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 2)
modparam("acc", "db_url",
        "mysql://openser:openserrw@localhost/openser10")
modparam("acc", "db_extra",
        "src_user=$fU;src_domain=$fd;dst_to_user=$tU;dst_user=$rU;dst_domain=$rd;diversion_uri=$di;destination_uri=$du;display_name=$fn;orig_src_domain=$od;orig_req_uri=$ou;orig_username=$oU;prefered_identity=$pd;display_name_pref_ident=$pn;proxy_ip=$Ri;proxy_port=$Rp;src_ip=$si;dst_dom_uri=$td;user_agent=$ua")

I run kamailio-1.5.3 no TLS

What exactly is iirc?

When i call from an user to an other and the call is passing in case of failure from failure route1 then I get an extra cdr from the failure route1 BUT when I call pstn and the call goes to Failure route2 then I don't get the extra CDRs. One important diference between Failure route1 and 2 is that in the Failure route2 I have an extra  append_branch();

 Failure Route 1 (default)

failure_route[1] {
        xlog("alx ------- Failure Route 1 -------");
#n#     if (is_method("INVITE")
#n#                     && (isbflagset(6) || isflagset(5))) {
#n#             unforce_rtp_proxy();
#n#     }

        if (t_was_cancelled()) {
                exit;
        }

        # uncomment the following lines if you want to block client
        # redirect based on 3xx replies.
        ##if (t_check_status("3[0-9][0-9]")) {
        ##t_reply("404","Not found");
        ##      exit;
        ##}

        # uncomment the following lines if you want to redirect the failed
        # calls to a different new destination
        ##if (t_check_status("486|408")) {
        ##      sethostport("192.168.2.100:5060");
        ##      append_branch();
        ##      # do not set the missed call flag again
        ##      t_relay();
        ##}
}

Failure Route2


failure_route[2] {
 
  if(t_was_cancelled()) {
        exit;
  }

  if(t_check_status("4[0-9][0-9]|5[0-9][0-9]"))
  {

     #xlog("ACCOUNTING: src_user=$fU;src_domain=$fd;dst_to_user=$tU;dst_user=$rU;dst_domain=$rd;diversion_uri=$di;destination_uri=$du;display_name=$fn;orig_src_domain=$od;orig_req_uri=$ou;orig_username=$oU;prefered_identity=$pd;display_name_pref_ident=$pn;proxy_ip=$Ri;proxy_port=$Rp;src_ip=$si;dst_dom_uri=$td;user_agent=$ua;sip_replay_reson=$rr;sip_replay_status=$T_reply_code");
    
     if(ds_next_domain())
     {
          xlog("alx ------------------------------------- The final RU is $rU and the cust_prefix:$avp(s:cust_prefix) --------");
          xlog("alx ------- [ FAILURE ROUTE 2 ] First part of failure with rd = $rd and prefix = $(ru{uri.param,prefix}) ---");
            # more destinations from same dispatcher group

            # add prefix if set and remove the param from R-URI
            if($(ru{uri.param,prefix})!=null)
            {
                $ru = "sip:" + $avp(s:cust_prefix) + $(ru{uri.param,prefix}) + $avp(s:user) + "@" + $rd;
            } else {
                $ru = "sip:" + $avp(s:cust_prefix) + $avp(s:user) + "@" + $rd;
            }
            #rewriteport(5065);
            #setport("5065");
            t_on_failure("2");
            append_branch(); ##################################################################### This is different !!!!!!!!!!!!!!!!!!
            t_relay();
            exit;
     } else {
            # go to next dispatcher group
            xlog("alx ------- This is the next DST group = $avp(s:dstgrp) -------");
           
           
            if($avp(s:dstgrp)!=null)
            {
                 # select destination
                 if(ds_select_domain("$avp(s:dstgrp)", "4"))
                 {
                     xlog("alx ------- [ FAILURE ROUTE 2 ] Second part of failure with rd = $rd and prefix = $(ru{uri.param,prefix}) ---");
                     xlog("alx ------------------------------------- The final RU is $rU and the cust_prefix:$avp(s:cust_prefix) --------");
                     # add prefix if set and remove the param from R-URI
                     if($(ru{uri.param,prefix})!=null)
                     {
                         $ru = "sip:" + $avp(s:cust_prefix) + $(ru{uri.param,prefix}) + $avp(s:user) + "@" + $rd;
                     } else {
                         $ru = "sip:" + $avp(s:cust_prefix) + $avp(s:user) + "@" + $rd;
                     }
                     $avp(s:dstgrp) = null;
                     xlog("alx ------- This is the next DST group after NULL = $avp(s:dstgrp) -------");
                     xlog("alx ------- The final RURI is $ru ------- ");
                     t_on_failure("2");
                     append_branch();##################################################################### This is different !!!!!!!!!!!!!!!!!!
                     t_relay();
                     exit;
                }
         } else {
                t_reply("444", "No more tries for you!");
                }
    }
}



Thanks
Alex




On Mon, Jan 25, 2010 at 12:39 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hi Alex,


On 1/25/10 11:03 AM, alex pappas wrote:
Hi Daniel,

We make a call and the call tries from the Failure Route 5 times new gateway (with dispatcher) but  WITHOUT success in termination. In every try we get back 503 Congestion. In this case how many CDRs we should see in our LOG.
 
We have the modparam("acc", "failed_transaction_flag", 6) and we setflag(6) for every INVITE.
iirc, at some point was an option to get all failed legs accounted. I don't remember using it so I have to check the sources (you are on 1.5.x, right?).

For next version I plan to make acc functions available on rest of the routes, should be few updates to take sip method from cseq header and ignore r-uri if it is a reply processed, in failure route should work by default, I see no reasons now what could be the problem.

Cheers,
Daniel


On Fri, Jan 22, 2010 at 3:33 PM, Daniel-Constantin Mierla <miconda@gmail.com> wrote:
Hello,


On 1/22/10 1:08 PM, alex pappas wrote:
Dear Friends,

In case of a call failure I'm trying from failure route to send the call through other gateways with Dispatcher module.
I would like to have ACC for all failures that a call can possibly pass. If the call fails in the 3 first gateways  I want them also in my mysql ACC table. I tried that with AVPs in the syslog and it works fine BUT is there any way that I can simply setflag(1) for accounting and I can have ACC for every try?

I tryied to add  in failure route :

setflag(1); # do accounting ...
setflag(3); # ... even if the transaction fails

but I'm getting ACC only the last try.

last failed try? Or what you mean by "the last try"? IIRC, failed transaction flag should be set for each leg if you want all failures.

Cheers,
Daniel

--
Daniel-Constantin Mierla
* http://www.asipto.com/


_______________________________________________ Kamailio (OpenSER) - Users mailing list

-- 
Daniel-Constantin Mierla
* http://www.asipto.com/
      



-- 
Daniel-Constantin Mierla
* http://www.asipto.com/