Modified: freeswitch/trunk/src/switch_ivr_async.c (14446 => 14447)
--- freeswitch/trunk/src/switch_ivr_async.c 2009-08-01 03:41:58 UTC (rev 14446)
+++ freeswitch/trunk/src/switch_ivr_async.c 2009-08-01 05:29:50 UTC (rev 14447)
@@ -2073,19 +2073,16 @@
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 @@
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 @@
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);