[asterisk-commits] tilghman: trunk r91617 - /trunk/main/cdr.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Dec 6 17:27:47 CST 2007
Author: tilghman
Date: Thu Dec 6 17:27:46 2007
New Revision: 91617
URL: http://svn.digium.com/view/asterisk?view=rev&rev=91617
Log:
If duration or billsec are not yet calculated, calculate them on demand.
Modified:
trunk/main/cdr.c
Modified: trunk/main/cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/main/cdr.c?view=diff&rev=91617&r1=91616&r2=91617
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Thu Dec 6 17:27:46 2007
@@ -249,9 +249,9 @@
else if (!strcasecmp(name, "end"))
cdr_get_tv(cdr->end, raw ? NULL : fmt, workspace, workspacelen);
else if (!strcasecmp(name, "duration"))
- snprintf(workspace, workspacelen, "%ld", cdr->duration);
+ snprintf(workspace, workspacelen, "%ld", cdr->duration ? cdr->duration : (long)ast_tvdiff_ms(ast_tvnow(), cdr->start) / 1000);
else if (!strcasecmp(name, "billsec"))
- snprintf(workspace, workspacelen, "%ld", cdr->billsec);
+ snprintf(workspace, workspacelen, "%ld", cdr->billsec || cdr->answer.tv_sec == 0 ? cdr->billsec : (long)ast_tvdiff_ms(ast_tvnow(), cdr->answer) / 1000);
else if (!strcasecmp(name, "disposition")) {
if (raw) {
snprintf(workspace, workspacelen, "%ld", cdr->disposition);
More information about the asterisk-commits
mailing list