struct record_helper *rh = NULL;
int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT;
- switch_core_session_get_read_impl(session, &read_impl);
+ switch_core_session_get_read_impl(session, &read_impl);
if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
return SWITCH_STATUS_FALSE;
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
+ switch_status_t status;
if (sth) {
- if (switch_core_asr_load_grammar(sth->ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
+ if ((status = switch_core_asr_load_grammar(sth->ah, grammar, name)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error loading Grammar\n");
switch_core_asr_close(sth->ah, &flags);
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_FALSE;
}
- return SWITCH_STATUS_SUCCESS;
+ return status;
}
return SWITCH_STATUS_FALSE;
}
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
+ switch_status_t status;
if (sth) {
- if (switch_core_asr_unload_grammar(sth->ah, name) != SWITCH_STATUS_SUCCESS) {
+ if ((status = switch_core_asr_unload_grammar(sth->ah, name)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error unloading Grammar\n");
switch_core_asr_close(sth->ah, &flags);
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_FALSE;
}
- return SWITCH_STATUS_SUCCESS;
+ return status;
}
return SWITCH_STATUS_FALSE;
}
return SWITCH_STATUS_SUCCESS;
}
- if (switch_core_asr_open(ah,
+ if ((status = switch_core_asr_open(ah,
mod_name,
"L16",
read_impl.actual_samples_per_second, dest, &flags,
- switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+ switch_core_session_get_pool(session))) == SWITCH_STATUS_SUCCESS) {
if (switch_core_asr_load_grammar(ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error loading Grammar\n");
switch_core_asr_close(ah, &flags);
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
return SWITCH_STATUS_FALSE;
}
} else {
- switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
- return SWITCH_STATUS_FALSE;
+ return status;
}
sth = switch_core_session_alloc(session, sizeof(*sth));
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);
return status;
}
if (need_create) {
memset(sh, 0, sizeof(*sh));
- if (switch_core_speech_open(sh, tts_name, voice_name, (uint32_t) rate, interval,
- &flags, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ if ((status = switch_core_speech_open(sh, tts_name, voice_name, (uint32_t) rate, interval,
+ &flags, switch_core_session_get_pool(session))) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid TTS module!\n");
switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
if (cache_obj) {
switch_channel_set_private(channel, SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME, NULL);
}
- return SWITCH_STATUS_FALSE;
+ return status;
}
} else if (cache_obj && strcasecmp(cache_obj->voice_name, voice_name)) {
switch_copy_string(cache_obj->voice_name, voice_name, sizeof(cache_obj->voice_name));