uint32_t max_digits,
uint32_t max_tries,
uint32_t timeout,
- char *valid_terminators,
- char *audio_file,
- char *bad_input_audio_file, char *digit_buffer, uint32_t digit_buffer_length,
- char *digits_regex);
+ const char *valid_terminators,
+ const char *audio_file,
+ const char *bad_input_audio_file, char *digit_buffer, uint32_t digit_buffer_length,
+ const char *digits_regex);
SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text_handle(switch_core_session_t *session,
switch_speech_handle_t *sh,
switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, sizeof(digit_buffer), timeout, valid_terminators);
}
+SWITCH_STANDARD_APP(play_and_get_digits_function)
+{
+ char *mydata;
+ char *argv[8] = { 0 };
+ int argc;
+ int32_t min_digits = 0;
+ int32_t max_digits = 0;
+ int32_t max_tries = 0;
+ int timeout = 1000;
+ char digit_buffer[128] = "";
+ const char *prompt_audio_file = NULL;
+ const char *bad_input_audio_file = NULL;
+ const char *valid_terminators = NULL;
+ const char *digits_regex = NULL;
+
+ if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
+ argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No arguments specified.\n");
+ return;
+ }
+
+ min_digits = atoi(argv[0]);
+
+ if (argc > 1) {
+ max_digits = atoi(argv[1]);
+ }
+ if (argc > 2) {
+ max_tries = atoi(argv[2]);
+ }
+
+ if (argc > 3) {
+ timeout = atoi(argv[3]);
+ }
+
+ if (argc > 4) {
+ valid_terminators = argv[4];
+ }
+
+ if (argc > 5) {
+ prompt_audio_file = argv[5];
+ }
+
+ if (argc > 6) {
+ bad_input_audio_file = argv[6];
+ }
+
+ if (argc > 7) {
+ digits_regex = argv[7];
+ }
+
+ if (switch_strlen_zero(valid_terminators)) {
+ valid_terminators = "#";
+ }
+
+ switch_play_and_get_digits(session, min_digits, max_digits, max_tries, timeout, valid_terminators,
+ prompt_audio_file, bad_input_audio_file, digit_buffer, sizeof(digit_buffer), digits_regex);
+}
#define SAY_SYNTAX "<module_name> <say_type> <say_method> <text>"
SWITCH_STANDARD_APP(say_function)
SWITCH_ADD_APP(app_interface, "playback", "Playback File", "Playback a file to the channel", 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, "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> <regexp>", 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_NONE);
SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function,