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:
Michael Jerris 2009-08-01 05:29:50 +00:00
parent 9f5552524e
commit 6088b7e39a
1 changed files with 12 additions and 7 deletions

View File

@ -2073,19 +2073,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
switch_status_t status;
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
switch_codec_implementation_t read_impl = {0};
switch_core_session_get_read_impl(session, &read_impl);
switch_codec_implementation_t read_impl = {0};
switch_core_session_get_read_impl(session, &read_impl);
const char *p;
if (!ah) {
if (!(ah = switch_core_session_alloc(session, sizeof(*ah)))) {
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 (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");
@ -2093,6 +2090,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
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;
}
@ -2118,6 +2119,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
sth->session = session;
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) {
switch_core_asr_close(ah, &flags);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);