aboutsummaryrefslogtreecommitdiffstats
path: root/cdr.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-18 20:56:20 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-18 20:56:20 +0000
commit59d800072ecf60a7e8e92140cc17e527e3349ecd (patch)
tree1ba00a1516af40676aeaf97d0b24a335660de4db /cdr.c
parent201909b9bb26f9900ddcfc8393281c69daee8b58 (diff)
This update will fix the situation that occurs as described by 9717, where when several targets are specified for a dial, if any one them reports FAIL, the whole call gets FAIL, even though others were ringing OK. I rearranged the priorities, so that a new disposition, NULL, is at the lowest level, and the disposition get init'd to NULL. Then, next up is FAIL, and next up is BUSY, then NOANSWER, then ANSWERED. All the related set routines will only do so if the disposition value to be set to is greater than what's already there. This gives the intended effect. So, if all the targets are busy, you'd get BUSY for the call disposition. If all get BUSY, but one, and that one rings is not answered, you get NOANSWER. If by some freak of nature, the NULL value doesn't get overridden, then the disp2str routine will report NOANSWER as before.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@65172 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'cdr.c')
-rw-r--r--cdr.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/cdr.c b/cdr.c
index 8f9c4da0a..0646a0af7 100644
--- a/cdr.c
+++ b/cdr.c
@@ -528,6 +528,22 @@ void ast_cdr_failed(struct ast_cdr *cdr)
}
}
+void ast_cdr_noanswer(struct ast_cdr *cdr)
+{
+ char *chan;
+
+ while (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_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ if (cdr->disposition < AST_CDR_NOANSWER)
+ cdr->disposition = AST_CDR_NOANSWER;
+ }
+ cdr = cdr->next;
+ }
+}
+
int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
{
int res = 0;
@@ -638,7 +654,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
ast_copy_string(cdr->clid, tmp, sizeof(cdr->clid));
ast_copy_string(cdr->src, num ? num : "", sizeof(cdr->src));
- cdr->disposition = (c->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NOANSWER;
+ cdr->disposition = (c->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NULL;
cdr->amaflags = c->amaflags ? c->amaflags : ast_default_amaflags;
ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
/* Destination information */
@@ -671,6 +687,8 @@ void ast_cdr_end(struct ast_cdr *cdr)
char *ast_cdr_disp2str(int disposition)
{
switch (disposition) {
+ case AST_CDR_NULL:
+ return "NO ANSWER"; /* by default, for backward compatibility */
case AST_CDR_NOANSWER:
return "NO ANSWER";
case AST_CDR_FAILED:
@@ -862,7 +880,7 @@ void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
cdr->billsec = 0;
cdr->duration = 0;
ast_cdr_start(cdr);
- cdr->disposition = AST_CDR_NOANSWER;
+ cdr->disposition = AST_CDR_NULL;
}
cdr = cdr->next;