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: https://origsvn.digium.com/svn/asterisk/branches/1.4@127663 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Steve Murphy
2008-07-03 00:16:25 +00:00
parent 27a3ead8a7
commit e9f5152eba
7 changed files with 135 additions and 216 deletions

View File

@@ -785,6 +785,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));
}
@@ -868,7 +872,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;
}
}
@@ -1056,6 +1066,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;