From cf2a7d200b83b279043c439bde8b1af597e2b626 Mon Sep 17 00:00:00 2001 From: Joseph <71848841+junction1153@users.noreply.github.com> Date: Sun, 15 Nov 2020 01:03:58 -0500 Subject: [PATCH] Updated code for v1p1beta1 API utilization Advanced --> Default Settings --> Voicemail. Add: Category: voicemail Subcategory: transcribe_provider Type: text Value: google Enabled: true Add: Category: voicemail Subcategory: transcribe_enabled Type: boolean Value: true Enabled: true Add: Category: voicemail Subcategory: json_enabled Type: boolean Value: true Enabled: true Add: Category: voicemail Subcategory: transcribe_enabled Type: boolean Value: true Enabled: true Add: Category: voicemail Subcategory: json_enabled Type: boolean Value: true Enabled: true Add: Category: voicemail Subcategory: google_key Type: text Value: INSERT YOUR API KEY HERE Enabled: true Add: Category: voicemail Subcategory: google_url Type: text Value: https://speech.googleapis.com/v1p1beta1/speech Enabled: true --- .../app/voicemail/resources/functions/record_message.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua b/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua index d3c4b59588..92efeb7a27 100644 --- a/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua +++ b/app/scripts/resources/scripts/app/voicemail/resources/functions/record_message.lua @@ -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 && 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]] + 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]] end local handle = io.popen(transcribe_cmd);