mod_protovm: Fix the set password ivr. Made the terminate key configurable for digit capture, and a few ident and other small changes

This commit is contained in:
Marc Olivier Chouinard 2011-07-09 13:24:43 -04:00
parent 7527c2feda
commit b235911f00
4 changed files with 29 additions and 19 deletions

View 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);
@ -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 };
@ -585,8 +591,9 @@ char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *p
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) {

View File

@ -14,7 +14,7 @@ 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 {

View 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>
@ -137,6 +138,7 @@
<phrase name="invalid_extension" value="invalid_extension@protovm" />
</phrases>
<keys>
<key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
</keys>
</menu>
@ -163,6 +165,7 @@
<phrase name="instructions" value="enter_pass@protovm" />
</phrases>
<keys>
<key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
</keys>
</menu>
</menus>