diff --git a/lib/session/call-session.js b/lib/session/call-session.js index ca99dde7..6c50139f 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -751,7 +751,9 @@ class CallSession extends Emitter { else if ('deepgram' === vendor) { return { speech_credential_sid: credential.speech_credential_sid, - api_key: credential.api_key + api_key: credential.api_key, + deepgram_stt_uri: credential.deepgram_stt_uri, + deepgram_stt_use_tls: credential.deepgram_stt_use_tls }; } else if ('soniox' === vendor) { diff --git a/lib/utils/db-utils.js b/lib/utils/db-utils.js index 197de921..9973f59e 100644 --- a/lib/utils/db-utils.js +++ b/lib/utils/db-utils.js @@ -75,6 +75,8 @@ const speechMapper = (cred) => { else if ('deepgram' === obj.vendor) { const o = JSON.parse(decrypt(credential)); obj.api_key = o.api_key; + obj.deepgram_stt_uri = o.deepgram_stt_uri; + obj.deepgram_stt_use_tls = o.deepgram_stt_use_tls; } else if ('soniox' === obj.vendor) { const o = JSON.parse(decrypt(credential)); diff --git a/lib/utils/transcription-utils.js b/lib/utils/transcription-utils.js index f1585a17..79250e31 100644 --- a/lib/utils/transcription-utils.js +++ b/lib/utils/transcription-utils.js @@ -144,6 +144,7 @@ const selectDefaultDeepgramModel = (task, language) => { const [gather, transcribe] = optimalDeepramModels[language]; return task.name === TaskName.Gather ? gather : transcribe; } + return 'base'; }; const consolidateTranscripts = (bufferedTranscripts, channel, language) => { @@ -614,18 +615,24 @@ module.exports = (logger) => { }; } else if ('deepgram' === vendor) { + let {model} = rOpts; const {deepgramOptions = {}} = rOpts; - if (!deepgramOptions.model) { - deepgramOptions.model = selectDefaultDeepgramModel(task, language); + const deepgramUri = deepgramOptions.deepgramSttUri || sttCredentials.deepgram_stt_uri; + const useTls = deepgramOptions.deepgramSttUseTls || sttCredentials.deepgram_stt_use_tls; + + /* default to a sensible model if not supplied */ + if (!model) { + model = selectDefaultDeepgramModel(task, language); } opts = { ...opts, + DEEPGRAM_SPEECH_MODEL: model, + ...(deepgramUri && {DEEPGRAM_URI: deepgramUri}), + ...(deepgramUri && useTls && {DEEPGRAM_USE_TLS: 1}), ...(sttCredentials.api_key) && {DEEPGRAM_API_KEY: sttCredentials.api_key}, ...(deepgramOptions.tier) && {DEEPGRAM_SPEECH_TIER: deepgramOptions.tier}, - ...(deepgramOptions.model) && - {DEEPGRAM_SPEECH_MODEL: deepgramOptions.model}, ...(deepgramOptions.punctuate) && {DEEPGRAM_SPEECH_ENABLE_AUTOMATIC_PUNCTUATION: 1}, ...(deepgramOptions.smartFormatting) &&