[Freeswitch-svn] [commit] r2368 - in freeswitch/trunk/src: . mod/applications/mod_conference mod/endpoints/mod_exosip mod/languages/mod_spidermonkey

Freeswitch SVN anthm at freeswitch.org
Tue Aug 22 18:34:48 EDT 2006


Author: anthm
Date: Tue Aug 22 18:34:48 2006
New Revision: 2368

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c
   freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
   freeswitch/trunk/src/switch_ivr.c

Log:
working towards stability with new functions

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Tue Aug 22 18:34:48 2006
@@ -1963,6 +1963,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CUSTOM RING\n");
 
 	/* put the channel in a passive state so we can loop audio to it */
+	switch_channel_set_state(channel, CS_TRANSMIT);
 	return SWITCH_STATUS_FALSE;
 }
 
@@ -1999,7 +2000,6 @@
 	} 
 
 
-	switch_core_session_rwunlock(peer_session);
 	peer_channel = switch_core_session_get_channel(peer_session);
 	assert(peer_channel != NULL);
 	

Modified: freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_exosip/mod_exosip.c	Tue Aug 22 18:34:48 2006
@@ -1717,7 +1717,6 @@
 	uint8_t pre_answer = 0;
 
 
-
 	if ((tech_pvt = get_pvt_by_call_id(event->cid)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cannot answer nonexistant call [%d]!\n", event->cid);
 		return;
@@ -1729,7 +1728,6 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "one pre-answer is enough for call [%d]!\n", event->cid);
 			return;
 		}
-		switch_set_flag_locked(tech_pvt, TFLAG_PRE_ANSWER);
 	}
 
 	channel = switch_core_session_get_channel(tech_pvt->session);
@@ -1743,8 +1741,14 @@
 
 	/* Get all of the remote SDP elements... stuff */
 	if ((remote_sdp = eXosip_get_sdp_info(event->response)) == 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant Find SDP?\n");
-		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+		/* Exosip is daft, they send the same event for both 180 and 183 WTF!!*/
+		if (!pre_answer) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cant Find SDP?\n");
+			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "I am daft, don't mind me.\n");
+		}
+		
 		return;
 	}
 
@@ -1767,13 +1771,8 @@
 	tech_pvt->did = event->did;
 	tech_pvt->tid = event->tid;
 
-	if (switch_test_flag(tech_pvt, TFLAG_USING_CODEC)) {
-		switch_core_codec_destroy(&tech_pvt->read_codec);
-		switch_core_codec_destroy(&tech_pvt->write_codec);
-		switch_clear_flag_locked(tech_pvt, TFLAG_USING_CODEC);
-	}
-
-	{
+	if (!switch_test_flag(tech_pvt, TFLAG_USING_CODEC)) {
+	
 		int rate = atoi(drate);
 		int ms = globals.codec_ms;
 
@@ -1842,6 +1841,7 @@
 		channel = switch_core_session_get_channel(tech_pvt->session);
 		assert(channel != NULL);
 		if (pre_answer) {
+			switch_set_flag_locked(tech_pvt, TFLAG_PRE_ANSWER);
 			switch_channel_pre_answer(channel);
 		} else {
 			switch_channel_answer(channel);

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	Tue Aug 22 18:34:48 2006
@@ -1470,8 +1470,6 @@
 			return JS_TRUE;
 		}
 
-		switch_core_session_rwunlock(peer_session);
-
 		jss = switch_core_session_alloc(peer_session, sizeof(*jss));
 		jss->session = peer_session;
 		jss->flags = 0;

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Tue Aug 22 18:34:48 2006
@@ -1189,10 +1189,16 @@
 		goto wbreak;
 	}
 
+	if (!switch_channel_ready(channel)) {
+		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+		goto wbreak;
+	}
+
 	while(switch_channel_ready(channel)) {
 		memset(buf, 0, sizeof(buf));
 
 		if (collect->file) {
+
 			switch_ivr_play_file(collect->session, NULL, collect->file, NULL, NULL, buf, sizeof(buf));
 		} else {
 			switch_ivr_collect_digits_count(collect->session, buf, sizeof(buf), 1, "", &term, 0);
@@ -1244,13 +1250,14 @@
 
 			if (key) {
 				struct key_collect *collect;
-
+				
 				if ((collect = switch_core_session_alloc(peer_sessions[i], sizeof(*collect)))) {
 					switch_channel_set_flag(peer_channels[i], CF_TAGGED);
 					collect->key = key;
 					if (file) {
 						collect->file = switch_core_session_strdup(peer_sessions[i], file);
 					}
+				
 					collect->session = peer_sessions[i];
 					launch_collect_thread(collect);
 				}
@@ -1461,15 +1468,16 @@
 	time(&start);
 
 	for (;;) {
+		uint32_t valid_channels = 0;
 		for (i = 0; i < argc; i++) {
 			int state;
 
 			if (!peer_channels[i]) {
 				continue;
 			}
-
+			valid_channels++;
 			state = switch_channel_get_state(peer_channels[i]);
-
+			
 			if (state >= CS_RING) {
 				goto endfor1;
 			}
@@ -1483,6 +1491,12 @@
 			}
 			switch_yield(1000);
 		}
+
+		if (valid_channels == 0) {
+			status = SWITCH_STATUS_GENERR;
+			goto done;
+		}
+
 	}
  endfor1:
 
@@ -1513,7 +1527,7 @@
 
 	while ((!caller_channel || switch_channel_ready(caller_channel)) && 
 		   check_channel_status(peer_channels, peer_sessions, argc, &idx, file, key) && ((time(NULL) - start) < (time_t)timelimit_sec)) {
-		
+
 		/* read from the channel while we wait if the audio is up on it */
 		if (session && (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA))) {
 			switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);



More information about the Freeswitch-svn mailing list