]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
mod_protovm: Fix the set password ivr. Made the terminate key configurable for digit...
authorMarc Olivier Chouinard <mochouinard@moctel.com>
Sat, 9 Jul 2011 17:24:43 +0000 (13:24 -0400)
committerMarc Olivier Chouinard <mochouinard@moctel.com>
Sat, 9 Jul 2011 17:24:43 +0000 (13:24 -0400)
src/mod/applications/mod_protovm/config.h
src/mod/applications/mod_protovm/menu.c
src/mod/applications/mod_protovm/menu.h
src/mod/applications/mod_protovm/protovm.conf.xml

index b5beeeaca1fcab945d3b4efbec81a9c76a674250..2429f2cb362e1e10882470280e54d20645e787ba 100644 (file)
@@ -38,10 +38,10 @@ typedef struct vmivr_profile vmivr_profile_t;
 struct vmivr_menu_profile {
        const char *name;
 
-        switch_event_t *event_keys_action;
+       switch_event_t *event_keys_action;
        switch_event_t *event_keys_dtmf;
        switch_event_t *event_keys_varname;
-        switch_event_t *event_phrases;
+       switch_event_t *event_phrases;
 };
 typedef struct vmivr_menu_profile vmivr_menu_profile_t;
 
index 3cd22a58841f78c42f6bc67ac022d2bcc2ceacdd..ba4229d43dc5c969e51442500b3e519cab39ee74 100644 (file)
@@ -337,7 +337,7 @@ void mtvm_menu_forward(switch_core_session_t *session, vmivr_profile_t *profile)
                        /* Initialize Menu Configs */
                        populate_profile_menu_event(profile, &sub_menu);
 
-                       id = mtvm_menu_get_input_set(session, profile, sub_menu, "X.", "#" /* TODO Conf terminate input key */);
+                       id = mtvm_menu_get_input_set(session, profile, sub_menu, "X.");
                        if (id) {
                                const char *cmd = switch_core_session_sprintf(session, "%s %s %s %s %s %s %s%s%s", profile->api_profile, profile->domain, profile->id, profile->current_msg_uuid, profile->domain, id, prepend_filepath?" ":"", prepend_filepath?prepend_filepath:"" );
                                if (mt_api_execute(session, profile->api_msg_forward, cmd) == SWITCH_STATUS_SUCCESS) {
@@ -381,12 +381,16 @@ void mtvm_menu_set_password(switch_core_session_t *session, vmivr_profile_t *pro
        char *password;
        vmivr_menu_profile_t menu = { "std_set_password" };
 
-       password = mtvm_menu_get_input_set(session, profile, menu, "XXX." /* TODO Conf Min 3 Digit */, "#" /* TODO Conf terminate input key */);
+       /* Initialize Menu Configs */
+       populate_profile_menu_event(profile, &menu);
+
+       password = mtvm_menu_get_input_set(session, profile, menu, "XXX." /* TODO Conf Min 3 Digit */);
 
        /* TODO Add Prompts to tell if password was set and if it was not */
        if (password) {
                char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, password);
                mt_api_execute(session, profile->api_pref_password_set, cmd);
+               
        }
 
        free_profile_menu_event(&menu);
@@ -394,7 +398,7 @@ void mtvm_menu_set_password(switch_core_session_t *session, vmivr_profile_t *pro
 
 void mtvm_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *profile) {
        switch_channel_t *channel = switch_core_session_get_channel(session);
-        vmivr_menu_profile_t menu = { "std_authenticate" };
+       vmivr_menu_profile_t menu = { "std_authenticate" };
        int retry;
        const char *auth_var = NULL;
        /* Initialize Menu Configs */
@@ -413,7 +417,7 @@ void mtvm_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *pro
                        /* Initialize Menu Configs */
                        populate_profile_menu_event(profile, &sub_menu);
 
-                       id = mtvm_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */, "#" /* TODO Conf terminate input key */);
+                       id = mtvm_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */);
                        free_profile_menu_event(&sub_menu);
                }
                if (!password) {
@@ -421,7 +425,7 @@ void mtvm_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *pro
                        /* Initialize Menu Configs */
                        populate_profile_menu_event(profile, &sub_menu);
 
-                       password = mtvm_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */, "#" /* TODO Conf terminate input key */);
+                       password = mtvm_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */);
                        free_profile_menu_event(&sub_menu);
                }
                cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, id, password);
