allow calls to be stolen from originate

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10328 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2008-11-11 14:26:21 +00:00
parent 4549a90d63
commit 1af037cf58
1 changed files with 7 additions and 2 deletions

View File

@ -1638,16 +1638,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} }
for (i = 0; i < and_argc; i++) { for (i = 0; i < and_argc; i++) {
switch_channel_state_t state;
if (!peer_channels[i]) { if (!peer_channels[i]) {
continue; continue;
} }
switch_channel_clear_flag(peer_channels[i], CF_ORIGINATING); switch_channel_clear_flag(peer_channels[i], CF_ORIGINATING);
if (status == SWITCH_STATUS_SUCCESS) { if (status == SWITCH_STATUS_SUCCESS) {
if (bleg && *bleg && *bleg == peer_sessions[i]) { if (bleg && *bleg && *bleg == peer_sessions[i]) {
continue; continue;
} }
} else if (switch_channel_get_state(switch_core_session_get_channel(peer_sessions[i])) < CS_HANGUP) { } else if ((state=switch_channel_get_state(peer_channels[i])) < CS_HANGUP) {
switch_channel_hangup(switch_core_session_get_channel(peer_sessions[i]), *cause); if (!(state == CS_RESET || switch_channel_test_flag(peer_channels[i], CF_TRANSFER))) {
switch_channel_hangup(peer_channels[i], *cause);
}
} }
switch_core_session_rwunlock(peer_sessions[i]); switch_core_session_rwunlock(peer_sessions[i]);