[asterisk-commits] branch 1.2 r13161 - /branches/1.2/cdr.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 15 15:16:16 MST 2006


Author: russell
Date: Wed Mar 15 16:16:15 2006
New Revision: 13161

URL: http://svn.digium.com/view/asterisk?rev=13161&view=rev
Log:
- remove some calculations that will always result in 0
- if a CDR was never started, don't try to calculate a duration and consider it failed

Modified:
    branches/1.2/cdr.c

Modified: branches/1.2/cdr.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/cdr.c?rev=13161&r1=13160&r2=13161&view=diff
==============================================================================
--- branches/1.2/cdr.c (original)
+++ branches/1.2/cdr.c Wed Mar 15 16:16:15 2006
@@ -807,11 +807,13 @@
 			ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
 		if (ast_tvzero(cdr->end))
 			ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
-		if (ast_tvzero(cdr->start))
+		if (ast_tvzero(cdr->start)) {
 			ast_log(LOG_WARNING, "CDR on channel '%s' lacks start\n", chan);
-		cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec + (cdr->end.tv_usec - cdr->start.tv_usec) / 1000000;
+			cdr->disposition = AST_CDR_FAILED;
+		} 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 + (cdr->end.tv_usec - cdr->answer.tv_usec) / 1000000;
+			cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec;
 		else
 			cdr->billsec = 0;
 		ast_set_flag(cdr, AST_CDR_FLAG_POSTED);



More information about the asterisk-commits mailing list