From 2bc28110507627af82b619c318aa940532f394a0 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Thu, 17 Apr 2014 02:41:40 +0500
Subject: [PATCH] FS-5997 regression from commit
 70accd9f272472ac2081283f1927d901b409acb6 this caused some attended transfers
 to calls with multiple targets to get the abondoned channels to be stuck on
 write lock

---
 src/switch_ivr_originate.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c
index 07e8057893..317647efff 100644
--- a/src/switch_ivr_originate.c
+++ b/src/switch_ivr_originate.c
@@ -3689,7 +3689,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 					if (oglobals.idx == IDX_XFER) {
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG,
 										  "Originate Resulted in Attended Transfer Cause: %d [%s]\n", *cause, switch_channel_cause2str(*cause));
-						goto outer_for;
 					} else {
 
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG,
@@ -3788,7 +3787,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
 				switch_core_session_rwunlock(originate_status[i].peer_session);
 			}
 
-			if (status == SWITCH_STATUS_SUCCESS) {
+			if (status == SWITCH_STATUS_SUCCESS || oglobals.idx == IDX_XFER) {
 				goto outer_for;
 			} else {
 				int ok = 1;