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:
parent
7527c2feda
commit
b235911f00
|
@ -337,7 +337,7 @@ void mtvm_menu_forward(switch_core_session_t *session, vmivr_profile_t *profile)
|
||||||
/* Initialize Menu Configs */
|
/* Initialize Menu Configs */
|
||||||
populate_profile_menu_event(profile, &sub_menu);
|
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) {
|
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:"" );
|
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) {
|
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;
|
char *password;
|
||||||
vmivr_menu_profile_t menu = { "std_set_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 */
|
/* TODO Add Prompts to tell if password was set and if it was not */
|
||||||
if (password) {
|
if (password) {
|
||||||
char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, 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);
|
mt_api_execute(session, profile->api_pref_password_set, cmd);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free_profile_menu_event(&menu);
|
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 */
|
/* Initialize Menu Configs */
|
||||||
populate_profile_menu_event(profile, &sub_menu);
|
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);
|
free_profile_menu_event(&sub_menu);
|
||||||
}
|
}
|
||||||
if (!password) {
|
if (!password) {
|
||||||
|
@ -421,7 +425,7 @@ void mtvm_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *pro
|
||||||
/* Initialize Menu Configs */
|
/* Initialize Menu Configs */
|
||||||
populate_profile_menu_event(profile, &sub_menu);
|
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);
|
free_profile_menu_event(&sub_menu);
|
||||||
}
|
}
|
||||||
cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, id, password);
|
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 */
|
/* Initialize Menu Configs */
|
||||||
populate_profile_menu_event(profile, &menu);
|
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)
|
if (result)
|
||||||
gnum = atoi(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 */
|
/* Initialize Menu Configs */
|
||||||
populate_profile_menu_event(profile, &menu);
|
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)
|
if (result)
|
||||||
gnum = atoi(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);
|
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;
|
char *result = NULL;
|
||||||
int retry;
|
int retry;
|
||||||
|
const char *terminate_key = NULL;
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
if (!menu.event_keys_dtmf || !menu.event_phrases) {
|
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;
|
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--) {
|
for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
|
||||||
dtmf_ss_t loc;
|
dtmf_ss_t loc;
|
||||||
char *dtmfa[16] = { 0 };
|
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;
|
dtmfa[i] = (char *) input_mask;
|
||||||
|
|
||||||
captureMenuInitialize(&loc, dtmfa);
|
captureMenuInitialize(&loc, dtmfa);
|
||||||
if (terminate_key)
|
if (terminate_key) {
|
||||||
loc.terminate_key = terminate_key[0]; /* TODO Make this load from the configuration */
|
loc.terminate_key = terminate_key[0];
|
||||||
|
}
|
||||||
captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "instructions"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
|
captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "instructions"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
|
||||||
|
|
||||||
if (loc.result == RES_TIMEOUT) {
|
if (loc.result == RES_TIMEOUT) {
|
||||||
|
|
|
@ -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);
|
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);
|
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 {
|
struct vmivr_menu_function {
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
<phrase name="instructions" value="enter_id@protovm" />
|
<phrase name="instructions" value="enter_id@protovm" />
|
||||||
</phrases>
|
</phrases>
|
||||||
<keys>
|
<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>
|
</keys>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<phrase name="instructions" value="enter_pass@protovm" />
|
<phrase name="instructions" value="enter_pass@protovm" />
|
||||||
</phrases>
|
</phrases>
|
||||||
<keys>
|
<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>
|
</keys>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@
|
||||||
<key dtmf="3" action="save_msg" variable="VM-Key-Main-Save-File" />
|
<key dtmf="3" action="save_msg" variable="VM-Key-Main-Save-File" />
|
||||||
<key dtmf="2" action="callback" variable="VM-Key-Main-Callback" />
|
<key dtmf="2" action="callback" variable="VM-Key-Main-Callback" />
|
||||||
<key dtmf="5" action="menu:std_preference" />
|
<key dtmf="5" action="menu:std_preference" />
|
||||||
|
<key dtmf="#" action="return" /> <!-- TODO Might Conflict with future fast-forward -->
|
||||||
</keys>
|
</keys>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@
|
||||||
<key dtmf="2" action="menu:std_select_greeting_slot" variable="VM-Key-Choose-Greeting" />
|
<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="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="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>
|
</keys>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
@ -137,6 +138,7 @@
|
||||||
<phrase name="invalid_extension" value="invalid_extension@protovm" />
|
<phrase name="invalid_extension" value="invalid_extension@protovm" />
|
||||||
</phrases>
|
</phrases>
|
||||||
<keys>
|
<keys>
|
||||||
|
<key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
|
||||||
</keys>
|
</keys>
|
||||||
</menu>
|
</menu>
|
||||||
|
|
||||||
|
@ -163,6 +165,7 @@
|
||||||
<phrase name="instructions" value="enter_pass@protovm" />
|
<phrase name="instructions" value="enter_pass@protovm" />
|
||||||
</phrases>
|
</phrases>
|
||||||
<keys>
|
<keys>
|
||||||
|
<key dtmf="#" action="ivrengine:terminate_entry" variable="VM-Key-Terminator" />
|
||||||
</keys>
|
</keys>
|
||||||
</menu>
|
</menu>
|
||||||
</menus>
|
</menus>
|
||||||
|
|
Loading…
Reference in New Issue