ibm speech fix

This commit is contained in:
Dave Horton
2022-12-04 11:26:26 -05:00
parent 2cc3140de0
commit 39fb762a15
5 changed files with 33 additions and 18 deletions

View File

@@ -578,7 +578,10 @@ class CallSession extends Emitter {
else if ('ibm' === vendor) {
return {
speech_credential_sid: credential.speech_credential_sid,
api_key: credential.api_key
tts_api_key: credential.tts_api_key,
tts_region: credential.tts_region,
stt_api_key: credential.stt_api_key,
stt_region: credential.stt_region
};
}
}

View File

@@ -137,7 +137,7 @@ class TaskSay extends Task {
const salt = cs.callSid;
const credentials = cs.getSpeechCredentials(vendor, 'tts');
/* parse Nuance voces into name and model */
/* parse Nuance voices into name and model */
let model;
if (vendor === 'nuance' && voice) {
const arr = /([A-Za-z-]*)\s+-\s+(enhanced|standard)/.exec(voice);

View File

@@ -51,6 +51,13 @@ const speechMapper = (cred) => {
obj.client_id = o.client_id;
obj.secret = o.secret;
}
else if ('ibm' === obj.vendor) {
const o = JSON.parse(decrypt(credential));
obj.tts_api_key = o.tts_api_key;
obj.tts_region = o.tts_region;
obj.stt_api_key = o.stt_api_key;
obj.stt_region = o.stt_region;
}
else if ('deepgram' === obj.vendor) {
const o = JSON.parse(decrypt(credential));
obj.api_key = o.api_key;
@@ -79,6 +86,7 @@ module.exports = (logger, srf) => {
const haveWellsaid = speech.find((s) => s.vendor === 'wellsaid');
const haveNuance = speech.find((s) => s.vendor === 'nuance');
const haveDeepgram = speech.find((s) => s.vendor === 'deepgram');
const haveIbm = speech.find((s) => s.vendor === 'ibm');
if (!haveGoogle || !haveAws || !haveMicrosoft || !haveWellsaid || !haveNuance) {
const [r3] = await pp.query(sqlSpeechCredentialsForSP, account_sid);
if (r3.length) {
@@ -106,6 +114,10 @@ module.exports = (logger, srf) => {
const deepgram = r3.find((s) => s.vendor === 'deepgram');
if (deepgram) speech.push(speechMapper(deepgram));
}
if (!haveIbm) {
const ibm = r3.find((s) => s.vendor === 'ibm');
if (ibm) speech.push(speechMapper(ibm));
}
}
}