mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
feat/940 stopped calling updateSpeechCredentialLastUsed (#944)
This commit is contained in:
@@ -140,7 +140,6 @@ class TaskGather extends SttTask {
|
|||||||
async handling(cs, {ep}) {
|
async handling(cs, {ep}) {
|
||||||
this.logger.debug({options: this.data}, 'Gather:exec');
|
this.logger.debug({options: this.data}, 'Gather:exec');
|
||||||
await super.exec(cs, {ep});
|
await super.exec(cs, {ep});
|
||||||
const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, cs.srf);
|
|
||||||
|
|
||||||
this.fillerNoise = {
|
this.fillerNoise = {
|
||||||
...(cs.fillerNoise || {}),
|
...(cs.fillerNoise || {}),
|
||||||
@@ -210,7 +209,6 @@ class TaskGather extends SttTask {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this._startTranscribing(ep);
|
this._startTranscribing(ep);
|
||||||
return updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await this._startFallback(cs, ep, {error: e});
|
await this._startFallback(cs, ep, {error: e});
|
||||||
}
|
}
|
||||||
@@ -290,8 +288,6 @@ class TaskGather extends SttTask {
|
|||||||
await this._setSpeechHandlers(cs, ep);
|
await this._setSpeechHandlers(cs, ep);
|
||||||
if (!this.resolved && !this.killed) {
|
if (!this.resolved && !this.killed) {
|
||||||
this._startTranscribing(ep);
|
this._startTranscribing(ep);
|
||||||
updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid)
|
|
||||||
.catch(() => {/*already logged error */});
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.logger.info('Gather:exec - task was killed or resolved quickly, not starting transcription');
|
this.logger.info('Gather:exec - task was killed or resolved quickly, not starting transcription');
|
||||||
@@ -969,7 +965,6 @@ class TaskGather extends SttTask {
|
|||||||
bugname: this.bugname
|
bugname: this.bugname
|
||||||
})
|
})
|
||||||
.catch((err) => this.logger.error({err}, `Error stopping transcription for primary vendor ${this.vendor}`));
|
.catch((err) => this.logger.error({err}, `Error stopping transcription for primary vendor ${this.vendor}`));
|
||||||
const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, cs.srf);
|
|
||||||
try {
|
try {
|
||||||
this.logger.debug('gather:_startFallback');
|
this.logger.debug('gather:_startFallback');
|
||||||
this.notifyError({ msg: 'ASR error',
|
this.notifyError({ msg: 'ASR error',
|
||||||
@@ -978,7 +973,6 @@ class TaskGather extends SttTask {
|
|||||||
this._speechHandlersSet = false;
|
this._speechHandlersSet = false;
|
||||||
await this._setSpeechHandlers(cs, ep);
|
await this._setSpeechHandlers(cs, ep);
|
||||||
this._startTranscribing(ep);
|
this._startTranscribing(ep);
|
||||||
updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid);
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.info({error}, `There is error while falling back to ${this.fallbackVendor}`);
|
this.logger.info({error}, `There is error while falling back to ${this.fallbackVendor}`);
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ class TaskTranscribe extends SttTask {
|
|||||||
...this.data.recognizer.nuanceOptions
|
...this.data.recognizer.nuanceOptions
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, cs.srf);
|
|
||||||
|
|
||||||
if (cs.hasGlobalSttHints) {
|
if (cs.hasGlobalSttHints) {
|
||||||
const {hints, hintsBoost} = cs.globalSttHints;
|
const {hints, hintsBoost} = cs.globalSttHints;
|
||||||
@@ -117,9 +116,6 @@ class TaskTranscribe extends SttTask {
|
|||||||
if (this.transcribing2) {
|
if (this.transcribing2) {
|
||||||
await this._startTranscribing(cs, ep2, 2);
|
await this._startTranscribing(cs, ep2, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid)
|
|
||||||
.catch(() => {/*already logged error */});
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (!(await this._startFallback(cs, ep, {error: err}))) {
|
if (!(await this._startFallback(cs, ep, {error: err}))) {
|
||||||
this.logger.info(err, 'TaskTranscribe:exec - error');
|
this.logger.info(err, 'TaskTranscribe:exec - error');
|
||||||
@@ -601,7 +597,6 @@ class TaskTranscribe extends SttTask {
|
|||||||
bugname: this.bugname
|
bugname: this.bugname
|
||||||
})
|
})
|
||||||
.catch((err) => this.logger.error({err}, `Error stopping transcription for primary vendor ${this.vendor}`));
|
.catch((err) => this.logger.error({err}, `Error stopping transcription for primary vendor ${this.vendor}`));
|
||||||
const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, cs.srf);
|
|
||||||
try {
|
try {
|
||||||
this.notifyError({ msg: 'ASR error',
|
this.notifyError({ msg: 'ASR error',
|
||||||
details:`STT Vendor ${this.vendor} error: ${evt.error || evt.reason}`, failover: 'in progress'});
|
details:`STT Vendor ${this.vendor} error: ${evt.error || evt.reason}`, failover: 'in progress'});
|
||||||
@@ -612,7 +607,6 @@ class TaskTranscribe extends SttTask {
|
|||||||
}
|
}
|
||||||
this[`_speechHandlersSet_${channel}`] = false;
|
this[`_speechHandlersSet_${channel}`] = false;
|
||||||
this._startTranscribing(cs, _ep, channel);
|
this._startTranscribing(cs, _ep, channel);
|
||||||
updateSpeechCredentialLastUsed(this.sttCredentials.speech_credential_sid);
|
|
||||||
return true;
|
return true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.notifyError({ msg: 'ASR error',
|
this.notifyError({ msg: 'ASR error',
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ class TtsTask extends Task {
|
|||||||
|
|
||||||
async _synthesizeWithSpecificVendor(cs, ep, {vendor, language, voice, label, preCache = false}) {
|
async _synthesizeWithSpecificVendor(cs, ep, {vendor, language, voice, label, preCache = false}) {
|
||||||
const {srf, accountSid:account_sid} = cs;
|
const {srf, accountSid:account_sid} = cs;
|
||||||
const {updateSpeechCredentialLastUsed} = require('../utils/db-utils')(this.logger, srf);
|
|
||||||
const {writeAlerts, AlertType, stats} = srf.locals;
|
const {writeAlerts, AlertType, stats} = srf.locals;
|
||||||
const {synthAudio} = srf.locals.dbHelpers;
|
const {synthAudio} = srf.locals.dbHelpers;
|
||||||
const engine = this.synthesizer.engine || cs.synthesizer?.engine || 'neural';
|
const engine = this.synthesizer.engine || cs.synthesizer?.engine || 'neural';
|
||||||
@@ -141,8 +140,6 @@ class TtsTask extends Task {
|
|||||||
}).catch((err) => this.logger.info({err}, 'Error generating alert for no tts'));
|
}).catch((err) => this.logger.info({err}, 'Error generating alert for no tts'));
|
||||||
throw new SpeechCredentialError('no provisioned speech credentials for TTS');
|
throw new SpeechCredentialError('no provisioned speech credentials for TTS');
|
||||||
}
|
}
|
||||||
// synthesize all of the text elements
|
|
||||||
let lastUpdated = false;
|
|
||||||
|
|
||||||
/* produce an audio segment from the provided text */
|
/* produce an audio segment from the provided text */
|
||||||
const generateAudio = async(text) => {
|
const generateAudio = async(text) => {
|
||||||
@@ -182,10 +179,6 @@ class TtsTask extends Task {
|
|||||||
this.otelSpan.end();
|
this.otelSpan.end();
|
||||||
this.otelSpan = null;
|
this.otelSpan = null;
|
||||||
}
|
}
|
||||||
if (!servedFromCache && !lastUpdated) {
|
|
||||||
lastUpdated = true;
|
|
||||||
updateSpeechCredentialLastUsed(credentials.speech_credential_sid).catch(() => {/* logged error */});
|
|
||||||
}
|
|
||||||
if (!servedFromCache && rtt && !preCache && !this._disableTracing) {
|
if (!servedFromCache && rtt && !preCache && !this._disableTracing) {
|
||||||
this.notifyStatus({
|
this.notifyStatus({
|
||||||
event: 'synthesized-audio',
|
event: 'synthesized-audio',
|
||||||
|
|||||||
Reference in New Issue
Block a user