Run setstate after setting all appropriate variables including callerid
authorMark Spencer <markster@digium.com>
Wed, 28 Apr 2004 14:35:20 +0000 (14:35 +0000)
committerMark Spencer <markster@digium.com>
Wed, 28 Apr 2004 14:35:20 +0000 (14:35 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2797 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_h323.c
channels/chan_sip.c

index dc8b0ce..166d6b2 100755 (executable)
@@ -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);
index e5cd96d..2fd2f67 100755 (executable)
@@ -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);