Hello, I haven't used this event route and the flags, if they don't persist afterwards, then maybe it needs a patch to be fixed. Hugh implemented it, iirc, not sure if he was looking at this aspect.
Cheers, Daniel On 26/05/15 16:14, Andrew Pogrebennyk wrote: > Hi Daniel and others, > I'm having a problem with acc module if I'm using the event_route/ > branch-failure: > say, the call comes from the app server and goes to the registered user. > We arm the the failure route and per-branch failure route for the 302 > redirect from the UA. We explicitly reset the accounting flags because > we don't want to account the calls from the app server. The transaction > is created implicitly by the t_relay(). > > Now if the UA responds with the 302 response and we are going to process > that, we want to create an acc record for the new target from 302 > message because this call may incur additional costs. I'm setting the > accounting flags and calling t_flush_flags() but that doesn't work (no > accounting record). Any idea if I'm doing something wrong or maybe > there's a bug when changing the flags and then calling t_flush_flags > from the event_route? > > Here are the module parameters: > > modparam("acc", "early_media", 0) > modparam("acc", "report_ack", 0) > modparam("acc", "report_cancels", 1) > modparam("acc", "detect_direction", 1) > modparam("acc", "db_flag", 1) > modparam("acc", "db_missed_flag", 2) > modparam("acc", "failed_transaction_flag", 3) > modparam("acc", "db_url", PAIR_URL) > modparam("acc", "db_extra", > "src_user=$fU;src_domain=$fd;dst_ouser=$tU;dst_user=$rU;dst_domain=$rd") > modparam("acc", "multi_leg_info", "src_leg=$avp(i:901);dst_leg=$avp(i:902)") > modparam("acc", "time_mode", 2) > modparam("acc", "time_attr", "time_hires") > modparam("acc", "cdr_log_enable", 0) > > > FTR, we tried 4.1.6 and 4.1.8. > > And here is the event route (with flags defined like this: > flags FLAG_ACC_DB:1, FLAG_ACC_MISSED:2, FLAG_ACC_FAILED:3, ...): > > event_route[tm:branch-failure:redirect] > { > route(ROUTE_STOP_RTPPROXY_BRANCH); > if($T_rpl($rs) == 301 || $T_rpl($rs) == 302) > { > # initialise variables when entering failure route > route(ROUTE_INITVARS); > > # these need to be avps because we need it in reply/failure-route > $(avp(s:from_faxserver)[*]) = 0; > $(avp(s:to_faxserver)[*]) = 0; > $(avp(s:cf_from_pstn)[*]) = 0; > $(avp(s:from_pstn)[*]) = 0; > $(avp(s:proxylu_from_pstn)[*]) = 0; > $(avp(s:lcr_flags)[*]) = 0; > $(avp(s:em_call)[*]) = 0; > $(avp(s:from_pbx)[*]) = 0; > $(avp(s:p_to_device)[*]) = 0; > $(avp(s:p_to_group)[*]) = 0; > $(avp(s:is_primary)[*]) = 0; > > # now let's process a 30x > $(avp(s:acc_state)[*]) = "cfb"; > $(avp(s:orig_acc_caller_user)[*]) = $avp(s:acc_caller_user); > $(avp(s:orig_acc_caller_domain)[*]) = $avp(s:acc_caller_domain); > $(avp(s:acc_caller_user)[*]) = $avp(s:acc_callee_user); > $(avp(s:acc_caller_domain)[*]) = $avp(s:acc_callee_domain); > $(avp(s:caller_uuid)[*]) = $avp(s:callee_uuid); > $(avp(s:callee_uuid)[*]) = $null; > # the $var(no_acc) is 0 at this point but the flags may have > been reset > # if this is a call from PBX user - we do want accounting for > the 302 redirect > if(isflagset(FLAG_ACC_DB)) { > xlog("L_NOTICE", "++++++ ACC flag is set - [% logreq -%]\n"); > } else { > xlog("L_NOTICE", "------ ACC flag is NOT set - [% logreq > -%]\n"); > } > setflag(FLAG_ACC_FAILED); > setflag(FLAG_ACC_DB); > t_flush_flags(); > > # get last URI from destination-set and set it as R-URI > $var(contact) = $T_rpl($ct); > $var(contact) = $(var(contact){nameaddr.uri}); > if($var(contact) == 0 || $var(contact) == $null) > { > > xlog("L_ERROR", "Failed to fetch contact '$ct' from 301/302 > - [% logreq -%]\n"); > acc_db_request("480", "acc"); > $var(announce_handle) = "callee_tmp_unavailable"; > $var(announce_set) = $xavp(callee_real_prefs[0]=>sound_set); > $(avp(s:announce_code)[*]) = 480; > $(avp(s:announce_reason)[*]) = "Temporarily Unavailable"; > route(ROUTE_EARLY_REJECT); > } > $ru = $var(contact); > xlog("L_NOTICE", "Redirect from UAC intercepted - [% logreq -%]\n"); > $(avp(s:forwarder_cli_userprov)[*]) = $T_rpl($tU); > $(avp(s:forwarder_domain_userprov)[*]) = $T_rpl($td); > $var(forward) = 1; > $var(redirected_forward) = 1; > route(ROUTE_LOAD_CALLER_PREF); > route(ROUTE_FIND_CALLEE); > } > } > > Thanks. > > Andrew > > _______________________________________________ > SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list > sr-users@lists.sip-router.org > http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users -- Daniel-Constantin Mierla http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, May 27-29, 2015 Berlin, Germany - http://www.kamailioworld.com _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users