[Freeswitch-svn] [commit] r1583 - in freeswitch/trunk/src/mod: applications/mod_playback asr_tts/mod_cepstral dialplans/mod_dialplan_xml

anthm at freeswitch.org anthm at freeswitch.org
Fri Jun 9 11:15:58 EDT 2006


Author: anthm
Date: Fri Jun  9 11:15:58 2006
New Revision: 1583

Modified:
   freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c
   freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
   freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c

Log:
add speak application

Modified: freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_playback/mod_playback.c	Fri Jun  9 11:15:58 2006
@@ -49,6 +49,43 @@
 }
 
 
+static void speak_function(switch_core_session_t *session, char *data)
+{
+	switch_channel_t *channel;
+	char buf[10];
+	char *argv[4] = {0};
+	int argc;
+	char *engine = NULL;
+	char *voice = NULL;
+	char *text = NULL;
+	char *timer_name = NULL;
+	char *mydata = NULL;
+	switch_codec_t *codec;
+
+	codec = switch_core_session_get_read_codec(session);
+	assert(codec != NULL);
+
+	channel = switch_core_session_get_channel(session);
+    assert(channel != NULL);
+
+	mydata = switch_core_session_strdup(session, data);
+	argc = switch_separate_string(mydata, '|', argv, sizeof(argv)/sizeof(argv[0]));
+
+	engine = argv[0];
+	voice = argv[1];
+	text = argv[2];
+	timer_name = argv[3];
+	
+	if (!(engine && voice && text)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Params!\n");
+		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+	}
+
+	switch_channel_answer(channel);
+	switch_ivr_speak_text(session, engine, voice, timer_name, codec->implementation->samples_per_second, on_dtmf, text, buf, sizeof(buf));
+	
+}
+
 static void playback_function(switch_core_session_t *session, char *data)
 {
 	switch_channel_t *channel;
@@ -85,9 +122,17 @@
 	
 }
 
+
+static const switch_application_interface_t speak_application_interface = {
+	/*.interface_name */ "speak",
+	/*.application_function */ speak_function
+};
+
 static const switch_application_interface_t record_application_interface = {
 	/*.interface_name */ "record",
-	/*.application_function */ record_function
+	/*.application_function */ record_function,
+	NULL,NULL,NULL,
+	&speak_application_interface
 };
 
 static const switch_application_interface_t playback_application_interface = {

Modified: freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c
==============================================================================
--- freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	(original)
+++ freeswitch/trunk/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	Fri Jun  9 11:15:58 2006
@@ -195,6 +195,8 @@
 static switch_status_t cepstral_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
 {
 	cepstral_t *cepstral;
+	const char *fp = "file:";
+	int len = strlen(fp);
 
 	assert(sh != NULL);
 	cepstral = sh->private_info;
@@ -204,8 +206,13 @@
 	cepstral->done = 0;
 
 	cepstral->tts_stream = NULL;
-
-	swift_port_speak_text(cepstral->port, text, 0, NULL, &cepstral->tts_stream, NULL); 
+	
+	if (!strncasecmp(text, fp, len)) {
+		text += len;
+		swift_port_speak_file(cepstral->port, text, NULL, &cepstral->tts_stream, NULL); 
+	} else {
+		swift_port_speak_text(cepstral->port, text, 0, NULL, &cepstral->tts_stream, NULL); 
+	}
 
 	return SWITCH_STATUS_FALSE;
 }

Modified: freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c
==============================================================================
--- freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	(original)
+++ freeswitch/trunk/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	Fri Jun  9 11:15:58 2006
@@ -236,8 +236,6 @@
 
 		proceed = parse_exten(session, xexten, &extension);
 
-		//printf("ASS %s %d\n", (char *) switch_xml_attr_soft(xexten, "name"), proceed);
-
 		if (proceed && !switch_true(cont)) {
 			break;
 		}



More information about the Freeswitch-svn mailing list