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: