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
This commit is contained in:
Joseph
2020-11-15 01:03:58 -05:00
committed by GitHub
parent 789a4d9b66
commit cf2a7d200b

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 && 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);