SWITCH_VAD_FLAG_TALKING - Currently Talking
SWITCH_VAD_FLAG_EVENTS_TALK - Fire events when talking is detected
SWITCH_VAD_FLAG_EVENTS_NOTALK - Fire events when not talking is detected
+ SWITCH_VAD_FLAG_CNG - Send CNG
</pre>
*/
typedef enum {
SWITCH_VAD_FLAG_TALKING = ( 1 << 0 ),
SWITCH_VAD_FLAG_EVENTS_TALK = ( 1 << 1 ),
SWITCH_VAD_FLAG_EVENTS_NOTALK = ( 1 << 2 ),
+ SWITCH_VAD_FLAG_CNG = ( 1 << 3)
} switch_vad_flag_t;
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_BRIDGE:
if (tech_pvt->rtp_session) {
- //switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
- switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
+ switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n");
+ //switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
}
break;
case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
if (tech_pvt->rtp_session) {
- //switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
- //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
- switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
+ switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER);
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n");
+ //switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK);
}
break;
default:
if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING)) {
send = 1;
} else {
- if (++rtp_session->vad_data.cng_count >= rtp_session->vad_data.cng_freq) {
+ if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_CNG) && ++rtp_session->vad_data.cng_count >= rtp_session->vad_data.cng_freq) {
rtp_session->send_msg.header.pt = SWITCH_RTP_CNG_PAYLOAD;
memset(rtp_session->send_msg.body, 255, SWITCH_RTP_CNG_PAYLOAD);
//rtp_session->send_msg.header.ts = htonl(rtp_session->vad_data.ts);