From 712ada3d8dacb3a80456236da3c746b5dfeda3ad Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 Nov 2011 19:27:02 -0600 Subject: [PATCH] deal with timeout better in rare bind_meta_app misuse --- src/switch_ivr.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr.c b/src/switch_ivr.c index bb3886e341..4622f1f684 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -561,8 +561,20 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se if (stream && switch_is_moh(stream)) { if ((b_session = switch_core_session_locate(b_uuid))) { switch_channel_t *b_channel = switch_core_session_get_channel(b_session); + switch_status_t st; + switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP); - switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL); + st = switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL); + if (st != SWITCH_STATUS_SUCCESS && + switch_channel_ready(channel) && switch_channel_ready(b_channel) && !switch_channel_test_flag(b_channel, CF_BROADCAST)) { + switch_core_session_kill_channel(b_session, SWITCH_SIG_BREAK); + st = switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL); + + if (st != SWITCH_STATUS_SUCCESS && + switch_channel_ready(channel) && switch_channel_ready(b_channel) && !switch_channel_test_flag(b_channel, CF_BROADCAST)) { + switch_core_session_flush_private_events(b_session); + } + } switch_core_session_rwunlock(b_session); } } else {