[Freeswitch-svn] [commit] r5650 - freeswitch/trunk/src/mod/asr_tts/mod_openmrcp

Freeswitch SVN greenlizard at freeswitch.org
Tue Aug 21 12:48:56 EDT 2007


Author: greenlizard
Date: Tue Aug 21 12:48:56 2007
New Revision: 5650

Modified:
   freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c

Log:
return success from asr_feed when audio_sink hasnt yet been created.  prevents a sporadic seg fault

Modified: freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	Tue Aug 21 12:48:56 2007
@@ -179,7 +179,7 @@
 		openmrcp_session_destroy(openmrcp_session);
 	}
 	else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "abnormal session terminate\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "abnormal session terminate\n");
 	}
 	return MRCP_STATUS_SUCCESS;
 }
@@ -289,6 +289,7 @@
 
 	generic_header = mrcp_generic_header_prepare(mrcp_message);
 	if(!generic_header) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not prepare generic_header\n");
 		return MRCP_STATUS_FAILURE;
 	}
 
@@ -390,7 +391,15 @@
 	media_frame.codec_frame.buffer = data;
 	while(len >= media_frame.codec_frame.size) {
 		if (!audio_sink) {
-			return SWITCH_STATUS_GENERR;
+			/*!
+			  If there is no audio_sink established yet, discard the audio and
+			  return SUCCESS.  returning anything other than success causes freeswitch
+			  to abort the call and tear down the channel.  One reason there might
+			  not be an audio sink is that the openmrcp client lib is still in the startup
+			  process.  
+			*/
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!audio_sink\n");
+			return SWITCH_STATUS_SUCCESS;  
 		}
 		audio_sink->method_set->write_frame(audio_sink,&media_frame);
 		
@@ -445,7 +454,7 @@
 
 	// terminate client session
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Going to TERMINATE SESSION\n");
-	switch_set_flag_locked(asr_session, FLAG_TERMINATING);
+	switch_set_flag_locked(asr_session, FLAG_TERMINATING);  
 	mrcp_client_context_session_terminate(context, asr_session->client_session);
 	
 	switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
@@ -661,7 +670,7 @@
 	}
 
 	if (!switch_test_flag(tts_session, FLAG_FEED_STARTED)) {
-		switch_set_flag(tts_session, FLAG_FEED_STARTED);
+		switch_set_flag(tts_session, FLAG_FEED_STARTED);  // shouldn't this use set_flag_locked? -tl
 		if(audio_source->method_set->open) {
 			audio_source->method_set->open(audio_source);
 		}



More information about the Freeswitch-svn mailing list