]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding transfer-sound to ivr menu so you can specifiy a sound file to pay when a...
authorBrian West <brian@freeswitch.org>
Wed, 24 Jul 2013 23:40:31 +0000 (18:40 -0500)
committerBrian West <brian@freeswitch.org>
Wed, 24 Jul 2013 23:40:45 +0000 (18:40 -0500)
src/include/switch_cpp.h
src/include/switch_ivr.h
src/switch_cpp.cpp
src/switch_ivr_menu.c

index 43aa6c0befb1f1300bf922d4a80c61aea7f4c534..bccf71a3a128ea93f50ba62d7a1ac526c6fa8f87 100644 (file)
@@ -90,6 +90,7 @@ SWITCH_DECLARE(bool) email(char *to, char *from, char *headers = NULL, char *bod
                                                                                        const char *short_greeting_sound,
                                                                                        const char *invalid_sound,
                                                                                        const char *exit_sound,
+                                                                                       const char *transfer_sound,
                                                                                        const char *confirm_macro,
                                                                                        const char *confirm_key,
                                                                                        const char *tts_engine,
index 74f9a8e738a0ccc62432d70cae2fcda129550c64..c0ba440c9946ada440b2311083f838323a7a5852 100644 (file)
@@ -787,6 +787,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
  *\param short_greeting_sound Optional pointer to a shorter main sound for subsequent loops.
  *\param invalid_sound Optional pointer to a sound to play after invalid input.
  *\param exit_sound Optional pointer to a sound to play upon exiting the menu.
+ *\param transfer_sound Optional pointer to a sound to play upon transfer away from the menu.
  *\param confirm_macro phrase macro name to confirm input
  *\param confirm_key the dtmf key required for positive confirmation
  *\param tts_engine the tts engine to use for this menu
@@ -807,6 +808,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
                                                                                                         const char *short_greeting_sound,
                                                                                                         const char *invalid_sound,
                                                                                                         const char *exit_sound,
+                                                                                                        const char *transfer_sound,
                                                                                                         const char *confirm_macro,
                                                                                                         const char *confirm_key,
                                                                                                         const char *tts_engine,
index e8a8a1513ee9df7de7656170015677d0459a14cf..f7f6a4a5b8893fd17c93fca735de507756ed6afd 100644 (file)
@@ -161,6 +161,7 @@ SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
                                                                                        const char *short_greeting_sound,
                                                                                        const char *invalid_sound,
                                                                                        const char *exit_sound,
+                                                                                       const char *transfer_sound,
                                                                                        const char *confirm_macro,
                                                                                        const char *confirm_key,
                                                                                        const char *tts_engine,
@@ -180,7 +181,7 @@ SWITCH_DECLARE_CONSTRUCTOR IVRMenu::IVRMenu(IVRMenu *main,
        }
 
        switch_ivr_menu_init(&menu, main ? main->menu : NULL, name, greeting_sound, short_greeting_sound, invalid_sound, 
-                                                exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout,
+                                                exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout,
                                                 digit_len, timeout, max_failures, max_timeouts, pool);
        
 
index 639ff58f29020da895032c6806a11b36efce1920..e3dfa5c84890f584dce7f132cf8816d3dc615f85 100644 (file)
@@ -40,6 +40,7 @@ struct switch_ivr_menu {
        char *short_greeting_sound;
        char *invalid_sound;
        char *exit_sound;
+       char *transfer_sound;
        char *buf;
        char *ptr;
        char *confirm_macro;
@@ -105,6 +106,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
                                                                                                         const char *short_greeting_sound,
                                                                                                         const char *invalid_sound,
                                                                                                         const char *exit_sound,
+                                                                                                        const char *transfer_sound,
                                                                                                         const char *confirm_macro,
                                                                                                         const char *confirm_key,
                                                                                                         const char *tts_engine,
@@ -158,6 +160,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_me
                menu->invalid_sound = switch_core_strdup(menu->pool, invalid_sound);
        }
 
+       if (!zstr(transfer_sound)) {
+               menu->transfer_sound = switch_core_strdup(menu->pool, transfer_sound);
+       }
+
        if (!zstr(exit_sound)) {
                menu->exit_sound = switch_core_strdup(menu->pool, exit_sound);
        }
@@ -588,6 +594,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_execute(switch_core_session_t *s
                                                                }
 
                                                                if ((application_interface = switch_loadable_module_get_application_interface(app_name))) {
+                                                                       if (!zstr(menu->transfer_sound) && !strcmp(app_name, "transfer")) {
+                                                                               status = play_and_collect(session, menu, menu->transfer_sound, 0);
+                                                                       }
+
                                                                        switch_core_session_exec(session, application_interface, app_arg);
                                                                        UNPROTECT_INTERFACE(application_interface);
                                                                        status = SWITCH_STATUS_SUCCESS;
@@ -822,6 +832,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
                const char *greet_short = switch_xml_attr(xml_menu, "greet-short");     /* if the attr doesn't exist, return NULL */
                const char *invalid_sound = switch_xml_attr(xml_menu, "invalid-sound"); /* if the attr doesn't exist, return NULL */
                const char *exit_sound = switch_xml_attr(xml_menu, "exit-sound");       /* if the attr doesn't exist, return NULL */
+               const char *transfer_sound = switch_xml_attr(xml_menu, "transfer-sound");       /* if the attr doesn't exist, return NULL */
                const char *timeout = switch_xml_attr_soft(xml_menu, "timeout");        /* if the attr doesn't exist, return "" */
                const char *max_failures = switch_xml_attr_soft(xml_menu, "max-failures");      /* if the attr doesn't exist, return "" */
                const char *max_timeouts = switch_xml_attr_soft(xml_menu, "max-timeouts");
@@ -853,6 +864,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_
                                                                          greet_short,
                                                                          invalid_sound,
                                                                          exit_sound,
+                                                                         transfer_sound,
                                                                          confirm_macro,
                                                                          confirm_key,
                                                                          tts_engine,