[SR-Users] ACC CDR accounting

Oleg Podguyko podguiko at mail.ru
Thu Jul 21 18:01:07 CEST 2022


H! Henning!
 
First of all I want to say thank you for your support!
 
I have achieved my goal. CDR work with DBtext! Unfortunately, the documentation is not very clear all this is described.
Some people have already experienced this problem. And already asked to add this to the documentation.
 
For example:
https://www.mail-archive.com/sr-users@lists.kamailio.org/msg13617.html
 
I will show the config, in which the CDR is formed in syslog using DBtext database:
 
#!define FLAG_FOR_DIALOG 6
 
loadmodule "dialog.so"
loadmodule "acc.so"
 
modparam("dialog", "dlg_flag", FLAG_FOR_DIALOG)
 
modparam("acc", "report_cancels", 1)
modparam("acc", "reason_from_hf", 1)
modparam("acc", "detect_direction", 0)
modparam("acc", "cdr_enable", 1)
modparam("acc", "cdr_expired_dlg_enable", 1)
modparam("acc", "cdr_start_on_confirmed", 1)
modparam("acc", "cdr_on_failed", 1)
modparam("acc", "cdr_log_enable", 1)
modparam("acc", "cdr_facility", "LOG_LOCAL1")
modparam("acc", "cdr_extra", "ci=$dlg_var(ci);ip_src=$si;ip_dst=$dlg_var(ip_dst);sip_from=$fU;sip_to=$tU;ruri_user=$rU;ip_sdp=$dlg_var(ip_sdp);codecs=$dlg_var(codecs);tkg=$dlg_var(tkg);hangup_party=$dlg_var(hangup_party);hangup_reason_Q_850=$dlg_var(hangup_reason_Q_850);hangup_reason_sip=$dlg_var(hangup_reason_sip);spx_exec_time_us=$dlg_var(spx_exec_time);spx_rs=$dlg_var(spx_http_rs);spx_rb=$dlg_var(spx_http_rb)") ## 
 
 
request_route {
    route(SANITY_CHECK);
 
    route(HANDLE_OPTIONS_COMMON);
 
    xlog("L_INFO", "request_route|Start $rm|\n");
 
#!ifdef HEP_TRACE_ENABLED
    route(TRACE);
#!endif
 
    route(CLASSIFY_DIRECTION);
 
    route(HANDLE_CANCEL);
 
    route(CHECK_RETRANS);
 
    t_check_trans(); ## handle ACKs to negative replies
 
    route(HANDLE_IN_DIALOG_REQUESTS);
 
    if (is_method("INVITE")) {
                 
        ## Accounting start   
        setflag(FLAG_FOR_DIALOG);
        ## Accounting end
     }
 
 
}
 
Only one flag is enough for CDRs to appear. And this flag is not from the ACC module!))
If anyone on the kamailio team is reading this email, please add it to the documentation.
 
Cheers,
 
