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
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
||||
};
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue