diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 2e154cba7c..fbc65ebaa3 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1301,7 +1301,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } else { /* time off the channel (if you must) */ switch_frame_t *read_frame; switch_status_t status; - while (switch_channel_test_flag(channel, CF_HOLD)) { + while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) { switch_yield(10000); } status = switch_core_session_read_frame(session, &read_frame, -1, 0); @@ -1604,7 +1604,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session switch_frame_t *read_frame; switch_status_t status = switch_core_session_read_frame(session, &read_frame, -1, 0); - while (switch_channel_test_flag(channel, CF_HOLD)) { + while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) { switch_yield(10000); } @@ -1661,7 +1661,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session switch_frame_t *read_frame; switch_status_t status = switch_core_session_read_frame(session, &read_frame, -1, 0); - while (switch_channel_test_flag(channel, CF_HOLD)) { + while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) { switch_yield(10000); }