Error in Pizza demo Javascript program (Freeswitch)

Status
Not open for further replies.

chandramouli

New Member
Jun 19, 2018
12
0
1
44
Hello,

I installed FreeSwitch and enabled PocketSphinx and Javascript modules successfully. When I called an extension to execute the default Pizza demo program (Java script), I am getting the below error:

EXECUTE [depth=0] sofia/chandramouli/1101@test.abc.in:5072 javascript(ps_pizza.js)
2024-03-09 18:32:09.423106 99.27% [ERR] undefined:188 Exception: SyntaxError: Invalid or unexpected token (near: " console_log("debug", "----Hit score " + result.interpretation.@confidence + "/" + ")
2024-03-09 18:32:09.423106 99.27% [NOTICE] switch_core_state_machine.c:382 sofia/chandramouli/1101@test.abc.in:5072 has executed the last dialplan instruction, hanging up.

Based on the error line number in console log, I noticed that It is showing the error in scripts/js_modules/SpeechTools.jm file at the below line:
console_log("debug", "----Hit score " + result.interpretation.@confidence + "/" +
grammar_object.min_score + "/" + grammar_object.confirm_score + "\n");


I haven't changed anything in the source code. Is there any issue in the above source code? Any help would be appreciated. Thank you.

Best Regards,
Chandramouli.
 

Adrian Fretwell

Well-Known Member
Aug 13, 2017
1,498
413
83
Try to break the problem down - split up the console_log statement, the error may then give you a better clue as to what is wrong. The error does state "undefined" so you could be looking for an out of scope variable or typo.

Code:
console_log("debug", "----Hit score \n");
console_log("debug", result.interpretation.@confidence + "\n");
console_log("debug", grammar_object.min_score + "\n");
console_log("debug", grammar_object.confirm_score + "\n");
 
Status
Not open for further replies.