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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425784 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/42/42/1
Richard Mudgett 11 years ago
parent df59a71b83
commit f91cb1207c

@ -6333,41 +6333,42 @@ void ast_change_name(struct ast_channel *chan, const char *newname)
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));
}
}
}

@ -703,6 +703,8 @@ void ast_unreal_call_setup(struct ast_channel *semi1, struct ast_channel *semi2)
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);

Loading…
Cancel
Save