From 2ccd33e212988c95dc1ba55a2b657a665b0c7135 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Thu, 31 Aug 2023 08:04:53 +0700 Subject: [PATCH] feat azure fromHost (#416) * feat azure fromHost * wip * wip * wip --- lib/session/call-session.js | 4 +++- lib/utils/db-utils.js | 2 ++ lib/utils/transcription-utils.js | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/session/call-session.js b/lib/session/call-session.js index 76fc18f4..0debff40 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -769,8 +769,10 @@ ${credential.label ? `, label: ${credential.label}` : ''} is chosen`); region: credential.region, use_custom_stt: credential.use_custom_stt, custom_stt_endpoint: credential.custom_stt_endpoint, + custom_stt_endpoint_url: credential.custom_stt_endpoint_url, use_custom_tts: credential.use_custom_tts, - custom_tts_endpoint: credential.custom_tts_endpoint + custom_tts_endpoint: credential.custom_tts_endpoint, + custom_tts_endpoint_url: credential.custom_tts_endpoint_url }; } else if ('wellsaid' === vendor) { diff --git a/lib/utils/db-utils.js b/lib/utils/db-utils.js index c12e7837..4df66251 100644 --- a/lib/utils/db-utils.js +++ b/lib/utils/db-utils.js @@ -46,8 +46,10 @@ const speechMapper = (cred) => { obj.region = o.region; obj.use_custom_stt = o.use_custom_stt; obj.custom_stt_endpoint = o.custom_stt_endpoint; + obj.custom_stt_endpoint_url = o.custom_stt_endpoint_url; obj.use_custom_tts = o.use_custom_tts; obj.custom_tts_endpoint = o.custom_tts_endpoint; + obj.custom_tts_endpoint_url = o.custom_tts_endpoint_url; } else if ('wellsaid' === obj.vendor) { const o = JSON.parse(decrypt(credential)); diff --git a/lib/utils/transcription-utils.js b/lib/utils/transcription-utils.js index 0817daba..0bb6915f 100644 --- a/lib/utils/transcription-utils.js +++ b/lib/utils/transcription-utils.js @@ -399,6 +399,8 @@ module.exports = (logger) => { {AZURE_SPEECH_ALTERNATIVE_LANGUAGE_CODES: [...new Set(rOpts.altLanguages)].join(',')}), ...(rOpts.requestSnr && {AZURE_REQUEST_SNR: 1}), ...(rOpts.profanityOption && {AZURE_PROFANITY_OPTION: rOpts.profanityOption}), + ...(sttCredentials.use_custom_stt && sttCredentials.custom_stt_endpoint_url && + {AZURE_SERVICE_ENDPOINT: sttCredentials.custom_stt_endpoint_url}), ...(rOpts.azureServiceEndpoint && {AZURE_SERVICE_ENDPOINT: rOpts.azureServiceEndpoint}), ...(rOpts.initialSpeechTimeoutMs > 0 && {AZURE_INITIAL_SPEECH_TIMEOUT_MS: rOpts.initialSpeechTimeoutMs}), @@ -406,11 +408,11 @@ module.exports = (logger) => { ...(rOpts.audioLogging && {AZURE_AUDIO_LOGGING: 1}), ...{AZURE_USE_OUTPUT_FORMAT_DETAILED: 1}, ...(sttCredentials && { - AZURE_SUBSCRIPTION_KEY: sttCredentials.api_key, - AZURE_REGION: sttCredentials.region, + ...(sttCredentials.api_key && {AZURE_SUBSCRIPTION_KEY: sttCredentials.api_key}), + ...(sttCredentials.region && {AZURE_REGION: sttCredentials.region}), }), ...(sttCredentials.use_custom_stt && sttCredentials.custom_stt_endpoint && - {AZURE_SERVICE_ENDPOINT_ID: sttCredentials.custom_stt_endpoint}) + {AZURE_SERVICE_ENDPOINT_ID: sttCredentials.custom_stt_endpoint}), }; } else if ('nuance' === vendor) {