[Freeswitch-svn] [commit] r7103 - in freeswitch/trunk/src: . include mod/applications/mod_dptools mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Sat Jan 5 17:17:26 EST 2008


Author: anthm
Date: Sat Jan  5 17:17:26 2008
New Revision: 7103

Modified:
   freeswitch/trunk/src/include/switch_channel.h
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_ivr_bridge.c

Log:
update

Modified: freeswitch/trunk/src/include/switch_channel.h
==============================================================================
--- freeswitch/trunk/src/include/switch_channel.h	(original)
+++ freeswitch/trunk/src/include/switch_channel.h	Sat Jan  5 17:17:26 2008
@@ -75,7 +75,7 @@
 SWITCH_DECLARE(uint8_t) switch_channel_ready(switch_channel_t *channel);
 
 SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
-SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, uint32_t to);
+SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint32_t to);
 
 SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_channel_t *channel,
 																		const char *file, const char *func, int line, switch_channel_state_t state);

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Sat Jan  5 17:17:26 2008
@@ -1273,11 +1273,11 @@
 	if (l) {
 		if (*l == '+') {
 			l++;
-			if (l) {
-				limit = atoi(l);
-				if (limit < 0) {
-					limit = 0;
-				}
+		}
+		if (l) {
+			limit = atoi(l);
+			if (limit < 0) {
+				limit = 0;
 			}
 		}
 	}

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Sat Jan  5 17:17:26 2008
@@ -252,11 +252,29 @@
 	cause = switch_channel_get_cause(channel);
 
 	if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD) && cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
+		const char *buuid;
+        switch_core_session_t *bsession;
+        switch_channel_t *bchannel;
+        const char *lost_ext;
 
 		if (tech_pvt->max_missed_packets) {
 			switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 		}
 		switch_channel_presence(tech_pvt->channel, "unknown", "unhold");
+
+		if ((buuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+            if ((bsession = switch_core_session_locate(buuid))) {
+                bchannel = switch_core_session_get_channel(bsession);
+                if (switch_channel_test_flag(bchannel, CF_BROADCAST)) {
+                    if ((lost_ext = switch_channel_get_variable(bchannel, "left_hanging_extension"))) {
+                        switch_ivr_session_transfer(bsession, lost_ext, NULL, NULL);
+                    }
+					switch_channel_stop_broadcast(bchannel);
+                }
+                switch_core_session_rwunlock(bsession);
+            }
+        }
+
 		switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 		
 	}

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Sat Jan  5 17:17:26 2008
@@ -1395,24 +1395,35 @@
 			}
 
 			if (stream) {
-				switch_ivr_displace_session(tech_pvt->session, stream, 0, "rl");
+				//switch_ivr_displace_session(tech_pvt->session, stream, 0, "rl");
+				switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream, SMF_ECHO_ALEG | SMF_LOOP);
 			}
 		}
 	} else {
 		if (switch_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
-			const char *stream;
+			const char *uuid;
+			switch_core_session_t *b_session;
+			
+			//const char *stream;
 
 			if (tech_pvt->max_missed_packets) {
 				switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 			}
 
-			if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
-                stream = tech_pvt->profile->hold_music;
-            }
+			if ((uuid = switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (b_session = switch_core_session_locate(uuid))) {
+				switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
+				switch_channel_stop_broadcast(b_channel);
+				switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 2000);
+				switch_core_session_rwunlock(b_session);
+			}
 
-			if (stream) {
-                switch_ivr_stop_displace_session(tech_pvt->session, stream);
-            }
+			//if (!(stream = switch_channel_get_variable(tech_pvt->channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+			//stream = tech_pvt->profile->hold_music;
+            //}
+
+			//if (stream) {
+			//switch_ivr_stop_displace_session(tech_pvt->session, stream);
+			//}
 
 			switch_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 			switch_channel_presence(tech_pvt->channel, "unknown", "unhold");

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Sat Jan  5 17:17:26 2008
@@ -550,14 +550,24 @@
 	}
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, uint32_t to)
+SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint32_t to)
 {
 
 	if (to) {
 		to++;
 	}
 
-	while(!switch_test_flag(channel, want_flag)) {
+	for(;;) {
+		if (pres) {
+			if (switch_test_flag(channel, want_flag)) {
+				break;
+			}
+		} else {
+			if (!switch_test_flag(channel, want_flag)) {
+				break;
+			}
+		}
+
 		switch_yield(1000);
 		if (to && !--to) {
 			return SWITCH_STATUS_TIMEOUT;

Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c	(original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c	Sat Jan  5 17:17:26 2008
@@ -222,7 +222,6 @@
  end:
 
 	switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
-	switch_channel_stop_broadcast(chan_b);
 	switch_core_session_reset(session_a);
 	switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));



More information about the Freeswitch-svn mailing list