Hello,
reading back into this discussion, you want to round up duration in seconds if it is over .50 and round down if it is less .50, am I right?
I don't think there is an option for it in the modparams, but I expect that the tool that reads the cdrs from logs can be adjusted to do such rounding.
An alternative with kamailio scripting inside kamailio.cfg is to use a dialog variable where you compute the duration as you want and get it inside the cdr vai cdr_extra param for acc module. You should be able to compute the duration inside the event_route[dialog:end] block.
Cheers,
Daniel
Hello,
Can I have an update on this please.
Thanks,
From: Narayan P
Sent: Tuesday, March 20, 2018 6:49:37 AM
To: Henning Westerholt; sr-users@lists.kamailio.org
Subject: Re: [SR-Users] Issue in cdr generation in seconds formatHello Henning,
Thanks for replying.
I have already tried with time_mode = 1.I have used this like;
modparam("acc", "time_mode", 1) and alsomodparam("acc", "time_mode", 0) Can you please suggest any other settings that I need to do in kamailio. Thanks, Narayan
From: Henning Westerholt <hw@kamailio.org>
Sent: Monday, March 19, 2018 8:33:54 PM
To: sr-users@lists.kamailio.org
Cc: Narayan P
Subject: Re: [SR-Users] Issue in cdr generation in seconds formatAm Montag, 19. März 2018, 13:49:52 CET schrieb Narayan P:
> Any update on this please.
>
Hello Naryan,
have you tried with time_mode = 1?
6.45. time_mode (int)
Store additional value related to the time of event.
Values can be:
* 0 - (default), save only unix timestamp for syslog and datetime for
database.
* 1 - save seconds in time_attr and microseconds in time_exten.
Best regards,
Henning
> Hello Sir,
>
>
> I need your expertise for kamailio cdr generation in seconds format.
>
>
> I have a requirement to generate cdr duration in second format.Now I am
> getting second.milliseconds format.Below is the log where duration is
> 18.676 but I want this to be 19.(suppose where duration =18.234, I need it
> to be 18).
>
>
> Mar 16 10:38:22 vm11-kamailio /usr/local/sbin/kamailio[20787]: NOTICE: acc
> [acc_cdr.c:352]: log_write_cdr(): start_time=1521196683.464;
> end_time=1521196702.140; duration=18.676; src_user=71097345;
> src_domain=185.122.XXX.XXX; src_ip=185.122.XXX.XXX; dst_user=;
> dst_ouser=91786042XXXX; dst_domain=185.122.XXX.XXX; sip_code=; sip_reason=;
> callid=LVHyTCFWYBpEFp.sFpY204aBdx.nez9B; dst_ip=185.122.XXX.XXX
>
>
>
> My kamailio configuration related to cdr is like this;
>
> /* what special events should be accounted ? */
> modparam("acc", "db_url", "flatstore:/var/log/cdr.log")
> #modparam("acc", "cdr_extra", "c1=$dlg_var(caller);c2=$dlg_var(callee)")
> modparam("acc", "log_facility", "LOG_DAEMON")
> modparam("acc", "cdr_enable", 1)
> modparam("acc", "cdr_start_on_confirmed", 1)
> modparam("acc", "cdr_log_enable", 1)
> modparam("acc", "time_mode", 0)
> modparam("acc", "time_attr", "seconds")
> modparam("acc", "cdr_start_id", "start_time")
> modparam("acc", "cdr_end_id", "end_time")
> modparam("acc", "cdr_duration_id", "duration")
> #modparam("acc", "cdr_flag", 3)
> #modparam("acc", "early_media", 0)
> #modparam("acc", "report_ack", 0)
> #modparam("acc", "report_cancels", 0)
> #modparam("dialog", "enable_stats", 1)
> modparam("dialog", "hash_size", 1024)
> modparam("dialog", "dlg_flag", 3)
> modparam("dialog", "db_url", DBURL)
>
> /* 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_user=$tU;dst_user=$rU;dst_domain=$rd")
> modparam("acc",
>
> "cdr_extra","src_user=$fU;src_domain=$fd;src_ip=$si;dst_user=$rU;dst_ouser=
> $tU;dst_domain=$rd;sip_code=$rs;sip_reason=$rr;callid=$dlg(callid);dst_ip=$R
> i")
>
> Please suggest me what to configure more in kamailio to achieve cdr in
> second format.
>
> Thanks,
> Narayan
_______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com