]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
ensure that variables are set on a newly created channel before we start a PBX on it
authorKevin P. Fleming <kpfleming@digium.com>
Wed, 23 May 2007 20:46:22 +0000 (20:46 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Wed, 23 May 2007 20:46:22 +0000 (20:46 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@65682 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 663f601e9f2f136ee8798784f4a6a966a2930bb1..7adfec50132e7e14e2f707d1dde60475423e7362 100644 (file)
@@ -2880,6 +2880,11 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
        pbx_builtin_setvar_helper(tmp, "OSPPEER", peer);
 #endif
        ast_setstate(tmp, state);
+
+       /* Set channel variables for this call from configuration */
+       for (v = i->chanvars ; 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);
@@ -2887,10 +2892,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title)
                        tmp = NULL;
                }
        }
-       /* Set channel variables for this call from configuration */
-       for (v = i->chanvars ; v ; v = v->next)
-               pbx_builtin_setvar_helper(tmp,v->name,v->value);
-                               
+
        ast_mutex_lock(&usecnt_lock);
        usecnt++;
        ast_mutex_unlock(&usecnt_lock);