make bridge_terminate_key work in bypass media when using info dtmf

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@16530 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2010-01-28 17:10:23 +00:00
parent 6a939c199a
commit 96a00113aa
2 changed files with 45 additions and 3 deletions

View File

@ -2439,8 +2439,8 @@ SWITCH_STANDARD_APP(audio_bridge_function)
if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) {
switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
}
switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, b_key);
}
if (peer_session) {

View File

@ -803,12 +803,49 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
return SWITCH_STATUS_FALSE;
}
static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session)
static switch_status_t sb_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
switch_channel_t *channel = NULL;
char *key;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
if ((key = (char *) switch_channel_get_private(channel, "__bridge_term_key")) && dtmf->digit == *key) {
const char *uuid;
switch_core_session_t *other_session;
if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
switch_channel_set_state(channel, CS_EXECUTE);
} else {
if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
switch_channel_set_state(other_channel, CS_EXECUTE);
switch_core_session_rwunlock(other_session);
} else {
return SWITCH_STATUS_SUCCESS;
}
}
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_SUCCESS;
}
static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
const char *key;
channel = switch_core_session_get_channel(session);
switch_assert(channel != NULL);
if ((key = switch_channel_get_variable(channel, "bridge_terminate_key"))) {
switch_channel_set_private(channel, "__bridge_term_key", switch_core_session_strdup(session, key));
switch_core_event_hook_add_recv_dtmf(session, sb_on_dtmf);
}
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
@ -826,6 +863,11 @@ static switch_status_t signal_bridge_on_hangup(switch_core_session_t *session)
switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
}
if (switch_channel_get_private(channel, "__bridge_term_key")) {
switch_core_event_hook_remove_recv_dtmf(session, sb_on_dtmf);
switch_channel_set_private(channel, "__bridge_term_key", NULL);
}
switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
if (uuid && (other_session = switch_core_session_locate(uuid))) {