[Freeswitch-branches] [commit] r5586 - freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp

Freeswitch SVN greenlizard at freeswitch.org
Fri Aug 10 21:56:34 EDT 2007


Author: greenlizard
Date: Fri Aug 10 21:56:34 2007
New Revision: 5586

Modified:
   freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/Makefile
   freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c

Log:
removed all compiler warnings emanating from mod_openmrcp.c, though there are still a few remaining that are coming from the library

Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/Makefile
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/Makefile	(original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/Makefile	Fri Aug 10 21:56:34 2007
@@ -13,13 +13,18 @@
 # - needs to compile/link against the _freeswitch_ sofia libs (see FIXME)
 # - is there an openmrcp dir in the fs tree yet?  (see FIXME)
 
-# FIXME!!!  
+# FIXME!!!  Should this download and build openmrcp?  What's the plan?
+# NOTE: currently only works with trunk revision 367.  On trunk revision 440
+# there is a segfault when server loads.
 OPENMRCP_DIR=/usr/src/openmrcp_stable
 
 OPENMRCP_INCLUDE=-I$(OPENMRCP_DIR)/mrcpcore/client/include/ -I$(OPENMRCP_DIR)/platform/openmrcpclient/include/ -I$(OPENMRCP_DIR)/mediaframe/include/ -I$(OPENMRCP_DIR)/mrcpcore/engine/include/ -I$(OPENMRCP_DIR)/mrcpcore/include/ -I$(OPENMRCP_DIR)/mrcpcore/parser/include/ -I$(OPENMRCP_DIR)/mrcpcore/server/include/ -I$(OPENMRCP_DIR)/mrcpcore/media/include/ -I$(OPENMRCP_DIR)/mrcpcore/util/include -I$(OPENMRCP_DIR)/mrcpcore/resource/include/
 
-OPENMRCP_LIBS=$(OPENMRCP_DIR)/platform/openmrcpclient/.libs/libopenmrcpclient.a $(OPENMRCP_DIR)/platform/openmrcpserver/.libs/libopenmrcpserver.a $(OPENMRCP_DIR)/mrcpcore/client/.libs/libmrcpclient.a $(OPENMRCP_DIR)/mediaframe/.libs/libmediaframe.a $(OPENMRCP_DIR)/mrcpcore/engine/.libs/libmrcpengine.a $(OPENMRCP_DIR)/mrcpcore/parser/.libs/libmrcpparser.a $(OPENMRCP_DIR)/mrcpcore/server/.libs/libmrcpserver.a $(OPENMRCP_DIR)/mrcpcore/media/.libs/libmrcpmedia.a $(OPENMRCP_DIR)/mrcpcore/util/.libs/libmrcputil.a $(OPENMRCP_DIR)/mrcpcore/util/.libs/libmrcputil.a $(OPENMRCP_DIR)/mrcpcore/resource/.libs/libmrcpresource.a $(OPENMRCP_DIR)/module/plugin/demo/.libs/libdemoplugin.a $(OPENMRCP_DIR)/module/mrcpv2agent/.libs/libmrcpv2agent.a $(OPENMRCP_DIR)/module/mrcplivemedia/.libs/libmrcplivemedia.a $(OPENMRCP_DIR)/module/mrcpsofiasip/.libs/libmrcpsofiasip.a $(OPENMRCP_DIR)/mrcpcore/.libs/libmrcpcore.a 
+OPENMRCP_LIBS_TRUNK=$(OPENMRCP_DIR)/platform/openmrcpclient/.libs/libopenmrcpclient.a $(OPENMRCP_DIR)/platform/openmrcpserver/.libs/libopenmrcpserver.a $(OPENMRCP_DIR)/mrcpcore/client/.libs/libmrcpclient.a $(OPENMRCP_DIR)/mediaframe/.libs/libmediaframe.a $(OPENMRCP_DIR)/mrcpcore/engine/.libs/libmrcpengine.a $(OPENMRCP_DIR)/mrcpcore/parser/.libs/libmrcpparser.a $(OPENMRCP_DIR)/mrcpcore/server/.libs/libmrcpserver.a $(OPENMRCP_DIR)/mrcpcore/media/.libs/libmrcpmedia.a $(OPENMRCP_DIR)/mrcpcore/util/.libs/libmrcputil.a $(OPENMRCP_DIR)/mrcpcore/util/.libs/libmrcputil.a $(OPENMRCP_DIR)/mrcpcore/resource/.libs/libmrcpresource.a $(OPENMRCP_DIR)/module/plugin/demo/.libs/libdemoplugin.a $(OPENMRCP_DIR)/module/mrcpv2agent/.libs/libmrcpv2agent.a $(OPENMRCP_DIR)/module/mrcpmediaframe/.libs/libmrcpmediaframe.a $(OPENMRCP_DIR)/module/mrcpsofiasip/.libs/libmrcpsofiasip.a $(OPENMRCP_DIR)/mrcpcore/.libs/libmrcpcore.a
 
+OPENMRCP_LIBS_STABLE=$(OPENMRCP_DIR)/platform/openmrcpclient/.libs/libopenmrcpclient.a $(OPENMRCP_DIR)/platform/openmrcpserver/.libs/libopenmrcpserver.a $(OPENMRCP_DIR)/mrcpcore/client/.libs/libmrcpclient.a $(OPENMRCP_DIR)/mediaframe/.libs/libmediaframe.a $(OPENMRCP_DIR)/mrcpcore/engine/.libs/libmrcpengine.a $(OPENMRCP_DIR)/mrcpcore/parser/.libs/libmrcpparser.a $(OPENMRCP_DIR)/mrcpcore/server/.libs/libmrcpserver.a $(OPENMRCP_DIR)/mrcpcore/media/.libs/libmrcpmedia.a $(OPENMRCP_DIR)/mrcpcore/util/.libs/libmrcputil.a $(OPENMRCP_DIR)/mrcpcore/util/.libs/libmrcputil.a $(OPENMRCP_DIR)/mrcpcore/resource/.libs/libmrcpresource.a $(OPENMRCP_DIR)/module/plugin/demo/.libs/libdemoplugin.a $(OPENMRCP_DIR)/module/mrcpv2agent/.libs/libmrcpv2agent.a $(OPENMRCP_DIR)/module/mrcplivemedia/.libs/libmrcplivemedia.a $(OPENMRCP_DIR)/module/mrcpsofiasip/.libs/libmrcpsofiasip.a $(OPENMRCP_DIR)/mrcpcore/.libs/libmrcpcore.a
+
+OPENMRCP_LIBS=$(OPENMRCP_LIBS_STABLE)
 MRCP_APR_INCLUDES =  -I../../../../libs/apr/include
 MRCP_APU_INCLUDES =  -I../../../../libs/apr-util/include
 MRCP_SOFIA_INCLUDES = -I/usr/local/include/sofia-sip-1.12  # FIXME!!

Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c	Fri Aug 10 21:56:34 2007
@@ -95,7 +95,7 @@
 	"CHANNEL_MODIFY",
 };
 
