[SR-Users] ACC module

Voip support voipexpert0 at gmail.com
Thu Feb 13 11:08:43 CET 2020


Is it correct to set 2 flags in this place :

 # account only INVITEs
if (is_method("INVITE")) {
setflag(FLT_ACCMISSED); # do accounting even if failed << ME I ADD IT
setflag(FLT_ACC); # do accounting
route(LIMIT_CALLS);
dlg_manage();
sip_trace();
}

Each call of setflag do an entry in database?
Only one flag FLT_ACC FLT_ACCMISSED should be set for one dialog? When i do
twice FLT_ACC i can have duplicate records?

śr., 12 lut 2020 o 23:13 Julien Chavanton <jchavanton at gmail.com> napisał(a):

> Just to clarify my input,
>
> I am not personally using the exact accounting setup.
> I know that the modules using the ACC module API are all benefiting from
> the flag checks in the ACC module, but I am not 100% sure about this one
> for example. (since it is directly in the ACC module is could potentially
> behave differently)
>
> modparam("acc", "log_missed_flag", 12)
>
> However, I am assuming they also behave as expected, I would suggest to
> double check your flags interaction (by using logs) and definitions, once
> you are sure we may consider that there could be a bug.
>
>
> On Wed, Feb 12, 2020 at 2:01 PM Julien Chavanton <jchavanton at gmail.com>
> wrote:
>
>> 5.3 yes the patch I had in mine is in.
>>
>> It seems like what you are doing is fine.
>> We do not see the definition of your FLAGS in you example I am assuming
>> they are not overlapping another flag "bit" that could be used by another
>> module etc.
>> There could be a concern that the same flag as multiple purpose and
>> alias/definition.
>>
>> By reset I meant calling setflag multiple times :
>>
>> modparam("acc", "log_missed_flag", 12)
>> ...
>> setflag(12)
>>
>>
>> On Wed, Feb 12, 2020 at 1:07 PM Voip support <voipexpert0 at gmail.com>
>> wrote:
>>
>>> I have this code in very beginning of Request route of kamailio.cfg
>>>
>>>         # handle retransmissions
>>>         if (!is_method("ACK")) {
>>>                 if(t_precheck_trans()) {
>>>                         t_check_trans();
>>>                         exit;
>>>                 }
>>>                 t_check_trans();
>>>         }
>>>
>>> I think its left from the default config - i changed only few things in
>>> default config to add calls per second limit / dispatcher some routing
>>> logic but nothing more and set the flags for ACC module to save.
>>>
>>> śr., 12 lut 2020 o 22:03 Voip support <voipexpert0 at gmail.com>
>>> napisał(a):
>>>
>>>> I am using kamailio 5.3 from debian (installed in ubuntu 16.04)
>>>> repository.
>>>>
>>>> Could you please explain bit more what flag to reset call-id you mean.
>>>> What does the code you pasted, where it should be in kamailio.cfg?
>>>>
>>>> Thanks upfront for explanation!
>>>> Regards,
>>>> Tom
>>>>
>>>> śr., 12 lut 2020 o 17:11 Julien Chavanton <jchavanton at gmail.com>
>>>> napisał(a):
>>>>
>>>>> The flag will prevent duplicates. Which version are you using, there
>>>>> was a patch a few months ago
>>>>>
>>>>>
>>>>> The explanation shold be that you are resetting them.
>>>>>
>>>>> Are you using the following, one option to confirm that your logic is
>>>>> good is add one log line at INFO / NOTICE level logging each time you reset
>>>>> the flag including the call-id :
>>>>>
>>>>> if (t_precheck_trans()) {
>>>>>         t_check_trans();
>>>>>         exit;
>>>>> }
>>>>>
>>>>>
>>>>> On Wed, Feb 12, 2020 at 4:13 AM Voip support <voipexpert0 at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Dear Community,
>>>>>> I have setup ACCDB module to save missed / failed and
>>>>>> successful calls.
>>>>>>
>>>>>> My issue is that i am getting duplicated entries for INVITE / BYE in
>>>>>> acc database table.
>>>>>>
>>>>>> For example:
>>>>>>
>>>>>> id;method;from_tag;to_tag;callid;sip_code;sip_reason;time;src_ip;dst_user;dst_domain;src_user;src_domain;cdr_id
>>>>>> 231838;INVITE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN at 172.16.0.35;200;OK;2020-02-11
>>>>>> 19:16:28;22.33.44.55;nlb124#78019989897056;11.11.11.11;asterisk;172.16.0.35;0
>>>>>> 231839;INVITE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN at 172.16.0.35;200;OK;2020-02-11
>>>>>> 19:16:28;22.33.44.55;nlb124#78019989897056;11.11.11.11;asterisk;172.16.0.35;0
>>>>>> 231840;INVITE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN at 172.16.0.35;200;OK;2020-02-11
>>>>>> 19:16:28;22.33.44.55;nlb124#78019989897056;11.11.11.11;asterisk;172.16.0.35;0
>>>>>> 231841;BYE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN at 172.16.0.35;200;OK;2020-02-11
>>>>>> 19:16:36;22.33.44.55;;190.196.153.130;asterisk;172.16.0.35;0
>>>>>> 231842;BYE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN at 172.16.0.35;200;OK;2020-02-11
>>>>>> 19:16:36;22.33.44.55;;190.196.153.130;asterisk;172.16.0.35;0
>>>>>> 231844;BYE;21-7FC1D85;1914472180948750;KKyIdaaJceAu7pzN at 172.16.0.35;200;OK;2020-02-11
>>>>>> 19:16:36;22.33.44.55;;190.196.153.130;asterisk;172.16.0.35;0
>>>>>>
>>>>>> Following way:
>>>>>> # ----- acc params -----
>>>>>> /* what special events should be accounted ? */
>>>>>> modparam("acc", "early_media", 0)
>>>>>> modparam("acc", "report_ack", 0)
>>>>>> modparam("acc", "report_cancels", 0)
>>>>>> /* 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", "log_flag", FLT_ACC)
>>>>>> modparam("acc", "log_missed_flag", FLT_ACCMISSED)
>>>>>> modparam("acc", "log_extra",
>>>>>>         "src_user=$fU;src_domain=$fd;src_ip=$si;"
>>>>>>         "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
>>>>>> modparam("acc", "failed_transaction_flag", FLT_ACCFAILED)
>>>>>> /* enhanced DB accounting */
>>>>>> #!ifdef WITH_ACCDB
>>>>>> modparam("acc", "db_flag", FLT_ACC)
>>>>>> modparam("acc", "db_missed_flag", FLT_ACCMISSED)
>>>>>> modparam("acc", "db_url", DBURL)
>>>>>> #modparam("acc", "db_extra",
>>>>>> #       "src_user=$fU;src_domain=$fd;src_ip=$si;"
>>>>>> #       "dst_ouser=$tU;dst_user=$rU;dst_domain=$rd")
>>>>>> modparam("acc", "db_extra",
>>>>>>
>>>>>> "src_user=$fU;src_domain=$fd;dst_user=$rU;dst_domain=$rd;src_ip=$si")
>>>>>>
>>>>>> #  our lines
>>>>>> modparam("acc", "cdrs_table", "acc_cdrs")
>>>>>> modparam("acc", "cdr_on_failed", 1)
>>>>>> #!endif
>>>>>>
>>>>>> Then in routing config i set setflag(FLT_ACC FLT_ACCMISSED
>>>>>> FLT_ACCFAILED in several places.
>>>>>>
>>>>>> My question is - each setflag cause an entry to be saved in DB?
>>>>>> How can i debug and resolve the issue of duplicates.
>>>>>>
>>>>>> I am trying to use a CDR script found somewhere on siremis sites to
>>>>>> do the accounting but it's making trouble because due to duplicates in acc
>>>>>> table i am getting cdrs unique key violations.
>>>>>>
>>>>>> Secondary question is - if a BYE is not received / lost is there any
>>>>>> way to send a check triggered by kamailio to each caller and callee side to
>>>>>> check if dialog is still active.
>>>>>> I would not like to use session timers (as endpoints need to support
>>>>>> it).
>>>>>>
>>>>>> Best regards,
>>>>>> Tom
>>>>>>
>>>>>> _______________________________________________
>>>>>> Kamailio (SER) - Users Mailing List
>>>>>> sr-users at lists.kamailio.org
>>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>>
>>>>> _______________________________________________
>>>>> Kamailio (SER) - Users Mailing List
>>>>> sr-users at lists.kamailio.org
>>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>>
>>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing List
>>> sr-users at lists.kamailio.org
>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20200213/c32217dd/attachment.html>


More information about the sr-users mailing list