]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix broken CDR behavior.
authorMatthew Nicholson <mnicholson@digium.com>
Thu, 22 Apr 2010 21:49:07 +0000 (21:49 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Thu, 22 Apr 2010 21:49:07 +0000 (21:49 +0000)
This change allows a CDR record previously marked with disposition ANSWERED to be set as BUSY or NO ANSWER.

Additionally this change partially reverts r235635 and does not set the AST_CDR_FLAG_ORIGINATED flag on CDRs generated from ast_call().  To preserve proper CDR behavior, the AST_CDR_FLAG_DIALED flag is now cleared from all brige CDRs in ast_bridge_call().

(closes issue #16797)
Reported by: VarnishedOtter
Tested by: mnicholson

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

main/cdr.c
main/channel.c
res/res_features.c

index b347bcc4d71075329056de2e54a4d30d7002762f..7868c1a643af15e510fa64f5d8ffba5d38392549 100644 (file)
@@ -720,8 +720,7 @@ void ast_cdr_busy(struct ast_cdr *cdr)
        for (; cdr; cdr = cdr->next) {
                if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
                        check_post(cdr);
-                       if (cdr->disposition < AST_CDR_BUSY)
-                               cdr->disposition = AST_CDR_BUSY;
+                       cdr->disposition = AST_CDR_BUSY;
                }
        }
 }
@@ -743,11 +742,9 @@ void ast_cdr_noanswer(struct ast_cdr *cdr)
 
        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);
+               check_post(cdr);
                if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-                       if (cdr->disposition < AST_CDR_NOANSWER)
-                               cdr->disposition = AST_CDR_NOANSWER;
+                       cdr->disposition = AST_CDR_NOANSWER;
                }
                cdr = cdr->next;
        }
index eb4aa05d91993da105762e6443086f8653aa9792..3c02beda63e0e03768b5e24d0942992eead27c9c 100644 (file)
@@ -3480,7 +3480,6 @@ int ast_call(struct ast_channel *chan, char *addr, int timeout)
        if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
                if (chan->cdr) {
                        ast_set_flag(chan->cdr, AST_CDR_FLAG_DIALED);
-                       ast_set_flag(chan->cdr, AST_CDR_FLAG_ORIGINATED);
                }
                if (chan->tech->call)
                        res = chan->tech->call(chan, addr, timeout);
index 7d53d185dce4dc06619d1dab2202e0fb74f4a6f5..8690d3ab52a427f928adfd95b0ecf635f25d54da 100644 (file)
@@ -1847,6 +1847,11 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast
                                ast_set_flag(peer_cdr, AST_CDR_FLAG_BRIDGED);
                        }
                }
+               /* the DIALED flag may be set if a dialed channel is transfered
+                * and then bridged to another channel.  In order for the
+                * bridge CDR to be written, the DIALED flag must not be
+                * present. */
+               ast_clear_flag(bridge_cdr, AST_CDR_FLAG_DIALED);
        }
 
        for (;;) {