aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-20 17:47:10 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-12-20 17:47:10 +0000
commite3e9c3b9064e358dd72a8a3f0326c2ccfd2f0a7a (patch)
tree2db7dc589423e78d9778fb14cfc3b74203a2d673
parent691aaa05b52a1a2c48bb2b1db0d945660763cfe3 (diff)
Merged revisions 299130 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2 ........ r299130 | tilghman | 2010-12-20 11:41:24 -0600 (Mon, 20 Dec 2010) | 11 lines 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 ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@299131 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--cdr/cdr_pgsql.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/cdr/cdr_pgsql.c b/cdr/cdr_pgsql.c
index 5a69ea79e..9dcab036e 100644
--- a/cdr/cdr_pgsql.c
+++ b/cdr/cdr_pgsql.c
@@ -191,7 +191,7 @@ static int pgsql_log(struct ast_cdr *cdr)
} else {
/* char, hopefully */
LENGTHEN_BUF2(31);
- ast_localtime(&cdr->start, &tm, tz);
+ ast_localtime(&cdr->answer, &tm, tz);
ast_strftime(buf, sizeof(buf), DATE_FORMAT, &tm);
ast_str_append(&sql2, 0, "%s%s", first ? "" : ",", buf);
}
@@ -216,12 +216,12 @@ static int pgsql_log(struct ast_cdr *cdr)
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) (ast_tvdiff_us(cdr->end, *when) / 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) (ast_tvdiff_us(cdr->end, *when) / 1000000.0));
}