changes for azure tts

This commit is contained in:
Dave Horton
2021-11-19 18:23:23 +00:00
parent 7c77bedd15
commit 12c34de15c
5 changed files with 538 additions and 5042 deletions

View File

@@ -21,6 +21,11 @@ const speechMapper = (cred) => {
obj.access_key_id = o.access_key_id;
obj.secret_access_key = o.secret_access_key;
}
else if ('microsoft' === obj.vendor) {
const o = JSON.parse(decrypt(credential));
obj.api_key = o.api_key;
obj.region = o.region;
}
return obj;
};
@@ -37,7 +42,8 @@ module.exports = (logger, srf) => {
/* search at the service provider level if we don't find it at the account level */
const haveGoogle = speech.find((s) => s.vendor === 'google');
const haveAws = speech.find((s) => s.vendor === 'aws');
if (!haveGoogle || !haveAws) {
const haveMicrosoft = speech.find((s) => s.vendor === 'microsoft');
if (!haveGoogle || !haveAws || !haveMicrosoft) {
const [r3] = await pp.query(sqlSpeechCredentialsForSP, account_sid);
if (r3.length) {
if (!haveGoogle) {
@@ -48,6 +54,10 @@ module.exports = (logger, srf) => {
const aws = r3.find((s) => s.vendor === 'aws');
if (aws) speech.push(speechMapper(aws));
}
if (!haveMicrosoft) {
const ms = r3.find((s) => s.vendor === 'microsoft');
if (ms) speech.push(speechMapper(ms));
}
}
}