Added check if transcription result is nil (#3724)

If the message is too short then the result is nil.
Error occurs in this case: record_message.lua:97: attempt to index field 'results' (a nil value) 
Added check if transcribe_json["results"] is nil.
This commit is contained in:
sergey-mz 2018-10-26 12:25:08 -04:00 committed by FusionPBX
parent ed48f3aba5
commit c4962c460e
1 changed files with 5 additions and 0 deletions

View File

@ -81,6 +81,11 @@
return ''
end
local transcribe_json = JSON.decode(transcribe_result);
--Trancribe result can be nil
if (transcribe_json["results"] == nil) then
freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: results = (null) \n");
return ''
end
if (debug["info"]) then
if (transcribe_json["results"][1]["name"] == nil) then
freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: (null) \n");