add intercept_unbridged_only=true to only intercept if the channel is not bridged to anyone

This commit is contained in:
Anthony Minessale 2010-05-05 11:15:09 -05:00
parent a5f7461ee2
commit 58fe45a803
1 changed files with 11 additions and 3 deletions

View File

@ -1466,9 +1466,9 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session
{
switch_core_session_t *rsession, *bsession = NULL;
switch_channel_t *channel, *rchannel, *bchannel = NULL;
const char *buuid;
const char *buuid, *var;
char brto[SWITCH_UUID_FORMATTED_LENGTH + 1] = "";
if (bleg) {
if (switch_ivr_find_bridged_uuid(uuid, brto, sizeof(brto)) == SWITCH_STATUS_SUCCESS) {
uuid = switch_core_session_strdup(session, brto);
@ -1485,10 +1485,18 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session
channel = switch_core_session_get_channel(session);
rchannel = switch_core_session_get_channel(rsession);
buuid = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE);
if ((var = switch_channel_get_variable(channel, "intercept_unbridged_only")) && switch_true(var)) {
if ((switch_channel_test_flag(rchannel, CF_BRIDGED))) {
switch_core_session_rwunlock(rsession);
return;
}
}
switch_channel_pre_answer(channel);
if ((buuid = switch_channel_get_variable(rchannel, SWITCH_SIGNAL_BOND_VARIABLE))) {
if (!zstr(buuid)) {
if ((bsession = switch_core_session_locate(buuid))) {
bchannel = switch_core_session_get_channel(bsession);
}