diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 7f4732f0a7..1bcc93cf1f 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -779,6 +779,7 @@ SWITCH_DECLARE(uint32_t) switch_core_session_private_event_count(_In_ switch_cor */ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(_In_ switch_core_session_t *session, _Out_ switch_event_t **event); +SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_session_t *session); /*! \brief Read a frame from a session diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 889e31d85c..4b6a44efba 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -268,7 +268,7 @@ SWITCH_STANDARD_APP(fifo_function) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Action", "push"); switch_event_fire(&event); } - + switch_ivr_park(session, NULL); if (switch_channel_ready(channel)) { @@ -393,6 +393,7 @@ SWITCH_STANDARD_APP(fifo_function) if (switch_channel_test_flag(other_channel, CF_TAGGED)) { switch_channel_clear_flag(other_channel, CF_CONTROLLED); + switch_core_session_flush_private_events(other_session); switch_channel_stop_broadcast(other_channel); switch_core_session_kill_channel(other_session, SWITCH_SIG_BREAK); while (switch_channel_test_flag(other_channel, CF_TAGGED)) { diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 07e04c8b3e..87426ea3b6 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -563,6 +563,21 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch return status; } +SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_session_t *session) +{ + switch_status_t status = SWITCH_STATUS_FALSE; + int x = 0; + void *pop; + + if (session->private_event_queue) { + while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) { + x++; + } + } + + return x; +} + SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, switch_bool_t flush_dtmf) { switch_channel_t *channel = switch_core_session_get_channel(session);