diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 86f84e5a8a..4bbae27ec6 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -119,6 +119,7 @@ typedef enum { SWITCH_RTP_FLAG_RAW_WRITE - Try to forward packets unscathed SWITCH_RTP_FLAG_GOOGLEHACK - Convert payload from 102 to 97 SWITCH_RTP_FLAG_VAD - Enable VAD + SWITCH_RTP_FLAG_BREAK - Stop what you are doing and return SWITCH_STATUS_BREAK */ typedef enum { @@ -130,7 +131,8 @@ typedef enum { SWITCH_RTP_FLAG_AUTOADJ = (1 << 5), SWITCH_RTP_FLAG_RAW_WRITE = (1 << 6), SWITCH_RTP_FLAG_GOOGLEHACK = (1 << 7), - SWITCH_RTP_FLAG_VAD = (1 << 8) + SWITCH_RTP_FLAG_VAD = (1 << 8), + SWITCH_RTP_FLAG_BREAK = ( 1 << 9) } switch_rtp_flag_t; /*! diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 05894a4cb5..7bae9a7c79 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1568,6 +1568,7 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi if (*msg == '+') { switch_channel_queue_dtmf(channel, msg + 1); switch_set_flag(tech_pvt, TFLAG_DTMF); + switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_BREAK); } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "SESSION MSG [%s]\n", msg); } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 1ac2437271..255296b7be 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -523,7 +523,11 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ bytes = sizeof(rtp_msg_t); status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock, 0, (void *)&rtp_session->recv_msg, &bytes); - + if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK)) { + switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_BREAK); + return 0; + } + if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) { return -1; } @@ -621,6 +625,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void if (bytes < 0) { *datalen = 0; return SWITCH_STATUS_GENERR; + } else if (bytes == 0) { + *datalen = 0; + return SWITCH_STATUS_BREAK; } else { bytes -= rtp_header_len; }