Oleg Podguyko.
 
 
>Среда, 20 июля 2022, 10:19 +03:00 от Henning Westerholt < hw at gilawa.com >:
> 
>Hello,
> 
>The dbtext DB API is really limited and its mostly suited for read-only usage.
> 
>If you want to write ACC records to a DB, consider MySQL. There is also a db_flatstore module which you could look into, but I am not sure if its works with the newer CDR mode.
> 
>Cheers,
> 
>Henning
> 
>From: sr-users < sr-users-bounces at lists.kamailio.org >  On Behalf Of  Oleg Podguyko
>Sent: Wednesday, July 20, 2022 12:01 AM
>To: miconda at gmail.com
>Cc: Kamailio (SER) - Users Mailing List < sr-users at lists.kamailio.org >
>Subject: Re: [SR-Users] ACC CDR accounting
> 
>Hello Daniel!
>I’m using dbtext DB. If I set this
> 
>modparam("acc", "cdrs_table", "acc_cdrs")
>I got next errors:
> 
> 
>Does this mean that kamailio can't generate CDRs if I use DBtext DB?
> 
> 
>>Понедельник, 13 июня 2022, 18:10 +03:00 от Daniel-Constantin Mierla < miconda at gmail.com >:
>> 
>>Hello,
>>is the cdrs_table modparam set? I do not use this cdrs generation from acc myself, but seems to be required. Also, note that acc table will always get the event records, cdrs are in another table.
>>Cheers,
>>Daniel
>>On 13.06.22 12:22, Henning Westerholt wrote:
>>>Hello,
>>> 
>>>strange. Any error message or something odd in the log messages? I think you need to start to debug it, e.g. by increasing log level.
>>>Maybe somebody else can also share some hints.
>>> 
>>>Cheers,
>>> 
>>>Henning
>>> 
>>>-- 
>>>Henning Westerholt –  https://skalatan.de/blog/
>>>Kamailio services –  https://gilawa.com
>>> 
>>>From: Oleg Podguyko  <podguiko at mail.ru>
>>>Sent: Saturday, June 11, 2022 3:16 PM
>>>To: Henning Westerholt  <hw at gilawa.com>
>>>Cc: Kamailio (SER) - Users Mailing List  <sr-users at lists.kamailio.org>
>>>Subject: Re[2]: [SR-Users] ACC CDR accounting
>>> 
>>>Yes, I tried to use next lines:
>>> 
>>>    if (is_method("INVITE")) {
>>>              
>>> 
>>>        setflag(FLAG_ACC_LOG);
>>>         dlg_manage();
>>>        setflag(FLAG_ACC_LOG_MISSED);
>>>        setflag(FLAG_ACC_LOG_FAILED);
>>> 
>>>}
>>> 
>>> 
>>>and still got only INVITE transaction
>>> 
>>>>Суббота, 11 июня 2022, 15:15 +03:00 от Henning Westerholt < hw at gilawa.com >:
>>>> 
>>>>Hello,
>>>> 
>>>>do you also engage the dialog module on the initial INVITE, e.g. with dlg_manage()?
>>>> 
>>>>Cheers,
>>>> 
>>>>Henning
>>>> 
>>>>-- 
>>>>Henning Westerholt –  https://skalatan.de/blog/
>>>>Kamailio services –  https://gilawa.com
>>>> 
>>>>From: sr-users < sr-users-bounces at lists.kamailio.org >  On Behalf Of  Oleg Podguyko
>>>>Sent: Saturday, June 11, 2022 11:27 AM
>>>>To: sr-users at lists.kamailio.org
>>>>Subject: [SR-Users] ACC CDR accounting
>>>> 
>>>>HI
>>>>I’m trying to get CDR function. I would like to have one CDR for whole call at the syslog.
>>>> 
>>>>I use:
>>>> 
>>>> 
>>>>……
>>>>loadmodule "db_text.so"
>>>>loadmodule "dialog.so"
>>>>loadmodule "acc.so"
>>>>……..
>>>> 
>>>># -----Dialog module -----
>>>>modparam("dialog", "db_mode", 0)
>>>> 
>>>> 
>>>># -----ACCounting module -----
>>>>modparam("acc", "early_media", 0)
>>>>modparam("acc", "report_cancels", 1)
>>>>modparam("acc", "log_facility", "LOG_LOCAL1")
>>>>modparam("acc", "detect_direction", 0)
>>>>modparam("acc", "log_level", ACC_LOG_LEVEL)
>>>>modparam("acc", "log_flag", FLAG_ACC_LOG)
>>>>modparam("acc", "log_missed_flag", FLAG_ACC_LOG_MISSED)
>>>>modparam("acc", "failed_transaction_flag", FLAG_ACC_LOG_FAILED)
>>>>modparam("acc", "log_extra", "ip_src=$si;ip_dst=$avp(ip_dst);sip_from=$fU;sip_to=$tU;ruri_user=$rU;spx_rs=$avp(spx_http_rs)") ## TODO
>>>>modparam("acc", "cdr_enable", 1)
>>>>modparam("acc", "cdr_enable_log", 1)
>>>>modparam("acc", "cdr_facility", "LOG_LOCAL1")
>>>> 
>>>> 
>>>> 
>>>>request_route {
>>>> 
>>>>    if (is_method("INVITE")) {
>>>>              
>>>> 
>>>>        setflag(FLAG_ACC_LOG);
>>>>        setflag(FLAG_ACC_LOG_MISSED);
>>>>        setflag(FLAG_ACC_LOG_FAILED);
>>>> 
>>>>}
>>>> 
>>>>At the kamailio.log I see only transaction for INVITE, but I wait for  some CDR  for all dialog. Whats wrong in my config? 
>>>>--
>>>> 
>>>> 
>>>>--
>>>>Олег Подгуйко
>>> 
>>> 
>>>--
>>>Олег Подгуйко
>>> 
>>> 
>>>__________________________________________________________
>>>Kamailio - Users Mailing List - Non Commercial Discussions
>>>  * sr-users at lists.kamailio.org
>>>Important: keep the mailing list in the recipients, do not reply only to the sender!
>>>Edit mailing list options or unsubscribe:
>>>  * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>-- 
>>Daniel-Constantin Mierla -- www.asipto.com
>>www.twitter.com/miconda -- www.linkedin.com/in/miconda
>>Kamailio Advanced Training - Online: June 20-23, 2022
>>  * https://www.asipto.com/sw/kamailio-advanced-training-online/
> 
> 
>--
>Олег Подгуйко
>  
 
 
--
Олег Подгуйко
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220721/15ca45f3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 26663 bytes
Desc: not available
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220721/15ca45f3/attachment.png>


More information about the sr-users mailing list