[svn-commits] tilghman: branch 1.6.2 r299130 - /branches/1.6.2/cdr/cdr_pgsql.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Dec 20 17:41:28 UTC 2010


Author: tilghman
Date: Mon Dec 20 11:41:24 2010
New Revision: 299130

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=299130
Log:
If a call was not answered, then the billsec was calculated unusually large.

Also, due to a copy and paste error, a request for the answer field would have
given the start value, instead.

(closes issue #18460)
 Reported by: joscas
 Patches: 
       20101215__issue18460.diff.txt uploaded by tilghman (license 14)
 Tested by: joscas

Modified:
    branches/1.6.2/cdr/cdr_pgsql.c

Modified: branches/1.6.2/cdr/cdr_pgsql.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/cdr/cdr_pgsql.c?view=diff&rev=299130&r1=299129&r2=299130
==============================================================================
--- branches/1.6.2/cdr/cdr_pgsql.c (original)
+++ branches/1.6.2/cdr/cdr_pgsql.c Mon Dec 20 11:41:24 2010
@@ -193,7 +193,7 @@
 				} else {
 					/* char, hopefully */
 					LENGTHEN_BUF2(31);
-					ast_localtime(&cdr->start, &tm, NULL);
+					ast_localtime(&cdr->answer, &tm, NULL);
 					ast_strftime(buf, sizeof(buf), DATE_FORMAT, &tm);
 					ast_str_append(&sql2, 0, "%s%s", first ? "" : ",", buf);
 				}
@@ -218,12 +218,12 @@
 					LENGTHEN_BUF2(13);
 					ast_str_append(&sql2, 0, "%s%s", first ? "" : ",", value);
 				} else if (strncmp(cur->type, "float", 5) == 0) {
-					struct timeval *when = cur->name[0] == 'd' ? &cdr->start : &cdr->answer;
+					struct timeval *when = cur->name[0] == 'd' ? &cdr->start : ast_tvzero(cdr->answer) ? &cdr->end : &cdr->answer;
 					LENGTHEN_BUF2(31);
 					ast_str_append(&sql2, 0, "%s%f", first ? "" : ",", (double)cdr->end.tv_sec - when->tv_sec + cdr->end.tv_usec / 1000000.0 - when->tv_usec / 1000000.0);
 				} else {
 					/* Char field, probably */
-					struct timeval *when = cur->name[0] == 'd' ? &cdr->start : &cdr->answer;
+					struct timeval *when = cur->name[0] == 'd' ? &cdr->start : ast_tvzero(cdr->answer) ? &cdr->end : &cdr->answer;
 					LENGTHEN_BUF2(31);
 					ast_str_append(&sql2, 0, "%s'%f'", first ? "" : ",", (double)cdr->end.tv_sec - when->tv_sec + cdr->end.tv_usec / 1000000.0 - when->tv_usec / 1000000.0);
 				}




More information about the svn-commits mailing list