aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 20:23:24 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 20:23:24 +0000
commitdb5d1b2c2886866582d249fb5736b5cb126df787 (patch)
tree2626d2f330e9117d983e982d271169ab01b66aa0
parent317ee58dc7f2eec6a787ad04451ac4d85fffff38 (diff)
I may possibly get shot for doing this... but... defer CDR processing until after the channel has been dealt with. This should eliminate all of the issues with channels going funky (SIP/PRI) when you are posting CDRs to a database that is either slow or unavailable and do not want to enable batching.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@72256 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channel.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/channel.c b/channel.c
index 10ef85fc2..a96d7d2d4 100644
--- 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;
}