]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
I may possibly get shot for doing this... but... defer CDR processing until after...
authorJoshua Colp <jcolp@digium.com>
Wed, 27 Jun 2007 20:23:24 +0000 (20:23 +0000)
committerJoshua Colp <jcolp@digium.com>
Wed, 27 Jun 2007 20:23:24 +0000 (20:23 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@72256 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channel.c

index 10ef85fc2f780bc2b69896102e19d843d948a23d..a96d7d2d4cbec85acbde1c47f0cc24d2e355e233 100644 (file)
--- a/channel.c
+++ b/channel.c
@@ -1326,6 +1326,7 @@ static void free_translation(struct ast_channel *clone)
 int ast_hangup(struct ast_channel *chan)
 {
        int res = 0;
+       struct ast_cdr *cdr = NULL;
 
        /* Don't actually hang up a channel that will masquerade as someone else, or
           if someone is going to masquerade as us */
@@ -1372,7 +1373,7 @@ int ast_hangup(struct ast_channel *chan)
        chan->generator = NULL;
        if (chan->cdr) {                /* End the CDR if it hasn't already */ 
                ast_cdr_end(chan->cdr);
-               ast_cdr_detach(chan->cdr);      /* Post and Free the CDR */ 
+               cdr = chan->cdr;
                chan->cdr = NULL;
        }
        if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
@@ -1403,6 +1404,11 @@ int ast_hangup(struct ast_channel *chan)
                        ast_cause2str(chan->hangupcause)
                        );
        ast_channel_free(chan);
+
+       /* Defer CDR processing until later */
+       if (cdr)
+               ast_cdr_detach(cdr);
+
        return res;
 }