I made an incorrect assumption with the way multiple grammar loading in FreeSWITCH worked, so the last patch was doing it incorrectly.
From mod_unimrcp.c lines 3085-3097, inside recog_asr_load_grammar():
start_recognize = (char *) switch_core_hash_find(schannel->params, "start-recognize");
if (zstr(start_recognize) || strcasecmp(start_recognize, "false"))
{
if (recog_channel_disable_all_grammars(schannel) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
goto done;
}
if (recog_channel_enable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
status = SWITCH_STATUS_FALSE;
goto done;
}
status = recog_channel_start(schannel);
}
As you can see unless start-recognize is set to false in your unimrcp profile (under <recogparams/>) FreeSWITCH will disable all grammars whenever you load one. Which means recognition will only work for the last grammar you load. Also, you need to initialize speech detection with a detect_speech call before loading other grammars. You should have in your profile something like:
This patch makes sure to initialize detection first, then load grammars second, then finally after all are loaded running a detect_speech resume to start using them all. However multiple grammars will only work if start-recognize is set to false as mentioned above.
This seems to be working well for me to load multiple grammars, including DTMF grammars with LumenVox; and I am getting speech results properly for any matches to the grammars.
I made an incorrect assumption with the way multiple grammar loading in FreeSWITCH worked, so the last patch was doing it incorrectly.
From
mod_unimrcp.c
lines 3085-3097, insiderecog_asr_load_grammar()
:As you can see unless
start-recognize
is set tofalse
in your unimrcp profile (under<recogparams/>
) FreeSWITCH will disable all grammars whenever you load one. Which means recognition will only work for the last grammar you load. Also, you need to initialize speech detection with adetect_speech
call before loading other grammars. You should have in your profile something like:This patch makes sure to initialize detection first, then load grammars second, then finally after all are loaded running a
detect_speech resume
to start using them all. However multiple grammars will only work ifstart-recognize
is set tofalse
as mentioned above.This seems to be working well for me to load multiple grammars, including DTMF grammars with LumenVox; and I am getting speech results properly for any matches to the grammars.