diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ebf51b9c39..3bc5cc2231 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1480,7 +1480,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (ok) { switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); - switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); + switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); sofia_set_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE); } @@ -1528,7 +1528,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (sofia_test_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE)) { switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); - switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); + switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE); } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 88c72bf1b8..dbe3b811fe 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -386,6 +386,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (send_dtmf) { switch_core_session_send_dtmf(session_b, &dtmf); + switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); } } } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 6b8c6b0dc6..e81812a463 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -267,6 +267,8 @@ typedef enum { RESULT_GOTO_TIMERCHECK } handle_rfc2833_result_t; +static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session); + static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_size_t bytes, int *do_cng) { #ifdef DEBUG_2833 @@ -2209,6 +2211,7 @@ static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session) if (rtp_session->dtmf_data.out_digit_dur > 0) { int x, loops = 1; + rtp_session->dtmf_data.out_digit_sofar += samples; rtp_session->dtmf_data.out_digit_sub_sofar += samples; @@ -2737,7 +2740,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) && rtp_session->read_pollfd) { int pt = poll_sec * 1000000; - if (rtp_session->dtmf_data.out_digit_dur > 0 || rtp_session->dtmf_data.in_digit_sanity) { + do_2833(rtp_session, session); + + if (rtp_session->dtmf_data.out_digit_dur > 0 || rtp_session->dtmf_data.in_digit_sanity || rtp_session->sending_dtmf || + switch_queue_size(rtp_session->dtmf_data.dtmf_queue) || switch_queue_size(rtp_session->dtmf_data.dtmf_inqueue)) { pt = 20000; } @@ -2746,7 +2752,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt); - do_2833(rtp_session, session); if (rtp_session->dtmf_data.out_digit_dur > 0) { return_cng_frame();