@@ -445,7 +449,7 @@ void mtvm_menu_select_greeting_slot(switch_core_session_t *session, vmivr_profil
        /* Initialize Menu Configs */
        populate_profile_menu_event(profile, &menu);
 
-       result = mtvm_menu_get_input_set(session, profile, menu, "X", NULL);
+       result = mtvm_menu_get_input_set(session, profile, menu, "X");
 
        if (result)
                gnum = atoi(result);
@@ -471,7 +475,7 @@ void mtvm_menu_record_greeting_with_slot(switch_core_session_t *session, vmivr_p
        /* Initialize Menu Configs */
        populate_profile_menu_event(profile, &menu);
 
-       result = mtvm_menu_get_input_set(session, profile, menu, "X", NULL);
+       result = mtvm_menu_get_input_set(session, profile, menu, "X");
 
        if (result)
                gnum = atoi(result);
@@ -557,10 +561,10 @@ void mtvm_menu_preference(switch_core_session_t *session, vmivr_profile_t *profi
        free_profile_menu_event(&menu);
 }
 
-char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *input_mask, const char *terminate_key) {
+char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *input_mask) {
        char *result = NULL;
        int retry;
-
+       const char *terminate_key = NULL;
        switch_channel_t *channel = switch_core_session_get_channel(session);
 
        if (!menu.event_keys_dtmf || !menu.event_phrases) {
@@ -568,6 +572,8 @@ char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *p
                return result;
        }
 
+       terminate_key = switch_event_get_header(menu.event_keys_action, "ivrengine:terminate_entry");
+
        for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
                dtmf_ss_t loc;
                char *dtmfa[16] = { 0 };
@@ -582,11 +588,12 @@ char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *p
                /* Find the last entry and append this one to it */
                for (i=0; dtmfa[i] && i < 16; i++){
                }
-                dtmfa[i] = (char *) input_mask;
+               dtmfa[i] = (char *) input_mask;
 
                captureMenuInitialize(&loc, dtmfa);
-               if (terminate_key)
-                       loc.terminate_key = terminate_key[0]; /* TODO Make this load from the configuration */
+               if (terminate_key) {
+                       loc.terminate_key = terminate_key[0];
+               }
                captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "instructions"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
 
                if (loc.result == RES_TIMEOUT) {
index 0ef4e532e682df6cdd5069e6e82b5be8261f9aa7..82fd993a8f4088da4b72c66620158690cf8f9148 100644 (file)
@@ -14,11 +14,11 @@ void mtvm_menu_preference(switch_core_session_t *session, vmivr_profile_t *profi
 void mtvm_menu_forward(switch_core_session_t *session, vmivr_profile_t *profile);
 
 switch_status_t mtvm_menu_record(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *file_name);
-char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *input_mask, const char *terminate_key);
+char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *input_mask);
 
 
 struct vmivr_menu_function {
-        const char *name;
+       const char *name;
        void (*pt2Func)(switch_core_session_t *session, vmivr_profile_t *profile);
 
 };
index dc47f1e95c5602f611dae6feedd0b825d4de6c5c..c57e8f72b68e649a902f2050f1cedece1548972f 100644 (file)
@@ -29,7 +29,7 @@
                                <phrase name="instructions" value="enter_id@protovm" />
                        </phrases>
                        <keys>
-                               <key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" /> <!-- TODO Make the ivrengine: parsed and the key configurable -->
+                               <key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
                        </keys>
                        </menu>
 
@@ -38,7 +38,7 @@
                                <phrase name="instructions" value="enter_pass@protovm" />
                        </phrases>
                        <keys>
-                               <key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" /> <!-- TODO Make the ivrengine: parsed and the key configurable -->
+                               <key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
                        </keys>
                        </menu>
 
@@ -60,6 +60,7 @@
                                <key dtmf="3" action="save_msg" variable="VM-Key-Main-Save-File" />
                                <key dtmf="2" action="callback" variable="VM-Key-Main-Callback" />
                                <key dtmf="5" action="menu:std_preference" />
+                               <key dtmf="#" action="return" /> <!-- TODO Might Conflict with future fast-forward -->
                        </keys>
                        </menu>
 
@@ -72,7 +73,7 @@
                                <key dtmf="2" action="menu:std_select_greeting_slot" variable="VM-Key-Choose-Greeting" />
                                <key dtmf="3" action="menu:std_record_name" variable="VM-Key-Record-Name" />
                                <key dtmf="6" action="menu:std_set_password" variable="VM-Key-Change-Password" />
-                               <key dtmf="0" action="return" variable="VM-Key-Main-Menu" />
+                               <key dtmf="#" action="return" variable="VM-Key-Main-Menu" />
                        </keys>
                        </menu>
 
                                <phrase name="invalid_extension" value="invalid_extension@protovm" />
                        </phrases>
                        <keys>
+                               <key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
                        </keys>
                        </menu>
 
                                <phrase name="instructions" value="enter_pass@protovm" />
                        </phrases>
                        <keys>
+                               <key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
                        </keys>
                        </menu>
                </menus>