From 0559cc50da3dd8e7aa74eb6276e732c08d6cf8b9 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Wed, 13 Oct 2010 20:23:55 -0500
Subject: [PATCH] fix att_xfer reported by woody dickson on the mailing list

---
 src/switch_ivr_async.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c
index 7cda473565..b8c8a69204 100644
--- a/src/switch_ivr_async.c
+++ b/src/switch_ivr_async.c
@@ -1066,11 +1066,17 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
 		switch_core_session_message_t msg = { 0 };
 		char cid_buf[1024] = "";
 		switch_caller_profile_t *cp = NULL;
+		uint32_t sanity = 600;
 
 		if (!switch_channel_media_ready(channel)) {
 			goto end;
 		}
 
+		while(switch_channel_state_change_pending(tchannel)) {
+			switch_yield(10000);
+			if (!--sanity) break;
+		}
+
 		if (!switch_channel_media_ready(tchannel)) {
 			goto end;
 		}