From 8b4433720e94247dd4f40e310e3bfe3727b7a136 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 5 Aug 2008 21:50:48 +0000 Subject: [PATCH] _ | | ____ ____ ____| | ____ ____ ____ / _ ) _ |/ ___) |/ _ | _ \ / _ | ( (/ ( ( | | | | ( ( | | | | ( ( | | \____)_||_|_| |_|\_||_|_| |_|\_|| | (_____| git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9225 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_types.h | 1 + src/switch_ivr.c | 1 + src/switch_ivr_play_say.c | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 07d3f79ef4..b23fa2d662 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -110,6 +110,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_PATH_SEPARATOR "/" #endif #define SWITCH_URL_SEPARATOR "://" +#define SWITCH_READ_RESULT_VARIABLE "read_result" #define SWITCH_COPY_XML_CDR_VARIABLE "copy_xml_cdr" #define SWITCH_CURRENT_APPLICATION_VARIABLE "current_application" #define SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE "proto_specific_hangup_cause" diff --git a/src/switch_ivr.c b/src/switch_ivr.c index b0c76dbd93..06bf8a372d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -760,6 +760,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess if (eff_timeout) { digit_elapsed = (uint32_t) ((switch_timestamp_now() - digit_started) / 1000); if (digit_elapsed >= eff_timeout) { + status = SWITCH_STATUS_TIMEOUT; break; } } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index f79b492c98..196b4b84fd 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1371,6 +1371,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, switch_assert(session); channel = switch_core_session_get_channel(session); + switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, NULL); if (digit_buffer_length < min_digits || digit_buffer_length < max_digits) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Buffer too small!\n"); @@ -1400,6 +1401,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session, status = switch_ivr_collect_digits_count(session, digit_buffer, digit_buffer_length, max_digits, valid_terminators, &terminator, timeout, 0, 0); } + if (status == SWITCH_STATUS_SUCCESS) { + switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, "success"); + } else if (status == SWITCH_STATUS_TIMEOUT) { + switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, "timeout"); + } else { + switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, "failure"); + } + end: