[Freeswitch-branches] [commit] r5641 - in freeswitch/branches/greenlizard/src: . mod/asr_tts/mod_openmrcp mod/timers/mod_softtimer

Freeswitch SVN greenlizard at freeswitch.org
Mon Aug 20 18:01:14 EDT 2007


Author: greenlizard
Date: Mon Aug 20 18:01:13 2007
New Revision: 5641

Modified:
   freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
   freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c
   freeswitch/branches/greenlizard/src/switch_loadable_module.c

Log:
merge trunk 5627:5639

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	Mon Aug 20 18:01:13 2007
@@ -99,7 +99,8 @@
 	FLAG_BARGE =          (1 << 1),
 	FLAG_READY =          (1 << 2),
 	FLAG_SPEAK_COMPLETE = (1 << 3),
-	FLAG_FEED_STARTED =   (1 << 4)
+	FLAG_FEED_STARTED =   (1 << 4),
+	FLAG_TERMINATING =    (1 << 5)
 } mrcp_flag_t;
 
 typedef struct {
@@ -173,7 +174,13 @@
 	if(!openmrcp_session) {
 		return MRCP_STATUS_FAILURE;
 	}
-	openmrcp_session_destroy(openmrcp_session);
+
+	if (switch_test_flag(openmrcp_session, FLAG_TERMINATING)) {
+		openmrcp_session_destroy(openmrcp_session);
+	}
+	else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "abnormal session terminate\n");
+	}
 	return MRCP_STATUS_SUCCESS;
 }
 
@@ -436,6 +443,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);
 	mrcp_client_context_session_terminate(context, asr_session->client_session);
 	
 	switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
@@ -487,15 +495,21 @@
           </result>
 		*/
 
-		char *marker = "?>";  // FIXME -- lame and brittle way of doing this.  use regex or better.
-		char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
-		if (!position) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", asr_session->mrcp_message_last_rcvd->body);
-			ret = SWITCH_STATUS_FALSE;
+		if(asr_session->mrcp_message_last_rcvd && asr_session->mrcp_message_last_rcvd->body) {
+			char *marker = "?>";  // FIXME -- lame and brittle way of doing this.  use regex or better.
+			char *position = strstr(asr_session->mrcp_message_last_rcvd->body, marker);
+			if (!position) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad result received from mrcp server: %s", asr_session->mrcp_message_last_rcvd->body);
+				ret = SWITCH_STATUS_FALSE;
+			}
+			else {
+				position += strlen(marker);
+				*xmlstr = strdup(position);
+			}
 		}
 		else {
-			position += strlen(marker);
-			*xmlstr = strdup(position);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No result received from mrcp server");
+			ret = SWITCH_STATUS_FALSE;
 		}
 
 		// since we are returning our result here, future calls to check_results
@@ -599,6 +613,7 @@
 
 	/* terminate tts session */
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "terminate tts_session\n");
+	switch_set_flag_locked(tts_session, FLAG_TERMINATING);
 	mrcp_client_context_session_terminate(context,tts_session->client_session);
 	return SWITCH_STATUS_SUCCESS;	
 }
@@ -705,6 +720,7 @@
 		return SWITCH_STATUS_TERM;
 	}
 
+	mrcp_logger.priority = MRCP_PRIO_EMERGENCY;
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			const char *var = switch_xml_attr_soft(param, "name");
@@ -714,6 +730,8 @@
 				asr_profile_name = val;
 			} else if (!strcasecmp(var, "tts_default_profile")) {
 				tts_profile_name = val;
+			} else if (!strcasecmp(var, "log_level")) {
+				mrcp_logger.priority = atoi(val);
 			}
 		}
 	}

Modified: freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c	(original)
+++ freeswitch/branches/greenlizard/src/mod/timers/mod_softtimer/mod_softtimer.c	Mon Aug 20 18:01:13 2007
@@ -74,7 +74,7 @@
 #define IDLE_SPEED 100
 
 
-static inline switch_status_t timer_init(switch_timer_t *timer)
+static switch_status_t timer_init(switch_timer_t *timer)
 {
 	timer_private_t *private_info;
 	int sanity = 0;
@@ -112,7 +112,7 @@
 
 
 
-static inline switch_status_t timer_step(switch_timer_t *timer)
+static switch_status_t timer_step(switch_timer_t *timer)
 {
 	timer_private_t *private_info = timer->private_info;
 	uint64_t samples;
@@ -136,7 +136,7 @@
 }
 
 
-static inline switch_status_t timer_next(switch_timer_t *timer)
+static switch_status_t timer_next(switch_timer_t *timer)
 {
 	timer_private_t *private_info = timer->private_info;
 
@@ -154,7 +154,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-static inline switch_status_t timer_check(switch_timer_t *timer)
+static switch_status_t timer_check(switch_timer_t *timer)
 {
 	timer_private_t *private_info = timer->private_info;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -182,7 +182,7 @@
 }
 
 
-static inline switch_status_t timer_destroy(switch_timer_t *timer)
+static switch_status_t timer_destroy(switch_timer_t *timer)
 {
 	timer_private_t *private_info = timer->private_info;
 	switch_mutex_lock(globals.mutex);

Modified: freeswitch/branches/greenlizard/src/switch_loadable_module.c
==============================================================================
--- freeswitch/branches/greenlizard/src/switch_loadable_module.c	(original)
+++ freeswitch/branches/greenlizard/src/switch_loadable_module.c	Mon Aug 20 18:01:13 2007
@@ -1047,6 +1047,7 @@
 	assert(module != NULL);
 
 	switch_loadable_module_unprocess(module);
+    switch_core_hash_delete_locked(loadable_modules.module_hash, module->key, loadable_modules.mutex);
 
 	if (module->switch_module_shutdown) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping: %s\n", module->module_interface->module_name);
@@ -1067,7 +1068,7 @@
 	}
 
 	
-    switch_core_hash_delete_locked(loadable_modules.module_hash, module->key, loadable_modules.mutex);
+
 		
 }
 



More information about the Freeswitch-branches mailing list