diff --git a/channels/chan_h323.c b/channels/chan_h323.c index dc8b0ce6da..166d6b2ea5 100755 --- a/channels/chan_h323.c +++ b/channels/chan_h323.c @@ -656,7 +656,6 @@ static struct ast_channel *oh323_new(struct oh323_pvt *i, int state, const char fmt = ast_best_codec(ch->nativeformats); ch->type = type; ch->fds[0] = ast_rtp_fd(i->rtp); - ast_setstate(ch, state); if (state == AST_STATE_RING) ch->rings = 1; @@ -700,6 +699,7 @@ static struct ast_channel *oh323_new(struct oh323_pvt *i, int state, const char strncpy(ch->accountcode, i->accountcode, sizeof(ch->accountcode)-1); if (i->amaflags) ch->amaflags = i->amaflags; + ast_setstate(ch, state); if (state != AST_STATE_DOWN) { if (ast_pbx_start(ch)) { ast_log(LOG_WARNING, "Unable to start PBX on %s\n", ch->name); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index e5cd96d908..2fd2f675ff 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1557,7 +1557,6 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title) tmp->fds[2] = ast_rtp_fd(i->vrtp); tmp->fds[3] = ast_rtcp_fd(i->vrtp); } - ast_setstate(tmp, state); if (state == AST_STATE_RING) tmp->rings = 1; tmp->adsicpe = AST_ADSI_UNAVAILABLE; @@ -1605,7 +1604,7 @@ static struct ast_channel *sip_new(struct sip_pvt *i, int state, char *title) if (strlen(i->domain)) { pbx_builtin_setvar_helper(tmp, "SIPDOMAIN", i->domain); } - + ast_setstate(tmp, state); if (state != AST_STATE_DOWN) { if (ast_pbx_start(tmp)) { ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmp->name);