aboutsummaryrefslogtreecommitdiffstats
path: root/main/cdr.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-03 17:16:44 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-03 17:16:44 +0000
commit951887da445006e6ac705fcba33efbe320900fdc (patch)
treea77cff63683081423e7cec350273f6142ec986c8 /main/cdr.c
parent9e8f80f3a0894a2780bfcb16b46abfc8b52295e1 (diff)
Merged revisions 127663 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r127663 | murf | 2008-07-02 18:16:25 -0600 (Wed, 02 Jul 2008) | 30 lines The CDRfix4/5/6 omnibus cdr fixes. (closes issue #10927) Reported by: murf Tested by: murf, deeperror (closes issue #12907) Reported by: falves11 Tested by: murf, falves11 (closes issue #11849) Reported by: greyvoip As to 11849, I think these changes fix the core problems brought up in that bug, but perhaps not the more global problems created by the limitations of CDR's themselves not being oriented around transfers. Reopen if necc, but bug reports are not the best medium for enhancement discussions. We need to start a second-generation CDR standardization effort to cover transfers. (closes issue #11093) Reported by: rossbeer Tested by: greyvoip, murf ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@127793 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/cdr.c')
-rw-r--r--main/cdr.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/main/cdr.c b/main/cdr.c
index 259328fe1..160052000 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -781,6 +781,10 @@ void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data)
for (; cdr; cdr = cdr->next) {
if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
check_post(cdr);
+ if (!app)
+ app = "";
+ if (!data)
+ data = "";
ast_copy_string(cdr->lastapp, S_OR(app, ""), sizeof(cdr->lastapp));
ast_copy_string(cdr->lastdata, S_OR(data, ""), sizeof(cdr->lastdata));
}
@@ -864,7 +868,13 @@ void ast_cdr_end(struct ast_cdr *cdr)
cdr->disposition = AST_CDR_FAILED;
} else
cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
- cdr->billsec = ast_tvzero(cdr->answer) ? 0 : cdr->end.tv_sec - cdr->answer.tv_sec;
+ if (ast_tvzero(cdr->answer)) {
+ if (cdr->disposition == AST_CDR_ANSWERED) {
+ ast_log(LOG_WARNING, "CDR on channel '%s' has no answer time but is 'ANSWERED'\n", S_OR(cdr->channel, "<unknown>"));
+ cdr->disposition = AST_CDR_FAILED;
+ }
+ } else
+ cdr->billsec = cdr->end.tv_sec - cdr->answer.tv_sec;
}
}
@@ -1064,6 +1074,27 @@ void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
}
}
+void ast_cdr_specialized_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
+{
+ struct ast_flags flags = { 0 };
+
+ if (_flags)
+ ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
+
+ if (_flags)
+ ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
+
+ /* Reset to initial state */
+ ast_clear_flag(cdr, AST_FLAGS_ALL);
+ memset(&cdr->start, 0, sizeof(cdr->start));
+ memset(&cdr->end, 0, sizeof(cdr->end));
+ memset(&cdr->answer, 0, sizeof(cdr->answer));
+ cdr->billsec = 0;
+ cdr->duration = 0;
+ ast_cdr_start(cdr);
+ cdr->disposition = AST_CDR_NULL;
+}
+
struct ast_cdr *ast_cdr_append(struct ast_cdr *cdr, struct ast_cdr *newcdr)
{
struct ast_cdr *ret;