diff options
author | Russell Bryant <russell@russellbryant.com> | 2006-03-15 21:59:08 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2006-03-15 21:59:08 +0000 |
commit | 62d5f5a7ead3f7a820629c98bcbafa3a4284b9ca (patch) | |
tree | 2c48c2b8b7629644b523604c204fc242f9678dd1 | |
parent | cb733793191369229b90ef897680d1c0a6070d50 (diff) |
don't calculate a duration if the CDR wasn't started, as it will result in a
totally bogus value. Thanks, Luigi! :)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@13132 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | cdr.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -653,11 +653,12 @@ void ast_cdr_end(struct ast_cdr *cdr) 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->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; + if (ast_tvzero(cdr->start)) + ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", chan); + 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 |