From 88a6ac2ff4b1d26894d3ed8e5f815efa00786edb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 21 Mar 2011 12:01:51 -0500 Subject: [PATCH] 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 --- src/switch_channel.c | 4 ++++ src/switch_ivr_originate.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) 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); }