Revision
15554
Author
crienzo
Date
2009-11-19 14:10:20 -0600 (Thu, 19 Nov 2009)

Log Message

Support UniMRCP 0.8.0 and new RTCP configuration params

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/Makefile.am (15553 => 15554)


--- freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/Makefile.am	2009-11-19 18:22:05 UTC (rev 15553)
+++ freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/Makefile.am	2009-11-19 20:10:20 UTC (rev 15554)
@@ -21,6 +21,7 @@
 mod_unimrcp_la_CFLAGS += -I.
 mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr/include
 mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr-util/include
+mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/build
 mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/platforms/libunimrcp-client/include
 mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-sofiasip/include
 mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-unirtsp/include

Modified: freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c (15553 => 15554)


--- freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c	2009-11-19 18:22:05 UTC (rev 15553)
+++ freeswitch/trunk/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c	2009-11-19 20:10:20 UTC (rev 15554)
@@ -44,8 +44,12 @@
 #include "mrcp_synth_resource.h"
 #include "mrcp_recog_header.h"
 #include "mrcp_recog_resource.h"
-
+#include "uni_version.h"
+#if UNI_VERSION_AT_LEAST(0,8,0)
+#include "mrcp_resource_loader.h"
+#else
 #include "mrcp_default_factory.h"
+#endif
 #include "mpf_engine.h"
 #include "mpf_codec_manager.h"
 #include "mpf_rtp_termination_factory.h"
@@ -3264,6 +3268,16 @@
 		}
 	} else if (strcasecmp(param, "ptime") == 0) {
 		rtp_config->ptime = (apr_uint16_t)atol(val);
+#if UNI_VERSION_AT_LEAST(0,8,0)
+	} else if(strcasecmp(param, "rtcp") == 0) {
+		rtp_config->rtcp = atoi(val);
+	} else if(strcasecmp(param, "rtcp-bye") == 0) {
+		rtp_config->rtcp_bye_policy = atoi(val);
+	} else if(strcasecmp(param, "rtcp-tx-interval") == 0) {
+		rtp_config->rtcp_tx_interval = (apr_uint16_t)atoi(val);
+	} else if(strcasecmp(param, "rtcp-rx-resolution") == 0) {
+		rtp_config->rtcp_rx_resolution = (apr_uint16_t)atol(val);
+#endif
 	} else {
 		mine = 0;
 	}
@@ -3343,7 +3357,7 @@
  * Create the MRCP client and configure it with profiles defined in FreeSWITCH XML config
  *
  * Some code and ideas borrowed from unimrcp-client.c
- * Please check libs/unimrcp/platform/libunimrcp-client/src/unimrcp-client.c when upgrading
+ * Please check libs/unimrcp/platforms/libunimrcp-client/src/unimrcp-client.c when upgrading
  * the UniMRCP library to ensure nothing new needs to be set up.
  *
  * @return the MRCP client
@@ -3353,6 +3367,9 @@
 	switch_xml_t cfg = NULL, xml = NULL, profiles = NULL, profile = NULL;
 	mrcp_client_t *client = NULL;
 	apr_pool_t *pool = NULL;
+#if UNI_VERSION_AT_LEAST(0,8,0)
+	mrcp_resource_loader_t *resource_loader = NULL;
+#endif
 	mrcp_resource_factory_t *resource_factory = NULL;
 	mpf_codec_manager_t *codec_manager = NULL;
 	apr_size_t max_connection_count = 0;
@@ -3366,17 +3383,42 @@
 		goto done;
 	}
 	client = mrcp_client_create(dir_layout);
-	if (!client)
+	if (!client) {
 		goto done;
+	}
 
 	pool = mrcp_client_memory_pool_get(client);
-	if (!pool)
+	if (!pool) {
+		client = NULL;
 		goto done;
+	}
 
+#if UNI_VERSION_AT_LEAST(0,8,0)
+	/* load the synthesizer and recognizer resources */	
+	resource_loader = mrcp_resource_loader_create(FALSE, pool);
+	if(resource_loader) {
+		apt_str_t synth_resource;
+		apt_str_t recog_resource;
+		apt_string_set(&synth_resource, "speechsynth");
+		mrcp_resource_load(resource_loader, &synth_resource);
+		apt_string_set(&recog_resource, "speechrecog");
+		mrcp_resource_load(resource_loader, &recog_resource);
+		resource_factory = mrcp_resource_factory_get(resource_loader);
+		mrcp_client_resource_factory_register(client, resource_factory);
+	} else {
+		client = NULL;
+		goto done;
+	}
+#else
+	/* load resources */
 	resource_factory = mrcp_default_factory_create(pool);
 	if (resource_factory) {
 		mrcp_client_resource_factory_register(client, resource_factory);
+	} else {
+		client = NULL;
+		goto done;
 	}
+#endif
 
 	codec_manager = mpf_engine_codec_manager_create(pool);
 	if (codec_manager) {