summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2007-06-19 18:31:29 +0000
committerSteve Murphy <murf@digium.com>2007-06-19 18:31:29 +0000
commitcd97d6a687566c74f7d2f623d5854bd601c8a4da (patch)
tree813d8fc889d65edaaf1394d58300e857f1811cd8 /main/channel.c
parent9bec4f4b5857061ae8b74228f75bb984525fa5e9 (diff)
Merged revisions 70062 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ................ r70062 | murf | 2007-06-19 12:23:23 -0600 (Tue, 19 Jun 2007) | 9 lines Merged revisions 70053 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r70053 | murf | 2007-06-19 12:07:59 -0600 (Tue, 19 Jun 2007) | 1 line 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. ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@70063 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/main/channel.c b/main/channel.c
index 4d6533d36..3529c1f32 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -3385,10 +3385,20 @@ void ast_channel_inherit_variables(const struct ast_channel *parent, struct ast_
*/
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);
+ }
}
/*!
@@ -3593,7 +3603,6 @@ int ast_do_masquerade(struct ast_channel *original)
AST_LIST_HEAD_INIT_NOLOCK(&clone->datastores);
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 */