Merged revisions 65201 via svnmerge from
authorSteve Murphy <murf@digium.com>
Fri, 18 May 2007 22:35:48 +0000 (22:35 +0000)
committerSteve Murphy <murf@digium.com>
Fri, 18 May 2007 22:35:48 +0000 (22:35 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r65201 | murf | 2007-05-18 16:26:51 -0600 (Fri, 18 May 2007) | 1 line

Ugh. The svnmerge didn't catch the shift from cdr.c to main/cdr.c, and neither did I. This is the remainder of the 9717 patch, the fix for the run-away FAIL status for a call
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@65203 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/cdr.c

index 297769b..db14dea 100644 (file)
@@ -665,6 +665,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;
@@ -756,7 +772,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
                        ast_copy_string(cdr->channel, c->name, sizeof(cdr->channel));
                        set_one_cid(cdr, c);
 
-                       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 */
@@ -787,6 +803,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:
@@ -953,7 +971,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;
                }
        }
 }