From: Kevin P. Fleming Date: Wed, 23 May 2007 20:06:13 +0000 (+0000) Subject: if we are going to set variables on a newly created channel, it should be done *befor... X-Git-Tag: 1.2.19~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9edd1e094ce553b928887e8a8d57081f69b70d0f;p=thirdparty%2Fasterisk.git if we are going to set variables on a newly created channel, it should be done *before* we start the PBX on it git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@65676 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index f9821eabe4..70164b9e72 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3485,6 +3485,10 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability) i->owner = tmp; i->capability = capability; ast_setstate(tmp, state); + + for (v = i->vars ; v ; v = v->next) + pbx_builtin_setvar_helper(tmp, v->name, v->value); + if (state != AST_STATE_DOWN) { if (ast_pbx_start(tmp)) { ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name); @@ -3492,9 +3496,7 @@ static struct ast_channel *ast_iax2_new(int callno, int state, int capability) tmp = NULL; } } - for (v = i->vars ; v ; v = v->next) - pbx_builtin_setvar_helper(tmp,v->name,v->value); - + ast_mutex_lock(&usecnt_lock); usecnt++; ast_mutex_unlock(&usecnt_lock);