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
</pre>
*/
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;
/*!
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);
}
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;
}
if (bytes < 0) {
*datalen = 0;
return SWITCH_STATUS_GENERR;
+ } else if (bytes == 0) {
+ *datalen = 0;
+ return SWITCH_STATUS_BREAK;
} else {
bytes -= rtp_header_len;
}