[asterisk-commits] murf: branch 1.6.0 r158545 - in /branches/1.6.0: ./ main/features.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 21 16:40:29 CST 2008


Author: murf
Date: Fri Nov 21 16:40:28 2008
New Revision: 158545

URL: http://svn.digium.com/view/asterisk?view=rev&rev=158545
Log:
Merged revisions 158484 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r158484 | murf | 2008-11-21 14:47:16 -0700 (Fri, 21 Nov 2008) | 19 lines

Merged revisions 158483 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r158483 | murf | 2008-11-21 14:19:47 -0700 (Fri, 21 Nov 2008) | 11 lines

(closes issue #13871)
Reported by: mdu113

This one is totally my fault. The code doesn't even
create a bridge CDR if the channel CDR has POST_DISABLED.
I didn't check for that at the end of the bridge.
Fixed with a few small insertions. Tested. Looks
good. No cdr generated, no crash, no unnecc. data
objects created either.


........

................

Modified:
    branches/1.6.0/   (props changed)
    branches/1.6.0/main/features.c

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merge' - no diff available.

Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.

Modified: branches/1.6.0/main/features.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.0/main/features.c?view=diff&rev=158545&r1=158544&r2=158545
==============================================================================
--- branches/1.6.0/main/features.c (original)
+++ branches/1.6.0/main/features.c Fri Nov 21 16:40:28 2008
@@ -2186,23 +2186,25 @@
 	autoloopflag = ast_test_flag(chan, AST_FLAG_IN_AUTOLOOP);
 	ast_set_flag(chan, AST_FLAG_IN_AUTOLOOP);
 	if (res != AST_PBX_KEEPALIVE && !ast_test_flag(&(config->features_caller),AST_FEATURE_NO_H_EXTEN) && ast_exists_extension(chan, chan->context, "h", 1, chan->cid.cid_num)) {
-		struct ast_cdr *swapper;
+		struct ast_cdr *swapper = NULL;
 		char savelastapp[AST_MAX_EXTENSION];
 		char savelastdata[AST_MAX_EXTENSION];
 		char save_exten[AST_MAX_EXTENSION];
 		int  save_prio;
 		int  found = 0;	/* set if we find at least one match */
 		
-		if (ast_opt_end_cdr_before_h_exten) {
+		if (bridge_cdr && ast_opt_end_cdr_before_h_exten) {
 			ast_cdr_end(bridge_cdr);
 		}
 		/* swap the bridge cdr and the chan cdr for a moment, and let the endbridge
 		   dialplan code operate on it */
-		swapper = chan->cdr;
-		ast_copy_string(savelastapp, bridge_cdr->lastapp, sizeof(bridge_cdr->lastapp));
-		ast_copy_string(savelastdata, bridge_cdr->lastdata, sizeof(bridge_cdr->lastdata));
 		ast_channel_lock(chan);
-		chan->cdr = bridge_cdr;
+		if (bridge_cdr) {
+			swapper = chan->cdr;
+			ast_copy_string(savelastapp, bridge_cdr->lastapp, sizeof(bridge_cdr->lastapp));
+			ast_copy_string(savelastdata, bridge_cdr->lastdata, sizeof(bridge_cdr->lastdata));
+			chan->cdr = bridge_cdr;
+		}
 		ast_copy_string(save_exten, chan->exten, sizeof(save_exten));
 		save_prio = chan->priority;
 		ast_copy_string(chan->exten, "h", sizeof(chan->exten));
@@ -2222,12 +2224,15 @@
 		ast_channel_lock(chan);
 		ast_copy_string(chan->exten, save_exten, sizeof(chan->exten));
 		chan->priority = save_prio;
-		chan->cdr = swapper;
+		if (bridge_cdr)
+			chan->cdr = swapper;
 		ast_set_flag(chan, AST_FLAG_BRIDGE_HANGUP_RUN);
 		ast_channel_unlock(chan);
 		/* protect the lastapp/lastdata against the effects of the hangup/dialplan code */
-		ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp));
-		ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata));
+		if (bridge_cdr) {
+			ast_copy_string(bridge_cdr->lastapp, savelastapp, sizeof(bridge_cdr->lastapp));
+			ast_copy_string(bridge_cdr->lastdata, savelastdata, sizeof(bridge_cdr->lastdata));
+		}
 	}
 	ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
 
@@ -2237,10 +2242,10 @@
  	if (!new_chan_cdr || (new_chan_cdr && !ast_test_flag(new_chan_cdr, AST_CDR_FLAG_POST_DISABLED))) {
  		struct ast_channel *chan_ptr = NULL;
 		
-		ast_cdr_end(bridge_cdr);
-		
-		ast_cdr_detach(bridge_cdr);
-		
+		if (bridge_cdr) {
+			ast_cdr_end(bridge_cdr);
+			ast_cdr_detach(bridge_cdr);
+		}
  		/* do a specialized reset on the beginning channel
  		   CDR's, if they still exist, so as not to mess up
  		   issues in future bridges;




More information about the asterisk-commits mailing list