Update record_message.lua

Improve the indentation
This commit is contained in:
FusionPBX 2020-10-27 20:02:19 -06:00 committed by GitHub
parent c0e0cd3101
commit afcbdaf676
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 57 additions and 59 deletions

View File

@ -283,8 +283,7 @@
local transcription_server = settings:get('voicemail', 'google_url', 'text') or '';
if (api_key ~= '') then
transcribe_cmd = [[sox ]]..file_path..[[ ]]..file_path..[[.flac && echo "{ 'config': { 'languageCode': 'en-US', 'enableWordTimeOffsets': false }, 'audio': { 'content': '`base64 -w 0 ]]..file_path..[[.flac`' } }" | curl -X POST -H "Content-Type: application/json" -d @- "]]..transcription_server..[[:recognize?key=]]..api_key..[[" && rm -f ]]..file_path..[[.flac]]
end
end
local handle = io.popen(transcribe_cmd);
local transcribe_result = handle:read("*a");
@ -308,7 +307,6 @@ end
return '';
end
end
if (transcribe_json["results"] ~= nil) then
--Transcription
if (transcribe_json["results"][1]["alternatives"][1]["transcript"] ~= nil) then
@ -396,9 +394,9 @@ end
local message_max_length = settings:get('voicemail', 'message_max_length', 'numeric') or 300;
local message_silence_threshold = settings:get('voicemail', 'message_silence_threshold', 'numeric') or 200;
local message_silence_seconds = settings:get('voicemail', 'message_silence_seconds', 'numeric') or 3;
transcribe_enabled = settings:get('voicemail', 'transcribe_enabled', 'boolean') or "false";
local email_queue_enabled = settings:get('email_queue', 'enabled', 'boolean') or "false";
local transcribe_provider = settings:get('voicemail', 'transcribe_provider', 'text') or '';
local email_method = settings:get('email', 'method', 'text') or "smtp";
transcribe_enabled = settings:get('voicemail', 'transcribe_enabled', 'boolean') or "false";
--debug information
if (debug["info"]) then
@ -528,7 +526,7 @@ end
start_epoch = os.time();
--if using the email queue disable inline transcription
if (email_method == 'queue') then
if (email_queue_enabled == 'true') then
transcribe_enabled = 'false';
end