[Freeswitch-svn] [commit] r13162 - freeswitch/trunk/src/mod/endpoints/mod_loopback

FreeSWITCH SVN anthm at freeswitch.org
Mon Apr 27 07:15:55 PDT 2009


Author: anthm
Date: Mon Apr 27 09:15:55 2009
New Revision: 13162

Log:
add loopback_bowout variable (set to false to skip auto-bowout)

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c

Modified: freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c	Mon Apr 27 09:15:55 2009
@@ -640,21 +640,27 @@
 		) {
 		const char *a_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
 		const char *b_uuid = switch_channel_get_variable(tech_pvt->other_channel, SWITCH_SIGNAL_BOND_VARIABLE);
-				
+		const char *vetoa, *vetob;
+
 		switch_set_flag_locked(tech_pvt, TFLAG_BOWOUT);
 		switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_BOWOUT);
+
+		vetoa = switch_channel_get_variable(tech_pvt->channel, "loopback_bowout");
+		vetob = switch_channel_get_variable(tech_pvt->other_tech_pvt->channel, "loopback_bowout");
+		
+		if ((!vetoa || switch_true(vetoa)) && (!vetob || switch_true(vetob))) {
+			switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
+			switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
+			
+			if (a_uuid && b_uuid) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+								  "%s detected bridge on both ends, attempting direct connection.\n", switch_channel_get_name(channel));
 				
-		switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
-		switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
-				
-		if (a_uuid && b_uuid) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
-							  "%s detected bridge on both ends, attempting direct connection.\n", switch_channel_get_name(channel));
-
-			/* channel_masquerade eat your heart out....... */
-			switch_ivr_uuid_bridge(a_uuid, b_uuid);
-			switch_mutex_unlock(tech_pvt->mutex);
-			return SWITCH_STATUS_SUCCESS;
+				/* channel_masquerade eat your heart out....... */
+				switch_ivr_uuid_bridge(a_uuid, b_uuid);
+				switch_mutex_unlock(tech_pvt->mutex);
+				return SWITCH_STATUS_SUCCESS;
+			}
 		}
 	}
 
@@ -675,9 +681,10 @@
 			if (switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone) != SWITCH_STATUS_SUCCESS) {
 				switch_frame_free(&clone);
 			}
+
+			switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
 		}
 		
-		switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
 		status = SWITCH_STATUS_SUCCESS;
 	}
 



More information about the Freeswitch-svn mailing list