make mod_openmrcp profile name choosable from engine_name parameter e.g. openmrcp:myprofile

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6012 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale
2007-10-20 17:42:35 +00:00
parent 6b2a40b938
commit c86155c6bf
5 changed files with 88 additions and 69 deletions
+18 -1
View File
@@ -44,13 +44,23 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *
switch_memory_pool_t *pool)
{
switch_status_t status;
char buf[256] = "";
char *param = NULL;
if (strchr(module_name, ':')) {
switch_set_string(buf, module_name);
if ((param = strchr(buf, ':'))) {
*param++ = '\0';
module_name = buf;
}
}
if ((sh->speech_interface = switch_loadable_module_get_speech_interface(module_name)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid speech module [%s]!\n", module_name);
return SWITCH_STATUS_GENERR;
}
switch_copy_string(sh->engine, module_name, sizeof(sh->engine));
sh->flags = *flags;
if (pool) {
sh->memory_pool = pool;
@@ -60,6 +70,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *
}
switch_set_flag(sh, SWITCH_SPEECH_FLAG_FREE_POOL);
}
sh->engine = switch_core_strdup(sh->memory_pool, module_name);
if (param) {
sh->param = switch_core_strdup(sh->memory_pool, param);
}
sh->rate = rate;
sh->name = switch_core_strdup(pool, module_name);
sh->samples = switch_bytes_per_frame(rate, interval);