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:
parent
eddf09ddd0
commit
2a99ebd1da
|
|
@ -81,6 +81,11 @@
|
||||||
return ''
|
return ''
|
||||||
end
|
end
|
||||||
local transcribe_json = JSON.decode(transcribe_result);
|
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 (debug["info"]) then
|
||||||
if (transcribe_json["results"][1]["name"] == nil) then
|
if (transcribe_json["results"][1]["name"] == nil) then
|
||||||
freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: (null) \n");
|
freeswitch.consoleLog("notice", "[voicemail] TRANSCRIPTION: (null) \n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue