move the models into the config so you can override them and set the defaults if you dont
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@9083 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
293915f4c3
commit
94a420c961
|
@ -49,6 +49,7 @@ static struct {
|
|||
uint32_t silence_hits;
|
||||
uint32_t listen_hits;
|
||||
int auto_reload;
|
||||
switch_memory_pool_t *pool;
|
||||
} globals;
|
||||
|
||||
typedef enum {
|
||||
|
@ -442,9 +443,22 @@ static switch_status_t load_config(void)
|
|||
globals.listen_hits = atoi(val);
|
||||
} else if (!strcasecmp(var, "auto-reload")) {
|
||||
globals.auto_reload = switch_true(val);
|
||||
} else if (!strcasecmp(var, "narrowband_model")) {
|
||||
globals.model8k = switch_core_strdup(globals.pool, val);
|
||||
} else if (!strcasecmp(var, "wideband_model")) {
|
||||
globals.model16k = switch_core_strdup(globals.pool, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!globals.model8k) {
|
||||
globals.model8k = switch_core_strdup(globals.pool, "communicator");
|
||||
}
|
||||
|
||||
if (!globals.model16k) {
|
||||
globals.model16k = switch_core_strdup(globals.pool, "wsj1");
|
||||
}
|
||||
|
||||
done:
|
||||
if (xml) {
|
||||
switch_xml_free(xml);
|
||||
|
@ -474,6 +488,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_pocketsphinx_load)
|
|||
|
||||
switch_mutex_init(&MUTEX, SWITCH_MUTEX_NESTED, pool);
|
||||
|
||||
globals.pool = pool;
|
||||
|
||||
if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
|
||||
}
|
||||
|
@ -495,9 +511,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_pocketsphinx_load)
|
|||
asr_interface->asr_check_results = pocketsphinx_asr_check_results;
|
||||
asr_interface->asr_get_results = pocketsphinx_asr_get_results;
|
||||
|
||||
globals.model8k = switch_core_strdup(pool, "communicator");
|
||||
globals.model16k = switch_core_strdup(pool, "wsj1");
|
||||
|
||||
err_set_logfp(NULL);
|
||||
|
||||
/* indicate that the module should continue to be loaded */
|
||||
|
|
Loading…
Reference in New Issue