Hi,
There is an application that uses the ESL protocol.
The application just a set of of the "play_and_detect_speech" calls like this:
play_and_detect_speech "/tmp/silence_temp.wav detect:unimrcp:ls {start-input-timers=false,no-input-timeout=5000,recognition-timeout=30000,Speech-Complete-Timeout=1000,Speech-Language=ru-RU,Speech-Incomplete-Timeout=1500,define-grammar=true,save-waveform=true,waveform=true,swirec_vad_mode=1,swirec_vad_level=2,swirec_vad_speech_timeout=120}builtin:grammar/numbers_5d09dc7bdab38b3abfe8fae3?language=ru-RU"
The problem is that all "play_and_detect_speech" calls use the profile from the first call.
It appears that the "switch_ivr_detect_speech" function just reuse the existing ASR connection, i.e. the "switch_ivr_detect_speech_init" function is called only once per a sip session.
According to the sources of the mod_dptools, it is possible to use the "detect_speech" with "init" argument, but there is no any mentions of this argument in the official documentation. I am also not sure that the "init" implemented correctly, because it just pass NULL in the "ah" argument, but the previous ah handler stays open.
The patch I made just checks whether the profile name was changed, if it is so the previous ah handled closes, and new one initializes.