[asterisk-dev] [Code Review] Fix incorrect duration reporting in CDRs created in batch mode that use ast_cdr_getvar
Tilghman Lesher
reviewboard at asterisk.org
Thu Jun 21 12:02:57 CDT 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1996/#review6536
-----------------------------------------------------------
Ship it!
This looks like the right way to solve this problem.
/branches/1.8/main/cdr.c
<https://reviewboard.asterisk.org/r/1996/#comment12337>
You could, as an optimization, cut the comparison down to just checking whether cdr->end.tv_sec != 0, as is done below. Also, in all cases where cdr->end is zero, duration will always be zero. So the first check is superfluous.
- Tilghman
On June 21, 2012, 11:08 a.m., Matt Jordan wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1996/
> -----------------------------------------------------------
>
> (Updated June 21, 2012, 11:08 a.m.)
>
>
> Review request for Asterisk Developers, Mark Michelson and Tilghman Lesher.
>
>
> Summary
> -------
>
> Certain places in core/cdr.c would, if the duration value were 0, would calculate the duration as being the delta between the current time and the time at which the CDR record was started. While this does not typically cause a problem in non-batch mode, this can cause an issue in batch mode where CDR records are gathered and written long after those calls have ended. In particular, this affects calls that were never answered, as those are expected to have a duration of 0. Often, this would result in CDR logs with a significant number of calls with lengthy durations, but dispositions of "BUSY".
>
> Note that this does not affect CSV CDRs, as that backend does not use ast_cdr_getvar and instead directly reports the duration value. The affected core backends include cdr_apative_odbc and cdr_custom; other extended or deprecated CDR backends may potentially still directly manipulate the duration values.
>
> This patch essentially reverts r91617, when this behavior was introduced.
>
>
> This addresses bug ASTERISK-19860.
> https://issues.asterisk.org/jira/browse/ASTERISK-19860
>
>
> Diffs
> -----
>
> /branches/1.8/main/cdr.c 369001
>
> Diff: https://reviewboard.asterisk.org/r/1996/diff
>
>
> Testing
> -------
>
> Ran through the Asterisk Test Suite's CDR tests. A new test for batch CDR creation was also written that also tests that the disposition/billsec are 0 when they should be, and non-zero when the calls are answered.
>
>
> Thanks,
>
> Matt
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120621/ecf46451/attachment-0001.htm>
More information about the asterisk-dev
mailing list