[SR-Users] Kamailio and CDR

Daniel-Constantin Mierla miconda at gmail.com
Fri Apr 5 14:53:05 CEST 2019


The time params for acc are related to writing the event-based
(transaction) accounting records -- the native mode for acc module (with
no dialog involved).

The cdrs are controlled by dialog module, call_start being stored in the
dialog structure and with that is also computed the call_end.

I haven't coded nor used dialog based cdrs, but probably one has to
write some c code to add an option about the format for the time values
there -- likely not something complex.

As I use (and wrote code for) the event-based accounting, I know about
that part of acc.

For comma separated values, db_flatstore module can write like that, but
each process will have its own output file.

Daniel

On 05.04.19 14:25, Yu Boot wrote:
> OK, to begin with, *time params of acc module do nothing with
> call_start  and call_end fields in resulting CDR, they're still in
> unixtime. :(
>
>
> 04.04.2019 14:29, Fred Posner пишет:
>> Hi,
>>
>> As Daniel said, you may want to look to the Dialog module here. You
>> can use an xlog statement, database call, api, or whatever you would
>> like to customize this for your needs.
>>
>> This list isn’t to do the work for you, but to steer you in the right
>> direction.
>>
>> It may be helpful to tell the list what you have tried...
>>
>> -- Fred
>> direct/sms +1 (224) 334-3733
>>
>>
>>> On Apr 4, 2019, at 02:20, Yu Boot <yu at yu-boot.ru> wrote:
>>>
>>> Anyone? I can't believe that nobody of Kami users don't have these
>>> problems with CDR.
>>>
>>>
>>> 03.04.2019 16:03, Yu Boot пишет:
>>>> You didn't catch my idea. Here's what Kami writes to syslog:
>>>>
>>>>
>>>>   NOTICE: acc [acc_cdr.c:352]: log_write_cdr():
>>>> start_time=1554295999.014; end_time=1554296092.164;
>>>> duration=93.150; src_user=4956885645; src_domain=65.181.181.218;
>>>> src_ip=65.181.181.218; dst_ouser=9956885645; dst_user=6004440;
>>>> dst_domain=181.188.186.32
>>>>
>>>>
>>>> 1. I want to get rid from junk in beginning of CDR string, and
>>>> ideally, remove params names.
>>>>
>>>> 2. I want end_time in human-readable format
>>>>
>>>> 3 and last little problem - I want call duration will be always
>>>> integer.
>>>>
>>>> Is anything of it attainable with Kami? These CDRs issues is a last
>>>> thing that keep me from using Kami instead of Yate as a SBC.
>>>>
>>>>
>>>> 03.04.2019 15:43, Daniel-Constantin Mierla пишет:
>>>>> You can direct the syslog messages printed by acc module by
>>>>> setting the
>>>>> parameter:
>>>>>
>>>>>     -
>>>>> https://www.kamailio.org/docs/modules/5.2.x/modules/acc.html#acc.p.log_facility
>>>>>
>>>>>
>>>>> to a specific value and then configure the syslog application to
>>>>> write
>>>>> the messages with that facility to a specific file. In this way
>>>>> you can
>>>>> get acc records in a dedicated file, not together with the rest of
>>>>> logs
>>>>> printed by kamailio. See also:
>>>>>
>>>>>     - https://www.kamailio.org/wiki/tutorials/3.2.x/syslog
>>>>>
>>>>> You can also look at acc_json, you can construct a way to push the
>>>>> acc
>>>>> records to your own backend where you can do whatever suits better
>>>>> for
>>>>> your needs.
>>>>>
>>>>> Cheers,
>>>>> Daniel
>>>>>
>>>>>> On 03.04.19 14:31, Yu Boot wrote:
>>>>>> Thanks for a reply
>>>>>>
>>>>>>
>>>>>> I need CDR easily "greppable", so it must be in regular text file.
>>>>>> Very easy to parse, generate stats, and again, it can be
>>>>>> "tail-f'ed".
>>>>>>
>>>>>> And I want time in human readable format.
>>>>>>
>>>>>> Now iI use acc/dialog, result is horrible syslog output which is 50%
>>>>>> meaningless syslog stuff.
>>>>>>
>>>>>>
>>>>>> Show me right way. Or "Kamailio-way" to get CDR.
>>>>>>
>>>>>>
>>>>>> 03.04.2019 15:01, Daniel-Constantin Mierla пишет:
>>>>>>> The dialog+acc can also write the cdrs to database, afaik. If
>>>>>>> documentation says different, maybe it was forgotten to be updated.
>>>>>>>
>>>>>>> Or you look for something different than using dialog+acc?
>>>>>>>
>>>>>>> Cheers,
>>>>>>> Daniel
>>>>>>>
>>>>>>>> On 03.04.19 13:27, Yu Boot wrote:
>>>>>>>> Is there any other way to retrieve CDRs from Kami other than
>>>>>>>> dialog/acc modules and writing CDRs to syslog only?
>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks.
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> 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
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> 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 World Conference - May 6-8, 2019 -- www.kamailioworld.com




More information about the sr-users mailing list