diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 8641766760..f379f02030 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -224,6 +224,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_disable_all_grammars(sw SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val); +/*! + \brief Start input timers on a background speech detection handle + \param session The session to start the timers on + \return SWITCH_STATUS_SUCCESS if all is well +*/ +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_start_input_timers(switch_core_session_t *session); + /*! \brief Record a session to disk \param session the session to record diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f573661165..fe089a6a50 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -96,7 +96,7 @@ SWITCH_STANDARD_DIALPLAN(inline_dialplan_hunt) return extension; } -#define DETECT_SPEECH_SYNTAX " [] OR grammar [] OR nogrammar OR grammaron/grammaroff OR grammarsalloff OR pause OR resume OR stop OR param " +#define DETECT_SPEECH_SYNTAX " [] OR grammar [] OR nogrammar OR grammaron/grammaroff OR grammarsalloff OR pause OR resume OR start_input_timers OR stop OR param " SWITCH_STANDARD_APP(detect_speech_function) { char *argv[4]; @@ -123,6 +123,8 @@ SWITCH_STANDARD_APP(detect_speech_function) switch_ivr_stop_detect_speech(session); } else if (!strcasecmp(argv[0], "param")) { switch_ivr_set_param_detect_speech(session, argv[1], argv[2]); + } else if (!strcasecmp(argv[0], "start_input_timers")) { + switch_ivr_detect_speech_start_input_timers(session); } else if (argc >= 3) { switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL); } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 672750a4c3..66cd36963b 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2729,6 +2729,18 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_s return status; } +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_start_input_timers(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY); + + if (sth) { + switch_core_asr_start_input_timers(sth->ah); + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name) { switch_channel_t *channel = switch_core_session_get_channel(session);