[asterisk-commits] trunk r13132 - /trunk/cdr.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 15 14:59:12 MST 2006


Author: russell
Date: Wed Mar 15 15:59:08 2006
New Revision: 13132

URL: http://svn.digium.com/view/asterisk?rev=13132&view=rev
Log:
don't calculate a duration if the CDR wasn't started, as it will result in a
totally bogus value.  Thanks, Luigi!  :)

Modified:
    trunk/cdr.c

Modified: trunk/cdr.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr.c?rev=13132&r1=13131&r2=13132&view=diff
==============================================================================
--- trunk/cdr.c (original)
+++ trunk/cdr.c Wed Mar 15 15:59:08 2006
@@ -653,11 +653,12 @@
 		chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
 		if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+		if (ast_tvzero(cdr->end))
+			cdr->end = ast_tvnow();
 		if (ast_tvzero(cdr->start))
 			ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", chan);
-		if (ast_tvzero(cdr->end))
-			cdr->end = ast_tvnow();
-		cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
+		else
+			cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
 		if (!ast_tvzero(cdr->answer))
 			cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec;
 		else



More information about the asterisk-commits mailing list