mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-06 18:30:01 +00:00
core: fire_asr_events should be true/false (FSCORE-406)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14447 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
9f5552524e
commit
6088b7e39a
@ -2073,19 +2073,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
|
|||||||
switch_status_t status;
|
switch_status_t status;
|
||||||
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
|
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
|
||||||
struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
|
struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
|
||||||
switch_codec_implementation_t read_impl = {0};
|
switch_codec_implementation_t read_impl = {0};
|
||||||
switch_core_session_get_read_impl(session, &read_impl);
|
switch_core_session_get_read_impl(session, &read_impl);
|
||||||
|
const char *p;
|
||||||
|
|
||||||
if (!ah) {
|
if (!ah) {
|
||||||
if (!(ah = switch_core_session_alloc(session, sizeof(*ah)))) {
|
if (!(ah = switch_core_session_alloc(session, sizeof(*ah)))) {
|
||||||
return SWITCH_STATUS_MEMERR;
|
return SWITCH_STATUS_MEMERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((switch_channel_get_variable(channel, "fire_asr_events"))) {
|
|
||||||
switch_set_flag(ah, SWITCH_ASR_FLAG_FIRE_EVENTS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sth) {
|
if (sth) {
|
||||||
if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
|
if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Error loading Grammar\n");
|
||||||
@ -2093,6 +2090,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
|
|||||||
return SWITCH_STATUS_FALSE;
|
return SWITCH_STATUS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((p = switch_channel_get_variable(channel, "fire_asr_events")) && switch_true(p)) {
|
||||||
|
switch_set_flag(sth->ah, SWITCH_ASR_FLAG_FIRE_EVENTS);
|
||||||
|
}
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2118,6 +2119,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
|
|||||||
sth->session = session;
|
sth->session = session;
|
||||||
sth->ah = ah;
|
sth->ah = ah;
|
||||||
|
|
||||||
|
if ((p = switch_channel_get_variable(channel, "fire_asr_events")) && switch_true(p)) {
|
||||||
|
switch_set_flag(ah, SWITCH_ASR_FLAG_FIRE_EVENTS);
|
||||||
|
}
|
||||||
|
|
||||||
if ((status = switch_core_media_bug_add(session, speech_callback, sth, 0, SMBF_READ_STREAM, &sth->bug)) != SWITCH_STATUS_SUCCESS) {
|
if ((status = switch_core_media_bug_add(session, speech_callback, sth, 0, SMBF_READ_STREAM, &sth->bug)) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_core_asr_close(ah, &flags);
|
switch_core_asr_close(ah, &flags);
|
||||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user