#include <switch.h>
#include <pocketsphinx.h>
+#include <sphinxbase/err.h>
SWITCH_MODULE_LOAD_FUNCTION(mod_pocketsphinx_load);
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_pocketsphinx_shutdown);
model = switch_mprintf("%s%smodel%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR, globals.model);
+ if (switch_file_exists(dic, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open dictionary.\n");
+ goto end;
+ }
+
+ if (switch_file_exists(lm, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open language model.\n");
+ goto end;
+ }
+
switch_assert(lm && dic && model);
ps->config = cmd_ln_init(ps->config, ps_args(), FALSE,
asr_interface->asr_get_results = pocketsphinx_asr_get_results;
globals.model = switch_core_strdup(pool, "communicator");
-
+ err_set_logfp(NULL);
+
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}