aboutsummaryrefslogtreecommitdiffstats
path: root/channel.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-19 18:07:59 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-19 18:07:59 +0000
commitd660a3bdc7401b5db7a083f725625c48ad09d828 (patch)
tree904a7c62612e21576b517827fe682d645fc17077 /channel.c
parent364604e4ad11cde2597eb66f73222555b7452a1c (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.2@70053 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channel.c')
-rw-r--r--channel.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/channel.c b/channel.c
index 5a3afcf2a..10ef85fc2 100644
--- a/channel.c
+++ b/channel.c
@@ -2940,10 +2940,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);
+ }
}
/*--- ast_do_masquerade: Masquerade a channel */
@@ -3125,7 +3135,6 @@ int ast_do_masquerade(struct ast_channel *original)
/* 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 */