summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 42ad3630f..5c27c9eca 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -4289,15 +4289,17 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
pbx_builtin_setvar_helper(tmp, "SIPCALLID", i->callid);
if (i->rtp)
ast_jb_configure(tmp, &global_jbconf);
+
+ /* 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 && ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
tmp->hangupcause = AST_CAUSE_SWITCH_CONGESTION;
ast_hangup(tmp);
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);
if (!ast_test_flag(&i->flags[0], SIP_NO_HISTORY))
append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);