[Freeswitch-svn] [commit] r11082 - freeswitch/trunk/src

FreeSWITCH SVN anthm at freeswitch.org
Tue Jan 6 15:26:49 PST 2009


Author: anthm
Date: Tue Jan  6 17:26:49 2009
New Revision: 11082

Log:
ditto

Modified:
   freeswitch/trunk/src/switch_apr.c
   freeswitch/trunk/src/switch_channel.c
   freeswitch/trunk/src/switch_ivr.c
   freeswitch/trunk/src/switch_ivr_originate.c

Modified: freeswitch/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/trunk/src/switch_apr.c	(original)
+++ freeswitch/trunk/src/switch_apr.c	Tue Jan  6 17:26:49 2009
@@ -761,9 +761,9 @@
 
 SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
 {
-	apr_status_t r;
+	apr_status_t r = SWITCH_STATUS_GENERR;
 
-	if ((r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
+	if (from && sock && (r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
 		from->port = ntohs(from->sa.sin.sin_port);
 		/* from->ipaddr_ptr = &(from->sa.sin.sin_addr);
 		 * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Tue Jan  6 17:26:49 2009
@@ -1647,8 +1647,8 @@
 
 	msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
 	msg.from = channel->name;
-	status = switch_core_session_receive_message(channel->session, &msg);
-
+	status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
+	
 	if (status == SWITCH_STATUS_SUCCESS) {
 		switch_channel_perform_mark_pre_answered(channel, file, func, line);
 	} else {
@@ -1679,7 +1679,7 @@
 
 	msg.message_id = SWITCH_MESSAGE_INDICATE_RINGING;
 	msg.from = channel->name;
-	status = switch_core_session_receive_message(channel->session, &msg);
+	status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
 
 	if (status == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
@@ -1784,7 +1784,7 @@
 
 	msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER;
 	msg.from = channel->name;
-	status = switch_core_session_receive_message(channel->session, &msg);
+	status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
 
 	if (status == SWITCH_STATUS_SUCCESS) {
 		switch_channel_perform_mark_answered(channel, file, func, line);

Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c	(original)
+++ freeswitch/trunk/src/switch_ivr.c	Tue Jan  6 17:26:49 2009
@@ -64,8 +64,7 @@
 
 	media_ready = (switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE));
 	
-
-	if (media_ready && (var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var)) && sval >= 100) {
+	if (ms > 100 && media_ready && (var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) {
 		switch_core_session_get_read_impl(session, &imp);
 		
 		if (switch_core_codec_init(&codec,
@@ -94,6 +93,10 @@
 
 	}
 
+	if (!write_frame.datalen) {
+		sval = 0;
+	}
+
 	cng_frame.data = data;
 	cng_frame.datalen = 2;
 	cng_frame.buflen = 2;
@@ -177,7 +180,7 @@
 			break;
 		}
 
-		if (sval) {
+		if (sval && write_frame.datalen) {
 			switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval);
 			switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
 		} else {

Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c	(original)
+++ freeswitch/trunk/src/switch_ivr_originate.c	Tue Jan  6 17:26:49 2009
@@ -41,7 +41,11 @@
 
 	if (!switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 		while (switch_channel_get_state(channel) == CS_CONSUME_MEDIA && !switch_channel_test_flag(channel, CF_TAGGED)) {
-			switch_ivr_sleep(session, 10, SWITCH_FALSE, NULL);
+			if (!switch_channel_media_ready(channel)) {
+				switch_yield(10000);
+			} else {
+				switch_ivr_sleep(session, 10, SWITCH_FALSE, NULL);
+			}
 		}
 	}
 



More information about the Freeswitch-svn mailing list