if (!(component->grammar = srgs_parse(globals.parser, iks_find_cdata(input, "grammar")))) {
*stanza_error = STANZA_ERROR_BAD_REQUEST;
*error_detail = "Failed to parse grammar body";
+ switch_safe_free(grammar.data);
return NULL;
}
if (!jsgf_path) {
*stanza_error = STANZA_ERROR_BAD_REQUEST;
*error_detail = "Grammar conversion to JSGF error";
+ switch_safe_free(grammar.data);
return NULL;
}
switch_mutex_lock(component->handler->mutex);
*stanza_error = STANZA_ERROR_INTERNAL_SERVER_ERROR;
*error_detail = "Failed to initialize recognizer";
+ switch_safe_free(grammar_uri_list.data);
return NULL;
}
switch_mutex_lock(component->handler->mutex);
struct rayo_file_context *context = handle->private_info;
struct output_component *output = context->component ? OUTPUT_COMPONENT(context->component) : NULL;
+ if (!output) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing output component!\n");
+ return SWITCH_STATUS_FALSE;
+ }
+
top:
if (switch_test_flag((&context->fh), SWITCH_FILE_OPEN)) {
//switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->uuid), SWITCH_LOG_DEBUG, "Read file %"SWITCH_SIZE_T_FMT" bytes\n", o_len * 2);
/* add file data to audio bufer */
- read_bytes = switch_buffer_write(fh->audio_buffer, context->abuf, o_len * 2);
- //switch_log_printf(SWITCH_CHANNEL_UUID_LOG(context->uuid), SWITCH_LOG_DEBUG, "Write audio frame %"SWITCH_SIZE_T_FMT" bytes\n", read_bytes);
+ switch_buffer_write(fh->audio_buffer, context->abuf, o_len * 2);
read_bytes = switch_buffer_read(fh->audio_buffer, context->abuf, *len * 2);
o_len = read_bytes / 2;
if (wrote_len < new_len) {
switch_size_t r_len = new_len - wrote_len;
switch_buffer_write(fh->sp_audio_buffer, bp, r_len * 2);
- wrote_len += r_len;
}
continue;
}