goto end;
}
- if (profile->event_settings && menu->event_settings) {
+ if (profile->event_settings) {
/* TODO Replace this with a switch_event_merge_not_set(...) */
switch_event_t *menu_default;
switch_event_create(&menu_default, SWITCH_EVENT_REQUEST_PARAMS);
- switch_event_merge(menu_default, menu->event_settings);
- switch_event_destroy(&menu->event_settings);
+ if (menu->event_settings) {
+ switch_event_merge(menu_default, menu->event_settings);
+ switch_event_destroy(&menu->event_settings);
+ }
switch_event_create(&menu->event_settings, SWITCH_EVENT_REQUEST_PARAMS);
switch_event_merge(menu->event_settings, profile->event_settings);
switch_event_destroy(&menu_default);
}
+ {
+ const char *s_max_attempts = switch_event_get_header(menu->event_settings, "IVR-Maximum-Attempts");
+ const char *s_entry_timeout = switch_event_get_header(menu->event_settings, "IVR-Entry-Timeout");
+ menu->ivr_maximum_attempts = atoi(s_max_attempts);
+ menu->ivr_entry_timeout = atoi(s_entry_timeout);
+ }
if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile->name))) {
if ((x_menus = switch_xml_child(x_profile, "menus"))) {
static void append_event_profile(vmivr_menu_t *menu) {
- if (!menu->phrase_params) {
- switch_event_create(&menu->phrase_params, SWITCH_EVENT_REQUEST_PARAMS);
- }
+ if (!menu->phrase_params) {
+ switch_event_create(&menu->phrase_params, SWITCH_EVENT_REQUEST_PARAMS);
+ }
- /* Used for some appending function */
- if (menu->profile && menu->profile->name && menu->profile->id && menu->profile->domain) {
- switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "VM-Profile", "%s", menu->profile->name);
- switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "VM-Account-ID", "%s", menu->profile->id);
- switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "VM-Account-Domain", "%s", menu->profile->domain);
- }
+ /* Used for some appending function */
+ if (menu->profile && menu->profile->name && menu->profile->id && menu->profile->domain) {
+ switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "VM-Profile", "%s", menu->profile->name);
+ switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "VM-Account-ID", "%s", menu->profile->id);
+ switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, "VM-Account-Domain", "%s", menu->profile->domain);
+ }
}
static void populate_dtmfa_from_event(vmivr_menu_t *menu) {
- int i = 0;
- if (menu->event_keys_dtmf) {
- switch_event_header_t *hp;
-
- for (hp = menu->event_keys_dtmf->headers; hp; hp = hp->next) {
- if (strlen(hp->name) < 3 && hp->value) { /* TODO This is a hack to discard default FS Events ! */
- const char *varphrasename = switch_event_get_header(menu->event_keys_varname, hp->value);
- menu->dtmfa[i++] = hp->name;
-
- if (varphrasename && !zstr(varphrasename)) {
- switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, varphrasename, "%s", hp->name);
- }
- }
- }
- }
- menu->dtmfa[i++] = '\0';
+ int i = 0;
+ if (menu->event_keys_dtmf) {
+ switch_event_header_t *hp;
-}
+ for (hp = menu->event_keys_dtmf->headers; hp; hp = hp->next) {
+ if (strlen(hp->name) < 3 && hp->value) { /* TODO This is a hack to discard default FS Events ! */
+ const char *varphrasename = switch_event_get_header(menu->event_keys_varname, hp->value);
+ menu->dtmfa[i++] = hp->name;
+ if (varphrasename && !zstr(varphrasename)) {
+ switch_event_add_header(menu->phrase_params, SWITCH_STACK_BOTTOM, varphrasename, "%s", hp->name);
+ }
+ }
+ }
+ }
+ menu->dtmfa[i++] = '\0';
+}
vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile_name)
{
profile->menu_check_main = "std_main_menu";
profile->menu_check_terminate = "std_purge";
- /* TODO Create event_settings and add default settings here */
+ /* Populate default general settings */
+ switch_event_create(&profile->event_settings, SWITCH_EVENT_REQUEST_PARAMS);
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "IVR-Maximum-Attempts", "%d", 3);
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "IVR-Entry-Timeout", "%d", 3000);
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "Exit-Purge", "%s", "true");
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "Password-Mask", "%s", "XXX.");
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "User-Mask", "%s", "X.");
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "Record-Format", "%s", "wav");
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "Record-Silence-Hits", "%d", 4);
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "Record-Silence-Threshold", "%d", 200);
+ switch_event_add_header(profile->event_settings, SWITCH_STACK_BOTTOM, "Record-Maximum-Length", "%d", 30);
if ((x_settings = switch_xml_child(x_profile, "settings"))) {
switch_event_import_xml(switch_xml_child(x_settings, "param"), "name", "value", &profile->event_settings);
{ NULL, NULL }
};
-#define MAX_ATTEMPT 3 /* TODO Make these fields configurable */
-#define DEFAULT_IVR_TIMEOUT 3000
-
void vmivr_menu_purge(switch_core_session_t *session, vmivr_profile_t *profile) {
+ vmivr_menu_t menu = { "std_menu_purge" };
+
+ /* Initialize Menu Configs */
+ menu_init(profile, &menu);
+
+ if (!menu.event_keys_dtmf || !menu.event_phrases) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'\n", menu.name);
+ goto end;
+ }
+
if (profile->id && profile->authorized) {
- if (1==1 /* TODO make Purge email on exit optional ??? */) {
+ const char *exit_purge = switch_event_get_header(menu.event_settings, "Exit-Purge");
+ if (switch_true(exit_purge)) {
const char *cmd = switch_core_session_sprintf(session, "%s %s %s", profile->api_profile, profile->domain, profile->id);
vmivr_api_execute(session, profile->api_msg_purge, cmd);
}
}
+end:
+ menu_free(&menu);
+
}
void vmivr_menu_main(switch_core_session_t *session, vmivr_profile_t *profile) {
menu_init(profile, &menu);
if (!menu.event_keys_dtmf || !menu.event_phrases) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys\n");
- return;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'\n", menu.name);
+ goto end;
}
- for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
+ for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {
char *cmd = NULL;
menu_instance_init(&menu);
//initial_count_played = SWITCH_TRUE;
ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "msg_count"), NULL, menu.phrase_params, NULL, 0);
- ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
+ ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);
if (menu.ivre_d.result == RES_TIMEOUT) {
/* TODO Ask for the prompt Again IF retry != 0 */
const char *action = switch_event_get_header(menu.event_keys_dtmf, menu.ivre_d.dtmf_stored);
/* Reset the try count */
- retry = MAX_ATTEMPT;
+ retry = menu.ivr_maximum_attempts;
if (action) {
if (!strncasecmp(action, "new_msg:", 8)) {
}
+
+end:
menu_free(&menu);
}
menu_init(profile, &menu);
if (!menu.event_keys_dtmf || !menu.event_phrases) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys\n");
- return;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'\n", menu.name);
+ goto done;
}
/* Get VoiceMail List And update msg count */
/* TODO Add Detection of new message and notify the user */
- for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
+ for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {
switch_core_session_message_t msg = { 0 };
char cid_buf[1024] = "";
previous_msg = current_msg;
- /* Simple Protection to not go out of msg list scope */
- /* TODO: Add Prompt to notify they reached the begining or the end */
- if (next_msg == 0) {
- next_msg = 1;
- } else if (next_msg > msg_count) {
- next_msg = msg_count;
- }
-
- current_msg = next_msg;
-
ivre_init(&menu.ivre_d, menu.dtmfa);
/* Prompt related to previous Message here */
ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "ack"), "saved", menu.phrase_params, NULL, 0);
}
switch_event_del_header(menu.phrase_params, "VM-Message-Flags");
+
+ /* Simple Protection to not go out of msg list scope */
+ /* TODO: Add Prompt to notify they reached the begining or the end */
+ if (next_msg == 0) {
+ next_msg = 1;
+ } else if (next_msg > msg_count) {
+ next_msg = msg_count;
+ /*ivre_playback_dtmf_buffered(session, switch_event_get_header(menu.event_phrases, "no_more_messages"), NULL, NULL, NULL, 0); */
+ }
+
+ current_msg = next_msg;
+
/* Prompt related the current message */
append_event_message(session, profile, menu.phrase_params, msg_list_params, current_msg);
skip_header = SWITCH_FALSE;
skip_playback = SWITCH_FALSE;
- ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
+ ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);
if (menu.ivre_d.result == RES_TIMEOUT) {
/* TODO Ask for the prompt Again IF retry != 0 */
const char *action = switch_event_get_header(menu.event_keys_dtmf, menu.ivre_d.dtmf_stored);
/* Reset the try count */
- retry = MAX_ATTEMPT;
-
+ retry = menu.ivr_maximum_attempts;
+action:
if (action) {
if (!strcasecmp(action, "skip_intro")) { /* Skip Header / Play the recording again */
skip_header = SWITCH_TRUE;
} else if (!strcasecmp(action, "next_msg")) { /* Next Message */
next_msg++;
- if (next_msg > msg_count) {
- //ivre_playback_dtmf_buffered(session, switch_event_get_header(menu.event_phrases, "no_more_messages"), NULL, NULL, NULL, 0);
- retry = -1;
- }
-
} else if (!strcasecmp(action, "prev_msg")) { /* Previous Message */
next_msg--;
} else if (!strcasecmp(action, "delete_msg")) { /* Delete / Undelete Message */
const char *msg_flags = switch_event_get_header(menu.phrase_params, "VM-Message-Flags");
if (!msg_flags || strncasecmp(msg_flags, "delete", 6)) {
+ const char *action_on_delete = switch_event_get_header(menu.event_settings, "Nav-Action-On-Delete");
cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(menu.phrase_params, "VM-Message-UUID"));
vmivr_api_execute(session, profile->api_msg_delete, cmd);
msg_deleted = SWITCH_TRUE;
- /* TODO Option for auto going to next message or just return to the menu (So user used to do 76 to delete and next message wont be confused) */
- //next_msg++;
- skip_header = skip_playback = SWITCH_TRUE;
+
+ if (action_on_delete) {
+ action = action_on_delete;
+ goto action;
+ } else {
+ skip_header = skip_playback = SWITCH_TRUE;
+ }
} else {
cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(menu.phrase_params, "VM-Message-UUID"));
vmivr_api_execute(session, profile->api_msg_undelete, cmd);
menu_init(profile, &menu);
if (!menu.event_keys_dtmf || !menu.event_phrases) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys\n");
- return;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'\n", menu.name);
+ goto end;
}
- for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
+ for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {
menu_instance_init(&menu);
ivre_init(&menu.ivre_d, menu.dtmfa);
- ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
+ ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);
if (menu.ivre_d.result == RES_TIMEOUT) {
/* TODO Ask for the prompt Again IF retry != 0 */
const char *action = switch_event_get_header(menu.event_keys_dtmf, menu.ivre_d.dtmf_stored);
/* Reset the try count */
- retry = MAX_ATTEMPT;
+ retry = menu.ivr_maximum_attempts;
if (action) {
if (!strcasecmp(action, "return")) { /* Return to the previous menu */
forward_msg = SWITCH_FALSE;
} else if (!strcasecmp(action, "prepend")) { /* Prepend record msg */
vmivr_menu_t sub_menu = { "std_record_message" };
- char *tmp_filepath = generate_random_file_name(session, "voicemail_ivr", "wav" /* TODO make it configurable */);
+
+ const char *tmp_filepath = NULL;
+ const char *record_format = NULL;
+
switch_status_t status;
/* Initialize Menu Configs */
menu_init(profile, &sub_menu);
+
+ record_format = switch_event_get_header(sub_menu.event_settings, "Record-Format");
+
+ tmp_filepath = generate_random_file_name(session, "voicemail_ivr", record_format);
status = vmivr_menu_record(session, profile, sub_menu, tmp_filepath);
}
/* Ask Extension to Forward */
if (forward_msg) {
- for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
+ for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {
const char *id = NULL;
vmivr_menu_t sub_menu = { "std_forward_ask_extension" };
}
+end:
menu_free(&menu);
}
switch_status_t status;
vmivr_menu_t menu = { "std_record_name" };
- char *tmp_filepath = generate_random_file_name(session, "voicemail_ivr", "wav" /* TODO make it configurable */);
+ const char *tmp_filepath = NULL;
+ const char *record_format = NULL;
/* Initialize Menu Configs */
menu_init(profile, &menu);
+ record_format = switch_event_get_header(menu.event_settings, "Record-Format");
+
+ tmp_filepath = generate_random_file_name(session, "voicemail_ivr", record_format);
+
status = vmivr_menu_record(session, profile, menu, tmp_filepath);
if (status == SWITCH_STATUS_SUCCESS) {
void vmivr_menu_set_password(switch_core_session_t *session, vmivr_profile_t *profile) {
char *password;
vmivr_menu_t menu = { "std_set_password" };
+ const char *password_mask = NULL;
/* Initialize Menu Configs */
menu_init(profile, &menu);
- password = vmivr_menu_get_input_set(session, profile, menu, "XXX." /* TODO Conf Min 3 Digit */);
+ password_mask = switch_event_get_header(menu.event_settings, "Password-Mask");
+
+ password = vmivr_menu_get_input_set(session, profile, menu, password_mask);
/* TODO Add Prompts to tell if password was set and if it was not */
if (password) {
profile->authorized = SWITCH_TRUE;
}
- for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0 && profile->authorized == SWITCH_FALSE; retry--) {
+ for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0 && profile->authorized == SWITCH_FALSE; retry--) {
const char *id = profile->id, *password = NULL;
char *cmd = NULL;
-
+ const char *password_mask = switch_event_get_header(menu.event_settings, "Password-Mask");
+ const char *user_mask = switch_event_get_header(menu.event_settings, "User-Mask");
if (!id) {
vmivr_menu_t sub_menu = { "std_authenticate_ask_user" };
/* Initialize Menu Configs */
menu_init(profile, &sub_menu);
- id = vmivr_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */);
+ id = vmivr_menu_get_input_set(session, profile, sub_menu, user_mask);
menu_free(&sub_menu);
}
if (!password) {
/* Initialize Menu Configs */
menu_init(profile, &sub_menu);
- password = vmivr_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */);
+ password = vmivr_menu_get_input_set(session, profile, sub_menu, password_mask);
menu_free(&sub_menu);
}
cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, id, password);
/* If user entered 0, we don't accept it */
if (gnum > 0) {
vmivr_menu_t sub_menu = { "std_record_greeting" };
- char *tmp_filepath = generate_random_file_name(session, "voicemail_ivr", "wav" /* TODO make it configurable */);
+ char *tmp_filepath = NULL;
+ const char *record_format = NULL;
+
switch_status_t status;
/* Initialize Menu Configs */
menu_init(profile, &sub_menu);
+ record_format = switch_event_get_header(menu.event_settings, "Record-Format");
+
+ tmp_filepath = generate_random_file_name(session, "voicemail_ivr", record_format);
+
status = vmivr_menu_record(session, profile, sub_menu, tmp_filepath);
if (status == SWITCH_STATUS_SUCCESS) {
menu_init(profile, &menu);
if (!menu.event_keys_dtmf || !menu.event_phrases) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys\n");
- return;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'\n", menu.name);
+ goto end;
}
- for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
+ for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {
menu_instance_init(&menu);
ivre_init(&menu.ivre_d, menu.dtmfa);
- ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
+ ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);
if (menu.ivre_d.result == RES_TIMEOUT) {
/* TODO Ask for the prompt Again IF retry != 0 */
const char *action = switch_event_get_header(menu.event_keys_dtmf, menu.ivre_d.dtmf_stored);
/* Reset the try count */
- retry = MAX_ATTEMPT;
+ retry = menu.ivr_maximum_attempts;
if (action) {
if (!strcasecmp(action, "return")) { /* Return to the previous menu */
menu_instance_free(&menu);
}
+end:
menu_free(&menu);
}
switch_channel_t *channel = switch_core_session_get_channel(session);
if (!menu.event_keys_dtmf || !menu.event_phrases) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys : %s\n", menu.name);
- return result;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'\n", menu.name);
+ goto end;
}
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 = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {
int i;
menu_instance_init(&menu);
if (terminate_key) {
menu.ivre_d.terminate_key = terminate_key[0];
}
- ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "instructions"), NULL, menu.phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
+ ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "instructions"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);
if (menu.ivre_d.result == RES_TIMEOUT) {
/* TODO Ask for the prompt Again IF retry != 0 */
} else if (menu.ivre_d.result == RES_FOUND) { /* Matching DTMF Key Pressed */
/* Reset the try count */
- retry = MAX_ATTEMPT;
+ retry = menu.ivr_maximum_attempts;
if (!strncasecmp(menu.ivre_d.completeMatch, input_mask, 1)) {
result = switch_core_session_strdup(session, menu.ivre_d.dtmf_stored);
}
menu_instance_free(&menu);
}
-
+end:
return result;
}
switch_bool_t play_instruction = SWITCH_TRUE;
if (!menu.event_keys_dtmf || !menu.event_phrases) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys\n");
- return status;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases or Keys in menu '%s'\n", menu.name);
+ goto end;
}
- for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) {
+ for (retry = menu.ivr_maximum_attempts; switch_channel_ready(channel) && retry > 0; retry--) {
switch_file_handle_t fh = { 0 };
-
- /* TODO Make the following configurable */
- fh.thresh = 200;
- fh.silence_hits = 4;
- //fh.samplerate = 8000;
+ const char *rec_silence_hits = switch_event_get_header(menu.event_settings, "Record-Silence-Hits");
+ const char *rec_silence_threshold = switch_event_get_header(menu.event_settings, "Record-Silence-Threshold");
+ const char *rec_silence_samplerate = switch_event_get_header(menu.event_settings, "Record-Sample-Rate");
+ const char *rec_maximum_length = switch_event_get_header(menu.event_settings, "Record-Maximum-Length");
+
+ fh.thresh = atoi(rec_silence_threshold);
+ fh.silence_hits = atoi(rec_silence_hits);
+ if (rec_silence_samplerate) {
+ fh.samplerate = atoi(rec_silence_samplerate);
+ }
menu_instance_init(&menu);
}
play_instruction = SWITCH_TRUE;
- ivre_record(session, &menu.ivre_d, menu.phrase_params, file_name, &fh, 30 /* TODO Make max recording configurable */);
+ ivre_record(session, &menu.ivre_d, menu.phrase_params, file_name, &fh, atoi(rec_maximum_length));
} else {
if (listen_recording) {
switch_event_add_header(menu.phrase_params, SWITCH_STACK_BOTTOM, "VM-Record-File-Path", "%s", file_name);
listen_recording = SWITCH_FALSE;
}
- ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, DEFAULT_IVR_TIMEOUT);
+ ivre_playback(session, &menu.ivre_d, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, menu.phrase_params, NULL, menu.ivr_entry_timeout);
}
if (menu.ivre_d.recorded_audio) {
/* Reset the try count */
- retry = MAX_ATTEMPT;
+ retry = menu.ivr_maximum_attempts;
/* TODO Check if message is too short */
const char *action = switch_event_get_header(menu.event_keys_dtmf, menu.ivre_d.dtmf_stored);
/* Reset the try count */
- retry = MAX_ATTEMPT;
+ retry = menu.ivr_maximum_attempts;
if (action) {
if (!strcasecmp(action, "listen")) { /* Listen */
}
menu_instance_free(&menu);
}
+
+end:
return status;
}