aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-23 20:46:22 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2007-05-23 20:46:22 +0000
commit6b78503c5c748176b3e26b1d42d4f5034b4f366c (patch)
treede4c0326ad510e45b1863da3795d93ae68a846e1 /channels
parentaf125e9a83d8ec5bf1840961883ce60177b2dfdf (diff)
ensure that variables are set on a newly created channel before we start a PBX on it
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@65682 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 663f601e9..7adfec501 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -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);