[asterisk-commits] rmudgett: trunk r425784 - in /trunk: ./ main/channel.c main/core_unreal.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 16 21:50:04 CDT 2014


Author: rmudgett
Date: Thu Oct 16 21:49:57 2014
New Revision: 425784

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=425784
Log:
AMI: Add missing VarSet events when a channel inherits variables.

There should be AMI VarSet events when channel variables are inherited by
an outgoing channel.  Also local;2 should generate VarSet events when it
gets all of its channel variables from channel local;1.

ASTERISK-24415 #close
Reported by: Richard Mudgett
Patches:
      jira_asterisk_24415_v12.patch (license #5621) patch uploaded by Richard Mudgett

Review: https://reviewboard.asterisk.org/r/4074/
........

Merged revisions 425782 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 425783 from http://svn.asterisk.org/svn/asterisk/branches/13

Modified:
    trunk/   (props changed)
    trunk/main/channel.c
    trunk/main/core_unreal.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-13-merged' - no diff available.

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=425784&r1=425783&r2=425784
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Thu Oct 16 21:49:57 2014
@@ -6333,41 +6333,42 @@
 
 void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_channel *child)
 {
-	struct ast_var_t *current, *newvar;
+	struct ast_var_t *current;
+	struct ast_var_t *newvar;
 	const char *varname;
+	int vartype;
 
 	AST_LIST_TRAVERSE(ast_channel_varshead((struct ast_channel *) parent), current, entries) {
-		int vartype = 0;
-
 		varname = ast_var_full_name(current);
-		if (!varname)
+		if (!varname) {
 			continue;
-
+		}
+
+		vartype = 0;
 		if (varname[0] == '_') {
 			vartype = 1;
-			if (varname[1] == '_')
+			if (varname[1] == '_') {
 				vartype = 2;
+			}
 		}
 
 		switch (vartype) {
 		case 1:
 			newvar = ast_var_assign(&varname[1], ast_var_value(current));
-			if (newvar) {
-				AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries);
-				ast_debug(1, "Inheriting variable %s from %s to %s.\n",
-					ast_var_name(newvar), ast_channel_name(parent), ast_channel_name(child));
-			}
 			break;
 		case 2:
 			newvar = ast_var_assign(varname, ast_var_value(current));
-			if (newvar) {
-				AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries);
-				ast_debug(1, "Inheriting variable %s from %s to %s.\n",
-					ast_var_name(newvar), ast_channel_name(parent), ast_channel_name(child));
-			}
 			break;
 		default:
-			break;
+			continue;
+		}
+		if (newvar) {
+			ast_debug(1, "Inheriting variable %s from %s to %s.\n",
+				ast_var_full_name(newvar), ast_channel_name(parent),
+				ast_channel_name(child));
+			AST_LIST_INSERT_TAIL(ast_channel_varshead(child), newvar, entries);
+			ast_channel_publish_varset(child, ast_var_full_name(newvar),
+				ast_var_value(newvar));
 		}
 	}
 }

Modified: trunk/main/core_unreal.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/core_unreal.c?view=diff&rev=425784&r1=425783&r2=425784
==============================================================================
--- trunk/main/core_unreal.c (original)
+++ trunk/main/core_unreal.c Thu Oct 16 21:49:57 2014
@@ -703,6 +703,8 @@
 		clone_var = ast_var_assign(varptr->name, varptr->value);
 		if (clone_var) {
 			AST_LIST_INSERT_TAIL(ast_channel_varshead(semi2), clone_var, entries);
+			ast_channel_publish_varset(semi2, ast_var_full_name(clone_var),
+				ast_var_value(clone_var));
 		}
 	}
 	ast_channel_datastore_inherit(semi1, semi2);




More information about the asterisk-commits mailing list