From: Anthony Minessale Date: Mon, 21 Mar 2011 17:01:51 +0000 (-0500) Subject: FS-3170 this was specific to the user channel which is not a real channel in every... X-Git-Tag: v1.2-rc1~171^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88a6ac2ff4b1d26894d3ed8e5f815efa00786edb;p=thirdparty%2Ffreeswitch.git FS-3170 this was specific to the user channel which is not a real channel in every sense of the word as it has no running thread or any usable state changes so this new line of code in 233d3164be4412aaaf8f9f42d8042e48279a018a to wait for the state machine to stabalize before returning from originate caused an issue with user/ channels --- diff --git a/src/switch_channel.c b/src/switch_channel.c index 784577c642..7d246893f7 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1562,6 +1562,10 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_get_running_state(switch_c SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channel) { + if (switch_channel_down(channel) || !switch_core_session_in_thread(channel->session)) { + return 0; + } + return channel->running_state != channel->state; } diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index c418d40e36..33e9d9a0bc 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3625,7 +3625,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } - while(switch_channel_get_state(bchan) != switch_channel_get_running_state(bchan) && switch_channel_up(bchan)) switch_cond_next(); + + while(switch_channel_state_change_pending(bchan)) { + switch_cond_next(); + } + + switch_ivr_sleep(*bleg, 0, SWITCH_TRUE, NULL); }