mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-10-29 06:34:19 +00:00
sprinkle digit_timeout into switch_ivr_read and switch_ivr_play_and_get_digits and the higher level variants
This commit is contained in:
1 parent
b4548a606e
commit
cfa30468e8
12 files changed
+120
-50
No files matched your search
@@ -649,25 +649,25 @@ static switch_status_t listen_entry(switch_core_session_t *session, dir_profile_
|
||||
|
||||
if (zstr_buf(buf)) {
|
||||
switch_snprintf(macro, sizeof(macro), "phrase:%s:%d", DIR_RESULT_ITEM, cbt->want + 1);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0);
|
||||
}
|
||||
|
||||
if (!zstr_buf(recorded_name) && zstr_buf(buf)) {
|
||||
switch_ivr_read(session, 0, 1, recorded_name, NULL, buf, sizeof(buf), 1, profile->terminator_key);
|
||||
switch_ivr_read(session, 0, 1, recorded_name, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0);
|
||||
|
||||
}
|
||||
if (zstr_buf(recorded_name) && zstr_buf(buf)) {
|
||||
switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_SAY_NAME, cbt->fullname);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0);
|
||||
}
|
||||
if (cbt->exten_visible && zstr_buf(buf)) {
|
||||
switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", DIR_RESULT_AT, cbt->extension);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key, 0);
|
||||
}
|
||||
if (zstr_buf(buf)) {
|
||||
switch_snprintf(macro, sizeof(macro), "phrase:%s:%c,%c,%c,%c", DIR_RESULT_MENU, *profile->select_name_key, *profile->next_key, *profile->prev_key,
|
||||
*profile->new_search_key);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), profile->digit_timeout, profile->terminator_key);
|
||||
switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), profile->digit_timeout, profile->terminator_key, 0);
|
||||
}
|
||||
|
||||
if (!zstr_buf(buf)) {
|
||||
|
||||
@@ -1712,10 +1712,11 @@ SWITCH_STANDARD_APP(att_xfer_function)
|
||||
SWITCH_STANDARD_APP(read_function)
|
||||
{
|
||||
char *mydata;
|
||||
char *argv[6] = { 0 };
|
||||
char *argv[7] = { 0 };
|
||||
int argc;
|
||||
int32_t min_digits = 0;
|
||||
int32_t max_digits = 0;
|
||||
uint32_t digit_timeout = 0;
|
||||
int timeout = 1000;
|
||||
char digit_buffer[128] = "";
|
||||
const char *prompt_audio_file = NULL;
|
||||
@@ -1751,6 +1752,13 @@ SWITCH_STANDARD_APP(read_function)
|
||||
valid_terminators = argv[5];
|
||||
}
|
||||
|
||||
if (argc > 6) {
|
||||
digit_timeout = atoi(argv[6]);
|
||||
if (digit_timeout < 0) {
|
||||
digit_timeout = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (min_digits <= 1) {
|
||||
min_digits = 1;
|
||||
}
|
||||
@@ -1767,17 +1775,19 @@ SWITCH_STANDARD_APP(read_function)
|
||||
valid_terminators = "#";
|
||||
}
|
||||
|
||||
switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators);
|
||||
switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators,
|
||||
digit_timeout);
|
||||
}
|
||||
|
||||
SWITCH_STANDARD_APP(play_and_get_digits_function)
|
||||
{
|
||||
char *mydata;
|
||||
char *argv[9] = { 0 };
|
||||
char *argv[10] = { 0 };
|
||||
int argc;
|
||||
int32_t min_digits = 0;
|
||||
int32_t max_digits = 0;
|
||||
int32_t max_tries = 0;
|
||||
uint32_t digit_timeout = 0;
|
||||
int timeout = 1000;
|
||||
char digit_buffer[128] = "";
|
||||
const char *prompt_audio_file = NULL;
|
||||
@@ -1827,6 +1837,14 @@ SWITCH_STANDARD_APP(play_and_get_digits_function)
|
||||
digits_regex = argv[8];
|
||||
}
|
||||
|
||||
if (argc > 9) {
|
||||
digit_timeout = atoi(argv[9]);
|
||||
if (digit_timeout < 0) {
|
||||
digit_timeout = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (min_digits <= 1) {
|
||||
min_digits = 1;
|
||||
}
|
||||
@@ -1844,7 +1862,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function)
|
||||
}
|
||||
|
||||
switch_play_and_get_digits(session, min_digits, max_digits, max_tries, timeout, valid_terminators,
|
||||
prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex);
|
||||
prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex, digit_timeout);
|
||||
}
|
||||
|
||||
#define SAY_SYNTAX "<module_name> <say_type> <say_method> [<say_gender>] <text>"
|
||||
@@ -3367,9 +3385,11 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load)
|
||||
SWITCH_ADD_APP(app_interface, "endless_playback", "Playback File Endlessly", "Endlessly Playback a file to the channel",
|
||||
endless_playback_function, "<path>", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "<channel_url>", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, "<min> <max> <file> <var_name> <timeout> <terminators>", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function,
|
||||
"<min> <max> <file> <var_name> <timeout> <terminators> <digit_timeout>", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "play_and_get_digits", "Play and get Digits", "Play and get Digits",
|
||||
play_and_get_digits_function, "<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp>", SAF_NONE);
|
||||
play_and_get_digits_function,
|
||||
"<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp> [<digit_timeout>]", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE);
|
||||
SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path> [+<timeout>]", SAF_MEDIA_TAP);
|
||||
SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function,
|
||||
|
||||
@@ -203,7 +203,7 @@ SWITCH_STANDARD_APP(valet_parking_function)
|
||||
}
|
||||
|
||||
do {
|
||||
status = switch_ivr_read(session, min, max, prompt, NULL, dtmf_buf, sizeof(dtmf_buf), to, "#");
|
||||
status = switch_ivr_read(session, min, max, prompt, NULL, dtmf_buf, sizeof(dtmf_buf), to, "#", 0);
|
||||
} while (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_FALSE);
|
||||
|
||||
if (status == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
@@ -1524,7 +1524,7 @@ static switch_status_t listen_file(switch_core_session_t *session, vm_profile_t
|
||||
vm_cc[0] = '\0';
|
||||
|
||||
TRY_CODE(switch_ivr_read
|
||||
(session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key));
|
||||
(session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key, 0));
|
||||
|
||||
cmd = switch_core_session_sprintf(session, "%s@%s %s %s '%s'", vm_cc, cbt->domain, new_file_path, cbt->cid_number, cbt->cid_name);
|
||||
|
||||
@@ -1988,7 +1988,7 @@ static void voicemail_check_main(switch_core_session_t *session, vm_profile_t *p
|
||||
switch_xml_t xx_user, xx_domain, xx_domain_root;
|
||||
|
||||
switch_snprintf(macro, sizeof(macro), "phrase:%s:%s", VM_ENTER_PASS_MACRO, profile->terminator_key);
|
||||
TRY_CODE(switch_ivr_read(session, 0, 255, macro, NULL, buf, sizeof(buf), 10000, profile->terminator_key));
|
||||
TRY_CODE(switch_ivr_read(session, 0, 255, macro, NULL, buf, sizeof(buf), 10000, profile->terminator_key, 0));
|
||||
sql = switch_mprintf("update voicemail_prefs set password='%s' where username='%s' and domain='%s'", buf, myid, domain_name);
|
||||
vm_execute_sql(profile, sql, profile->mutex);
|
||||
switch_safe_free(file_path);
|
||||
|
||||
Reference in new issue
Block a user