diff options
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r-- | channels/chan_skinny.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index da7d118f6..899bd13df 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -2516,6 +2516,10 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state) if (l->amaflags) tmp->amaflags = l->amaflags; + ast_mutex_lock(&usecnt_lock); + usecnt++; + ast_mutex_unlock(&usecnt_lock); + ast_update_use_count(); tmp->callgroup = l->callgroup; tmp->pickupgroup = l->pickupgroup; ast_string_field_set(tmp, call_forward, l->call_forward); @@ -2526,29 +2530,18 @@ static struct ast_channel *skinny_new(struct skinny_line *l, int state) tmp->priority = 1; tmp->adsicpe = AST_ADSI_UNAVAILABLE; - /* Configure the new channel jb */ - if (sub->rtp) { - if (ast_jb_configure(tmp, &global_jbconf)) { - ast_hangup(tmp); - sub->owner = NULL; - return NULL; - } - } if (state != AST_STATE_DOWN) { if (ast_pbx_start(tmp)) { ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name); ast_hangup(tmp); - sub->owner = NULL; - return NULL; + tmp = NULL; } } - } - - ast_mutex_lock(&usecnt_lock); - usecnt++; - ast_mutex_unlock(&usecnt_lock); - ast_update_use_count(); + /* Configure the new channel jb */ + if (tmp && sub->rtp) + ast_jb_configure(tmp, &global_jbconf); + } return tmp; } |