mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
fix choose speech dedential by label (#441)
* fix choose speech dedential by label * wip
This commit is contained in:
@@ -719,14 +719,20 @@ class CallSession extends Emitter {
|
||||
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 &&
|
||||
((label && s.label === label) || label === null));
|
||||
// firstly check if account level has expected credential
|
||||
let credential = this.accountInfo.speech.find((s) => s.vendor === vendor &&
|
||||
s.label === label && s.account_sid);
|
||||
if (!credential) {
|
||||
// check if SP level has expected credential
|
||||
credential = this.accountInfo.speech.find((s) => s.vendor === vendor &&
|
||||
s.label === label && !s.account_sid);
|
||||
}
|
||||
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`);
|
||||
${credential.label ? `, label: ${credential.label}` : ''} is chosen`);
|
||||
if ('google' === vendor) {
|
||||
if (type === 'tts' && !credential.tts_tested_ok ||
|
||||
type === 'stt' && !credential.stt_tested_ok) {
|
||||
|
||||
Reference in New Issue
Block a user