-// TODO: rename this to openmrcp_session_t 
+// TODO: rename this to mod_openmrcp_session_t 
 typedef struct openmrcp_session_t openmrcp_session_t;
 struct openmrcp_session_t {
 	mrcp_session_t        *client_session;
@@ -134,22 +134,6 @@
 
 static openmrcp_module_t openmrcp_module;
 
-static void log_callback(const char* message, void* userdata)
-{
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s\n", message);
-}
-
-static const char *state_names[] = {
-	"NOT_READY",
-	"READY",
-	"BARGE_IN",
-	"END_SPEECH",
-	"STOPPED",
-	"BARGE_IN_TIMEOUT",
-	"END_SPEECH_TIMEOUT",
-	"BEEP"
-};
-
 static openmrcp_session_t* openmrcp_session_create()
 {
 	openmrcp_session_t *openmrcp_session;
@@ -200,13 +184,12 @@
 
 static mrcp_status_t openmrcp_session_wait_for_event(openmrcp_session_t *openmrcp_session, openmrcp_event_t openmrcp_event, size_t timeout)
 {
-	mrcp_status_t status = MRCP_STATUS_SUCCESS;
+
 	openmrcp_event_t *popped_event = NULL;
 	size_t sleep_ms = 100;
 
-
 	if(openmrcp_session->event_queue) {
-		if (switch_queue_trypop(openmrcp_session->event_queue, &popped_event)) {
+		if (switch_queue_trypop(openmrcp_session->event_queue, (void *) &popped_event)) {
 			// most likely this failed because queue is empty.  sleep for timeout seconds and try again?
 			if (timeout > 0) {
 				if (timeout < sleep_ms) {
@@ -337,9 +320,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "!openmrcp_session\n");
 		return MRCP_STATUS_FAILURE;
 	}
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "openmrcp_session: %p\n", openmrcp_session);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "mrcp msg method name: %s\n", mrcp_message->start_line.method_name);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "mrcp msg body: %s\n", mrcp_message->body);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mrcp msg body: %s\n", mrcp_message->body);
 
 	if (!strcmp(mrcp_message->start_line.method_name,"RECOGNITION-COMPLETE")) {
 		openmrcp_session->mrcp_message_last_rcvd = mrcp_message;
@@ -388,7 +369,7 @@
 
 	/* pop next media frame data from incoming queue into frame */
 	if(openmrcp_session->audio_input_queue) {
-		if (switch_queue_trypop(openmrcp_session->audio_input_queue, &queue_frame)) {
+		if (switch_queue_trypop(openmrcp_session->audio_input_queue, (void *) &queue_frame)) {
 			// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "could not pop from queue\n");
 			result = MRCP_STATUS_FAILURE;
 		}
@@ -418,7 +399,7 @@
 	apr_pool_t *mp;
 	apr_finfo_t finfo;
 	char *buf1;
-	int bytes2read = 0;
+	apr_size_t bytes2read = 0;
 	
 	mrcp_message_t *mrcp_message = mrcp_client_context_message_get(context, openmrcp_session->client_session, openmrcp_session->channel, RECOGNIZER_RECOGNIZE);
 
@@ -463,9 +444,7 @@
  */
 static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags) 
 {
-	mrcp_client_t *mrcp_client = openmrcp_module.mrcp_client;
 	mrcp_client_context_t *mrcp_client_context = openmrcp_module.mrcp_client_context ;
-	openmrcp_client_options_t *options;
 	openmrcp_session_t *openmrcp_session;
 	audio_source_t *source;
 	
@@ -548,7 +527,6 @@
 	*/
 	
 	openmrcp_session_t *openmrcp_session = (openmrcp_session_t *) ah->private_info;
-	mrcp_client_t *mrcp_client = openmrcp_module.mrcp_client;
 	mrcp_client_context_t *mrcp_client_context = openmrcp_module.mrcp_client_context;
 	audio_source_t *source = openmrcp_session->source;
 		
@@ -594,8 +572,6 @@
 {
 
 	openmrcp_session_t *openmrcp_session = (openmrcp_session_t *) ah->private_info;
-	mrcp_client_t *mrcp_client = openmrcp_module.mrcp_client;
-	mrcp_client_context_t *mrcp_client_context = openmrcp_module.mrcp_client_context;
 	media_frame_t *media_frame;
 	switch_byte_t *buffer;
 	
@@ -637,7 +613,7 @@
 
 static switch_status_t openmrcp_asr_pause(switch_asr_handle_t *ah)
 {
-	openmrcp_session_t *openmrcp_session = (openmrcp_session_t *) ah->private_info;
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_pause called\n");
 
 	return SWITCH_STATUS_SUCCESS;
@@ -646,7 +622,7 @@
 
 static switch_status_t openmrcp_asr_resume(switch_asr_handle_t *ah)
 {
-	openmrcp_session_t *openmrcp_session = (openmrcp_session_t *) ah->private_info;
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "openmrcp_asr_resume called\n");
 
 	return SWITCH_STATUS_SUCCESS;
@@ -656,7 +632,6 @@
 /*! function to unload a grammar to the asr interface */
 static switch_status_t openmrcp_asr_unload_grammar(switch_asr_handle_t *ah, char *grammar)
 {
-	openmrcp_session_t *openmrcp_session = (openmrcp_session_t *) ah->private_info;
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -671,7 +646,6 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_asr_close()\n");
 
-	mrcp_client_t *mrcp_client = openmrcp_module.mrcp_client;
 	mrcp_client_context_t *context = openmrcp_module.mrcp_client_context;
 
 	// TODO!! should we do a switch_pool_clear(switch_memory_pool_t *p) on the pool held
@@ -679,7 +653,7 @@
 
 	// destroy channel
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Going to DESTROY CHANNEL\n");
-	mrcp_client_context_channel_destroy(context, openmrcp_session->client_session, 1);
+	mrcp_client_context_channel_destroy(context, openmrcp_session->client_session, openmrcp_session->channel);
 	if (openmrcp_session_wait_for_event(openmrcp_session,OPENMRCP_EVENT_CHANNEL_DESTROY,10000) == MRCP_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "OPENMRCP_EVENT_CHANNEL_DESTROY received\n");
 	}
@@ -824,7 +798,6 @@
 				globals.client_ip = val;
 			} else if (!strcasecmp(var, "server_ip")) {
 				globals.server_ip = val;
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "globals.server_ip: %s\n", globals.server_ip);
 			} else if (!strcasecmp(var, "client_port")) {
 				globals.client_port = (uint32_t) atoi(val);
 			} else if (!strcasecmp(var, "server_port")) {



More information about the Freeswitch-branches mailing list