0

While using mod_unimrcp in freeswitch (with license) in lua script, speech is detected but not matched correctly with grammar. It shows 001-no match,but actually it matches with grammar. While trying in javascript, grammar does not load and speech does not detect. How can I solve this? Exception: SyntaxError: missing ) after the argument list "

session.execute("play_and_detect_speech") data=(/thilip/welcome.wavdetect:unimrcp:uni2 {start-input-timers=false,no-input-timeout=5000,recognition-timeout=5000} file:// /usr/local/freeswitch/grammar/sr.gram language=en-US;y=1;n=2 "

this is the line

Piglet
  • 27,501
  • 3
  • 20
  • 43
thilip an
  • 31
  • 3
  • you add the missing `)` after the argument list? – Piglet Sep 16 '22 at 09:31
  • if i close the argument it again shows SyntaxError: Unexpected identifier (near: " – thilip an Sep 16 '22 at 10:16
  • share your code. – Piglet Sep 16 '22 at 10:32
  • session.execute("play_and_detect_speech") data=(/thilip/welcome.wavdetect:unimrcp:uni2 {start-input-timers=false,no-input-timeout=5000,recognition-timeout=5000} file:// /usr/local/freeswitch/grammar/sr.gram language=en-US;y=1;n=2 " this is the line – thilip an Sep 16 '22 at 10:58

1 Answers1

0

session.execute("play_and_detect_speech") is syntactically correct.

data=(/thilip/welcome.wavdetect:unimrcp:uni2 {start-input-timers=false,no-input-timeout=5000,recognition-timeout=5000} file:// /usr/local/freeswitch/grammar/sr.gram language=en-US;y=1;n=2 " is not.

The only way to turn this into valid Lua code is to assign a string to data.

data="(/thilip/welcome.wavdetect:unimrcp:uni2 {start-input-timers=false,no-input-timeout=5000,recognition-timeout=5000} file:// /usr/local/freeswitch/grammar/sr.gram language=en-US;y=1;n=2 "

You cannot have something like data=(/thili... and you cannot have a single double quote nor anyhting else of that stuff outside a string.

Piglet
  • 27,501
  • 3
  • 20
  • 43
  • [ERR] mod_dptools.c:524 Usage: detect: {param1=val1,param2=val2} 2022-09-19 05:09:17.944858 98.23% [ERR] mod_lua.cpp:202 /usr/local/freeswitch/scripts/names.lua:27: attempt to concatenate global 'xml' (a nil value) stack traceback: /usr/local/freeswitch/scripts/names.lua:27: in main chunk bro this is the error i got while running lua script. – thilip an Sep 19 '22 at 05:11
  • so i changed the line to session:execute("play_and_detect_speech",menu .. "detect:unimrcp {start-input-timers=false,no-input-timeout=" .. no_input_timeout .. ",recognition-timeout=" .. recognition_timeout .. "}" .. grammar) here i got 001-no match error – thilip an Sep 19 '22 at 05:15
  • https://freeswitch.org/confluence/display/FREESWITCH/ASR this is the link where i follow lua script pls do help to come out of this issue – thilip an Sep 19 '22 at 05:30