diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 999d028eba..412cb63757 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -122,6 +122,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_events(switch_core_session_ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_event(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_signal_data(switch_core_session_t *session); +SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_signal_data(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_ivr_process_indications(switch_core_session_t *session, switch_core_session_message_t *message); /*! diff --git a/src/switch_channel.c b/src/switch_channel.c index 47eadef2e6..dfc23213f6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2100,10 +2100,8 @@ SWITCH_DECLARE(int) switch_channel_state_change_pending(switch_channel_t *channe SWITCH_DECLARE(int) switch_channel_check_signal(switch_channel_t *channel, switch_bool_t in_thread_only) { - if (!in_thread_only || switch_core_session_in_thread(channel->session)) { - switch_ivr_parse_all_signal_data(channel->session); - } - + (void)in_thread_only; + switch_ivr_parse_next_signal_data(channel->session); return 0; } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 3e514d1e61..95c275ce6e 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -820,7 +820,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_messages(switch_core_sessio } -SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_signal_data(switch_core_session_t *session) +static switch_status_t switch_ivr_parse_signal_data(switch_core_session_t *session, switch_bool_t all) { void *data; switch_core_session_message_t msg = { 0 }; @@ -847,7 +847,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_signal_data(switch_core_ses switch_core_session_receive_message(session, &msg); data = NULL; - + if (!all) + break; } switch_channel_clear_flag(channel, CF_SIGNAL_DATA); @@ -855,6 +856,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_signal_data(switch_core_ses return i ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } +SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_signal_data(switch_core_session_t *session) { + return switch_ivr_parse_signal_data(session, SWITCH_TRUE); +} + +SWITCH_DECLARE(switch_status_t) switch_ivr_parse_next_signal_data(switch_core_session_t *session) { + return switch_ivr_parse_signal_data(session, SWITCH_FALSE); +} + SWITCH_DECLARE(switch_status_t) switch_ivr_parse_all_events(switch_core_session_t *session) { int x = 0;