From 403bf6af1c4f0a86424a2f433592f920e3b1c033 Mon Sep 17 00:00:00 2001
From: Anthony Minessale <anthm@freeswitch.org>
Date: Mon, 13 Sep 2010 10:57:52 -0500
Subject: [PATCH] make sure hold-related code is skipped 100% with disable-hold
 set

---
 src/mod/endpoints/mod_sofia/sofia_glue.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c
index 8054c8df73..3dd830937a 100644
--- a/src/mod/endpoints/mod_sofia/sofia_glue.c
+++ b/src/mod/endpoints/mod_sofia/sofia_glue.c
@@ -3590,11 +3590,12 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s
 	if (sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_HOLD) ||
 		((val = switch_channel_get_variable(tech_pvt->channel, "sip_disable_hold")) && switch_true(val))) {
 		sendonly = 0;
-	}
+	} else {
 
-	if (!tech_pvt->hold_laps) {
-		tech_pvt->hold_laps++;
-		sofia_glue_toggle_hold(tech_pvt, sendonly);
+		if (!tech_pvt->hold_laps) {
+			tech_pvt->hold_laps++;
+			sofia_glue_toggle_hold(tech_pvt, sendonly);
+		}
 	}
 
 	for (m = sdp->sdp_media; m; m = m->m_next) {