}
+ for (i = 0; i < len; i++) {
+ if (switch_channel_test_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP)) {
+ const char *key = switch_channel_get_variable(originate_status[i].peer_channel, "channel_swap_uuid");
+ switch_core_session_t *swap_session, *old_session;
+
+ if ((swap_session = switch_core_session_locate(key))) {
+ switch_channel_clear_flag(originate_status[i].peer_channel, CF_CHANNEL_SWAP);
+ switch_channel_hangup(originate_status[i].peer_channel, SWITCH_CAUSE_PICKED_OFF);
+
+ switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(originate_status[i].peer_channel), SWITCH_LOG_DEBUG, "Swapping %s for %s\n",
+ switch_core_session_get_name(swap_session), switch_channel_get_name(originate_status[i].peer_channel));
+
+
+ old_session = originate_status[i].peer_session;
+ originate_status[i].peer_session = swap_session;
+ originate_status[i].peer_channel = switch_core_session_get_channel(originate_status[i].peer_session);
+ originate_status[i].caller_profile = switch_channel_get_caller_profile(originate_status[i].peer_channel);
+ switch_channel_set_flag(originate_status[i].peer_channel, CF_ORIGINATING);
+
+ switch_channel_answer(originate_status[i].peer_channel);
+ switch_core_session_rwunlock(old_session);
+ break;
+ }
+ }
+ }
+
for (i = 0; i < len; i++) {
switch_channel_state_t state;
switch_channel_set_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL);
}
- if (holding && oglobals.idx != IDX_TIMEOUT && oglobals.idx != IDX_KEY_CANCEL) {
+ if (holding && oglobals.idx != IDX_TIMEOUT && oglobals.idx != IDX_KEY_CANCEL && oglobals.idx < 0) {
switch_core_session_t *holding_session;
if ((holding_session = switch_core_session_locate(holding))) {
switch_core_session_rwunlock(holding_session);
}
switch_channel_set_flag(originate_status[i].peer_channel, CF_LAZY_ATTENDED_TRANSFER);
-
switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(originate_status[i].peer_session));
holding = NULL;
} else {
if (*bleg) {
switch_channel_t *bchan = switch_core_session_get_channel(*bleg);
-
- if (switch_channel_test_flag(bchan, CF_CHANNEL_SWAP)) {
- const char *key = switch_channel_get_variable(bchan, "channel_swap_uuid");
- switch_core_session_t *swap_session, *old_session;
-
- if ((swap_session = switch_core_session_locate(key))) {
- switch_channel_clear_flag(bchan, CF_CHANNEL_SWAP);
- switch_channel_hangup(bchan, SWITCH_CAUSE_PICKED_OFF);
-
- switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(bchan), SWITCH_LOG_DEBUG, "Swapping %s for %s\n",
- switch_core_session_get_name(swap_session), switch_channel_get_name(bchan));
-
- old_session = *bleg;
- *bleg = swap_session;
- bchan = switch_core_session_get_channel(*bleg);
- switch_channel_answer(bchan);
- switch_core_session_rwunlock(old_session);
- }
- }
-
-
if (session && caller_channel) {
switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg));