[asterisk-commits] murf: branch 1.2 r70053 - /branches/1.2/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 19 13:08:00 CDT 2007


Author: murf
Date: Tue Jun 19 13:07:59 2007
New Revision: 70053

URL: http://svn.digium.com/view/asterisk?view=rev&rev=70053
Log:
This fixes 9246, where channel variables are not available in the 'h' exten, on a 'ZOMBIE' channel. The fix is to consolidate the channel variables during a masquerade, and then copy the merged variables back onto the clone, so the zombie has the same vars that the 'original' has.

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=70053&r1=70052&r2=70053
==============================================================================
--- branches/1.2/channel.c (original)
+++ branches/1.2/channel.c Tue Jun 19 13:07:59 2007
@@ -2940,10 +2940,20 @@
    
 static void clone_variables(struct ast_channel *original, struct ast_channel *clone)
 {
+	struct ast_var_t *current, *newvar;
 	/* Append variables from clone channel into original channel */
 	/* XXX Is this always correct?  We have to in order to keep MACROS working XXX */
 	if (AST_LIST_FIRST(&clone->varshead))
 		AST_LIST_APPEND_LIST(&original->varshead, &clone->varshead, entries);
+	AST_LIST_HEAD_INIT_NOLOCK(&clone->varshead);
+
+	/* then, dup the varshead list into the clone */
+	
+	AST_LIST_TRAVERSE(&original->varshead, current, entries) {
+		newvar = ast_var_assign(current->name, current->value);
+		if (newvar)
+			AST_LIST_INSERT_TAIL(&clone->varshead, newvar, entries);
+	}
 }
 
 /*--- ast_do_masquerade: Masquerade a channel */
@@ -3125,7 +3135,6 @@
 	/* Drop group from original */
 	ast_app_group_update(clone, original);
 	clone_variables(original, clone);
-	AST_LIST_HEAD_INIT_NOLOCK(&clone->varshead);
 	/* Presense of ADSI capable CPE follows clone */
 	original->adsicpe = clone->adsicpe;
 	/* Bridge remains the same */




More information about the asterisk-commits mailing list