From d1506e07cbab95bec5c4c9186439255c42d65ff6 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 15 Dec 2011 14:44:25 -0500 Subject: [PATCH] FS-2008 --resolve --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- src/switch_rtp.c | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index b46210dc15..ed16ce0a8a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3291,7 +3291,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs | tech_pvt->profile->manual_rtp_bugs); if ((vad_in && inb) || (vad_out && !inb)) { - switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING); + switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING | SWITCH_VAD_FLAG_EVENTS_TALK | SWITCH_VAD_FLAG_EVENTS_NOTALK); sofia_set_flag(tech_pvt, TFLAG_VAD); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "AUDIO RTP Engage VAD for %s ( %s %s )\n", switch_channel_get_name(switch_core_session_get_channel(tech_pvt->session)), vad_in ? "in" : "", vad_out ? "out" : ""); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 38e4019d56..99ae2e8edc 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -3772,10 +3772,13 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0; if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_TALK)) { - switch_event_t *event; - if (switch_event_create(&event, SWITCH_EVENT_TALK) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(switch_core_session_get_channel(rtp_session->vad_data.session), event); - switch_event_fire(&event); + const char *val = switch_channel_get_variable(switch_core_session_get_channel(rtp_session->vad_data.session), "fire_talk_events"); + if (val && switch_true(val)) { + switch_event_t *event; + if (switch_event_create(&event, SWITCH_EVENT_TALK) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(switch_core_session_get_channel(rtp_session->vad_data.session), event); + switch_event_fire(&event); + } } } } @@ -3788,10 +3791,13 @@ static int rtp_common_write(switch_rtp_t *rtp_session, switch_clear_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_TALKING); rtp_session->vad_data.hangover_hits = rtp_session->vad_data.hangunder_hits = rtp_session->vad_data.cng_count = 0; if (switch_test_flag(&rtp_session->vad_data, SWITCH_VAD_FLAG_EVENTS_NOTALK)) { - switch_event_t *event; - if (switch_event_create(&event, SWITCH_EVENT_NOTALK) == SWITCH_STATUS_SUCCESS) { - switch_channel_event_set_data(switch_core_session_get_channel(rtp_session->vad_data.session), event); - switch_event_fire(&event); + const char *val = switch_channel_get_variable(switch_core_session_get_channel(rtp_session->vad_data.session), "fire_notalk_events"); + if (val && switch_true(val)) { + switch_event_t *event; + if (switch_event_create(&event, SWITCH_EVENT_NOTALK) == SWITCH_STATUS_SUCCESS) { + switch_channel_event_set_data(switch_core_session_get_channel(rtp_session->vad_data.session), event); + switch_event_fire(&event); + } } } }