[Freeswitch-svn] [commit] r5879 - in freeswitch/trunk: conf src src/mod/applications/mod_voicemail

Freeswitch SVN anthm at freeswitch.org
Mon Oct 15 14:02:22 EDT 2007


Author: anthm
Date: Mon Oct 15 14:02:21 2007
New Revision: 5879

Modified:
   freeswitch/trunk/conf/freeswitch.xml
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/trunk/src/switch_ivr_play_say.c

Log:
tweak defaults

Modified: freeswitch/trunk/conf/freeswitch.xml
==============================================================================
--- freeswitch/trunk/conf/freeswitch.xml	(original)
+++ freeswitch/trunk/conf/freeswitch.xml	Mon Oct 15 14:02:21 2007
@@ -144,7 +144,7 @@
   <!-- phrases section (under development still) -->
   <section name="phrases" description="Speech Phrase Management">
     <macros>
-      <language name="en" sound_path="/snds" tts_engine="cepstral" tts_voice="david">
+      <language name="en" sound-path="/snds" tts-engine="cepstral" tts-voice="david">
 	<!--#include "lang_en.xml"-->
 	<!--voicemail_en_tts is purely implemented with tts, we need a files based implementation too -->
 	<!--#include "voicemail_en_tts.xml"-->

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Mon Oct 15 14:02:21 2007
@@ -1031,6 +1031,7 @@
             break;
         case VM_CHECK_FOLDER_SUMMARY:
             {
+                int informed = 0;
                 char msg_count[80] = "";
                 switch_channel_set_variable(channel, "voicemail_current_folder", myfolder);
                 message_count(profile, myid, domain_name, myfolder, &total_new_messages, &total_saved_messages, 
@@ -1038,15 +1039,13 @@
 
                 if (total_new_urgent_messages > 0) {
                     snprintf(msg_count, sizeof(msg_count), "%d:urgent-new:%s", total_new_urgent_messages, total_new_urgent_messages == 1 ? "" : "s");
-                    if ((status = switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL)) != SWITCH_STATUS_SUCCESS) {
-                        goto end;
-                    }
+                    TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+                    informed++;
                 }
                 if (total_new_messages > 0) {
                     snprintf(msg_count, sizeof(msg_count), "%d:new:%s", total_new_messages, total_new_messages == 1 ? "" : "s");
-                    if ((status = switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL)) != SWITCH_STATUS_SUCCESS) {
-                        goto end;
-                    }
+                    TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+                    informed++;
                 }
                 
                 if (!heard_auto_new && total_new_messages > 0) {
@@ -1058,16 +1057,14 @@
                 
                 if (total_saved_urgent_messages > 0) {
                     snprintf(msg_count, sizeof(msg_count), "%d:urgent-saved:%s", total_saved_urgent_messages, total_saved_urgent_messages == 1 ? "" : "s");
-                    if ((status = switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL)) != SWITCH_STATUS_SUCCESS) {
-                        goto end;
-                    }
+                    TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+                    informed++;
                 }
 
                 if (total_saved_messages > 0) {
                     snprintf(msg_count, sizeof(msg_count), "%d:saved:%s", total_saved_messages, total_saved_messages == 1 ? "" : "s");
-                    if ((status = switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL)) != SWITCH_STATUS_SUCCESS) {
-                        goto end;
-                    }
+                    TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+                    informed++;
                 }
                 
                 if (!heard_auto_saved && total_saved_messages > 0) {
@@ -1077,6 +1074,13 @@
                     continue;
                 }
                 
+                if (!informed) {
+                    snprintf(msg_count, sizeof(msg_count), "0:new:s");
+                    TRY_CODE(switch_ivr_phrase_macro(session, VM_MESSAGE_COUNT_MACRO, msg_count, NULL, NULL));
+                    informed++;
+                }
+
+
                 vm_check_state = VM_CHECK_MENU;
             }
             break;

Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c	(original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c	Mon Oct 15 14:02:21 2007
@@ -152,9 +152,22 @@
 		goto done;
 	}
 
-	sound_path = (char *) switch_xml_attr_soft(language, "sound_path");
-	tts_engine = (char *) switch_xml_attr_soft(language, "tts_engine");
-	tts_voice = (char *) switch_xml_attr_soft(language, "tts_voice");
+	
+	if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) {
+		sound_path = (char *) switch_xml_attr(language, "sound_path");
+	}
+
+	if (!(tts_engine = (char *) switch_xml_attr(language, "tts-engine"))) {
+		if (!(tts_engine = (char *) switch_xml_attr(language, "tts_engine"))) {
+			tts_engine = switch_channel_get_variable(channel, tts_engine);
+		}
+	}
+	
+	if (!(tts_voice = (char *) switch_xml_attr(language, "tts-voice"))) {
+		if (!(tts_voice = (char *) switch_xml_attr(language, "tts_voice"))) {
+			tts_voice = switch_channel_get_variable(channel, tts_voice);
+		}
+	}
 
 	if (sound_path) {
 		old_sound_prefix = switch_channel_get_variable(channel, "sound_prefix");
@@ -252,7 +265,21 @@
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", chan_lang);
 						}
 					} else if (!strcasecmp(func, "speak-text")) {
-						status = switch_ivr_speak_text(session, tts_engine, tts_voice, odata, args);
+						char *my_tts_engine = (char *) switch_xml_attr(action, "tts-engine");
+						char *my_tts_voice = (char *) switch_xml_attr(action, "tts-voice");
+						
+						if (!my_tts_engine) {
+							my_tts_engine = tts_engine;
+						}
+
+						if (!my_tts_voice) {
+							my_tts_voice = tts_voice;
+						}
+						if (switch_strlen_zero(tts_engine) || switch_strlen_zero(tts_voice)) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "TTS is not configured\n");
+						} else {
+							status = switch_ivr_speak_text(session, my_tts_engine, my_tts_voice, odata, args);
+						}
 					}
 				}
 			}



More information about the Freeswitch-svn mailing list