aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_iax2.c8
-rw-r--r--channels/chan_sip.c10
2 files changed, 11 insertions, 7 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index f9821eabe..70164b9e7 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);
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 16b1097d1..ab11cb814 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -2918,6 +2918,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);
@@ -2925,10 +2930,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);