[asterisk-commits] file: branch 1.2 r72256 - /branches/1.2/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jun 27 15:23:24 CDT 2007


Author: file
Date: Wed Jun 27 15:23:24 2007
New Revision: 72256

URL: http://svn.digium.com/view/asterisk?view=rev&rev=72256
Log:
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.

Modified:
    branches/1.2/channel.c

Modified: branches/1.2/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channel.c?view=diff&rev=72256&r1=72255&r2=72256
==============================================================================
--- branches/1.2/channel.c (original)
+++ branches/1.2/channel.c Wed Jun 27 15:23:24 2007
@@ -1326,6 +1326,7 @@
 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 @@
 	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 @@
 			ast_cause2str(chan->hangupcause)
 			);
 	ast_channel_free(chan);
+
+	/* Defer CDR processing until later */
+	if (cdr)
+		ast_cdr_detach(cdr);
+
 	return res;
 }
 




More information about the asterisk-commits mailing list