mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
feat: multi speech credential diff labels but same vendor (#426)
* feat: multi speech credential diff labels but same vendor * update sql * fix * fix * fix jslint * fix review comment * update verb spec version
This commit is contained in:
@@ -179,6 +179,16 @@ class CallSession extends Emitter {
|
||||
set speechSynthesisVendor(vendor) {
|
||||
this.application.speech_synthesis_vendor = vendor;
|
||||
}
|
||||
|
||||
/**
|
||||
* default label to use for speech synthesis if not provided in the app
|
||||
*/
|
||||
get speechSynthesisLabel() {
|
||||
return this.application.speech_synthesis_label;
|
||||
}
|
||||
set speechSynthesisLabel(label) {
|
||||
this.application.speech_synthesis_label = label;
|
||||
}
|
||||
/**
|
||||
* default voice to use for speech synthesis if not provided in the app
|
||||
*/
|
||||
@@ -207,6 +217,15 @@ class CallSession extends Emitter {
|
||||
set speechRecognizerVendor(vendor) {
|
||||
this.application.speech_recognizer_vendor = vendor;
|
||||
}
|
||||
/**
|
||||
* default vendor to use for speech recognition if not provided in the app
|
||||
*/
|
||||
get speechRecognizerLabel() {
|
||||
return this.application.speech_recognizer_label;
|
||||
}
|
||||
set speechRecognizerLabel(label) {
|
||||
this.application.speech_recognizer_label = label;
|
||||
}
|
||||
/**
|
||||
* default language to use for speech recognition if not provided in the app
|
||||
*/
|
||||
@@ -640,14 +659,17 @@ class CallSession extends Emitter {
|
||||
* Check for speech credentials for the specified vendor
|
||||
* @param {*} vendor - google or aws
|
||||
*/
|
||||
getSpeechCredentials(vendor, type) {
|
||||
getSpeechCredentials(vendor, type, label = null) {
|
||||
const {writeAlerts, AlertType} = this.srf.locals;
|
||||
if (this.accountInfo.speech && this.accountInfo.speech.length > 0) {
|
||||
const credential = this.accountInfo.speech.find((s) => s.vendor === vendor);
|
||||
const credential = this.accountInfo.speech.find((s) => s.vendor === vendor &&
|
||||
((label && s.label === label) || label === null));
|
||||
if (credential && (
|
||||
(type === 'tts' && credential.use_for_tts) ||
|
||||
(type === 'stt' && credential.use_for_stt)
|
||||
)) {
|
||||
this.logger.info(`Speech credential vendor: ${credential.vendor}
|
||||
${credential.label ? `, label: ${credential.label}` : ''} is chosen`);
|
||||
if ('google' === vendor) {
|
||||
try {
|
||||
const cred = JSON.parse(credential.service_key.replace(/\n/g, '\\n'));
|
||||
|
||||
Reference in New Issue
Block a user