aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-16 03:43:47 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-16 03:43:47 +0000
commit2dcd94043fe3e8f5ff94751b4105548df48ef8e9 (patch)
tree98c95aea70e10cb294e357dc51f55ae0e3b448aa
parentcf9d8c40b69e7a50f6e4ddef3784ca61e4e64ae6 (diff)
move the calls to ast_jb_configure() to before the PBX thread is started on the
channel to remove the theoretical race condition that the channel could get bridged before the channel's jitterbuffer gets configured. This was pointed out by PCadach on IRC. Thanks! git-svn-id: http://svn.digium.com/svn/asterisk/trunk@39964 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_alsa.c3
-rw-r--r--channels/chan_h323.c6
-rw-r--r--channels/chan_jingle.c6
-rw-r--r--channels/chan_mgcp.c6
-rw-r--r--channels/chan_oss.c3
-rw-r--r--channels/chan_sip.c6
-rw-r--r--channels/chan_skinny.c7
7 files changed, 13 insertions, 24 deletions
diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c
index aeadc340c..2702621f7 100644
--- a/channels/chan_alsa.c
+++ b/channels/chan_alsa.c
@@ -829,6 +829,7 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
usecnt++;
ast_mutex_unlock(&usecnt_lock);
ast_update_use_count();
+ ast_jb_configure(tmp, &global_jbconf);
if (state != AST_STATE_DOWN) {
if (ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@@ -836,8 +837,6 @@ static struct ast_channel *alsa_new(struct chan_alsa_pvt *p, int state)
tmp = NULL;
}
}
- if (tmp)
- ast_jb_configure(tmp, &global_jbconf);
}
return tmp;
}
diff --git a/channels/chan_h323.c b/channels/chan_h323.c
index cd9f3ecff..1ce5b345e 100644
--- a/channels/chan_h323.c
+++ b/channels/chan_h323.c
@@ -826,6 +826,8 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
ch->cid.cid_dnid = strdup(pvt->exten);
}
ast_setstate(ch, state);
+ if (pvt->rtp)
+ ast_jb_configure(ch, &global_jbconf);
if (state != AST_STATE_DOWN) {
if (ast_pbx_start(ch)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ch->name);
@@ -833,10 +835,6 @@ static struct ast_channel *__oh323_new(struct oh323_pvt *pvt, int state, const c
ch = NULL;
}
}
-
- /* Configure the new channel jb */
- if (ch && pvt && pvt->rtp)
- ast_jb_configure(ch, &global_jbconf);
} else {
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
}
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index 9bf77cc27..bfa79e454 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -813,6 +813,8 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
tmp->cid.cid_dnid = ast_strdup(i->exten);
tmp->priority = 1;
ast_setstate(tmp, state);
+ if (i->rtp)
+ ast_jb_configure(tmp, &global_jbconf);
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;
@@ -820,10 +822,6 @@ static struct ast_channel *jingle_new(struct jingle *client, struct jingle_pvt *
tmp = NULL;
}
- /* Configure the new channel jb */
- if (tmp && i && i->rtp)
- ast_jb_configure(tmp, &global_jbconf);
-
return tmp;
}
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 7b56b8c98..07da3a75d 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -1425,6 +1425,8 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
if (!i->adsi)
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
tmp->priority = 1;
+ if (sub->rtp)
+ ast_jb_configure(tmp, &global_jbconf);
if (state != AST_STATE_DOWN) {
if (ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@@ -1437,10 +1439,6 @@ static struct ast_channel *mgcp_new(struct mgcp_subchannel *sub, int state)
ast_verbose(VERBOSE_PREFIX_3 "MGCP mgcp_new(%s) created in state: %s\n",
tmp->name, ast_state2str(state));
}
-
- /* Configure the new channel jb */
- if (tmp && sub && sub->rtp)
- ast_jb_configure(tmp, &global_jbconf);
} else {
ast_log(LOG_WARNING, "Unable to allocate channel structure\n");
}
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 48af9768e..99ad26046 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1021,6 +1021,7 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
usecnt++;
ast_mutex_unlock(&usecnt_lock);
ast_update_use_count();
+ ast_jb_configure(c, &global_jbconf);
if (state != AST_STATE_DOWN) {
if (ast_pbx_start(c)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", c->name);
@@ -1030,8 +1031,6 @@ static struct ast_channel *oss_new(struct chan_oss_pvt *o,
/* XXX what about usecnt ? */
}
}
- if (c)
- ast_jb_configure(c, &global_jbconf);
return c;
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 026df911c..9e5493d07 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3703,6 +3703,8 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
if (!ast_strlen_zero(i->callid))
pbx_builtin_setvar_helper(tmp, "SIPCALLID", i->callid);
ast_setstate(tmp, state);
+ if (i->rtp)
+ ast_jb_configure(tmp, &global_jbconf);
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;
@@ -3716,10 +3718,6 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, const char *tit
if (recordhistory)
append_history(i, "NewChan", "Channel %s - from %s", tmp->name, i->callid);
- /* Configure the new channel jb */
- if (tmp && i && i->rtp)
- ast_jb_configure(tmp, &global_jbconf);
-
return tmp;
}
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 00b54f015..498b87cfd 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -2592,6 +2592,9 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state)
tmp->priority = 1;
tmp->adsicpe = AST_ADSI_UNAVAILABLE;
+ if (sub->rtp)
+ ast_jb_configure(tmp, &global_jbconf);
+
if (state != AST_STATE_DOWN) {
if (ast_pbx_start(tmp)) {
ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);
@@ -2599,10 +2602,6 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state)
tmp = NULL;
}
}
-
- /* Configure the new channel jb */
- if (tmp && sub->rtp)
- ast_jb_configure(tmp, &global_jbconf);
}
return tmp;
}