Merge pull request #5842 from junction1153/patch-9

Update record_message.lua
This commit is contained in:
FusionPBX
2021-03-22 22:06:26 -06:00
committed by GitHub

View File

@@ -282,7 +282,7 @@
local api_key = settings:get('voicemail', 'google_key', 'text') or '';
local transcription_server = settings:get('voicemail', 'google_url', 'text') or '';
if (api_key ~= '') then
transcribe_cmd = [[sox ]]..file_path..[[ ]]..file_path..[[.flac trim 0 00:59 && echo "{ 'config': { 'languageCode': 'en-US', 'enableWordTimeOffsets': false , 'enableAutomaticPunctuation': true , 'alternativeLanguageCodes': 'es' }, '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]]
transcribe_cmd = [[sox ]]..file_path..[[ ]]..file_path..[[.flac trim 0 00:59 && echo "{ 'config': { 'languageCode': ']]..transcribe_language..[[', 'enableWordTimeOffsets': false , 'enableAutomaticPunctuation': true , 'alternativeLanguageCodes': ']]..transcribe_alternate_language..[[' }, '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
local handle = io.popen(transcribe_cmd);