diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index aeadc340c0d892213bd50256be9684aabf489fe0..2702621f7baa038d7afad6e0d7f6c36178ce130f 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 cd9f3ecfffcb4784420ba7e422e837afbb56b0df..1ce5b345e350bda6f680ea74df2e932467a4b540 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 9bf77cc27358e672854be0c404d1023ae4ff8e43..bfa79e454749325f63c7745b3855100f3fa9a96f 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 7b56b8c9855be9bdf0626568ec9149b7dfd721e7..07da3a75d3cd172af95df26d2d4c4edc7bbf074f 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 48af9768e9f646585db419303fc058964e483f30..99ad2604612ae96fe3179f977e8f9f63d254dbf0 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 026df911c8de39382c2d66284512b0092edde65f..9e5493d07892e2edeb0dce1a6d93d62017ce24c6 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 00b54f015516e70b0ebc6496160d2bf7e8452541..498b87cfd5bd8570e0a16193af3b1d00e139a5fd 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; }