]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
tweak defaults
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 15 Oct 2007 18:02:21 +0000 (18:02 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 15 Oct 2007 18:02:21 +0000 (18:02 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5879 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/freeswitch.xml
src/mod/applications/mod_voicemail/mod_voicemail.c
src/switch_ivr_play_say.c

index 953ad1957d6f93be89ccebc04885449cb92ddf3e..a2c93aa5445eea0d494bf188b4070d698e646ed0 100644 (file)
   <!-- 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"-->
index feb19d5435801d80ca5b55f5ed3cde5af374871b..16312c729a97ee968da322cea2e3a87cd96e8d63 100644 (file)
@@ -1031,6 +1031,7 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n
             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 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n
 
                 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 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n
                 
                 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 @@ static void voicemail_check_main(switch_core_session_t *session, char *profile_n
                     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;
index 123be7bbb12de809dcf2331d5ae2e1c0a27a7d0b..78de3d76180fdefd2eee9a96c0dba3f1d54f5e76 100644 (file)
@@ -152,9 +152,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
                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_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *s
                                                        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);
+                                               }
                                        }
                                }
                        }