mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-22 01:27:55 +00:00
add try catch in init speech
This commit is contained in:
@@ -99,7 +99,7 @@ class TaskGather extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const startListening = (cs, ep) => {
|
const startListening = (cs, ep) => {
|
||||||
this.logger.info({input: this.input, listenDuringPrompt: this.listenDuringPrompt}, "started listening for speech events via startListening");
|
this.logger.info({input: this.input, listenDuringPrompt: this.listenDuringPrompt}, 'started listening for speech events via startListening');
|
||||||
this._startTimer();
|
this._startTimer();
|
||||||
if (this.input.includes('speech') && !this.listenDuringPrompt) {
|
if (this.input.includes('speech') && !this.listenDuringPrompt) {
|
||||||
this._initSpeech(cs, ep)
|
this._initSpeech(cs, ep)
|
||||||
@@ -197,7 +197,8 @@ class TaskGather extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async _initSpeech(cs, ep) {
|
async _initSpeech(cs, ep) {
|
||||||
this.logger.info("started listening on speech events initSpeechEnter");
|
this.logger.info('started listening on speech events initSpeechEnter');
|
||||||
|
try {
|
||||||
const opts = {};
|
const opts = {};
|
||||||
|
|
||||||
if (this.vad.enable) {
|
if (this.vad.enable) {
|
||||||
@@ -258,10 +259,15 @@ class TaskGather extends Task {
|
|||||||
ep.addCustomEventListener(AzureTranscriptionEvents.Transcription, this._onTranscription.bind(this, cs, ep));
|
ep.addCustomEventListener(AzureTranscriptionEvents.Transcription, this._onTranscription.bind(this, cs, ep));
|
||||||
ep.addCustomEventListener(AzureTranscriptionEvents.NoSpeechDetected, this._onNoSpeechDetected.bind(this, cs, ep));
|
ep.addCustomEventListener(AzureTranscriptionEvents.NoSpeechDetected, this._onNoSpeechDetected.bind(this, cs, ep));
|
||||||
}
|
}
|
||||||
this.logger.info("started listening on speech events initSpeechDone");
|
this.logger.info('started listening on speech events initSpeechDone');
|
||||||
await ep.set(opts)
|
await ep.set(opts)
|
||||||
.catch((err) => this.logger.info(err, 'Error setting channel variables'));
|
.catch((err) => this.logger.info(err, 'Error setting channel variables'));
|
||||||
|
|
||||||
|
} catch (err) {
|
||||||
|
this.logger.error("could not init speech for listening");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
_startTranscribing(ep) {
|
_startTranscribing(ep) {
|
||||||
ep.startTranscription({
|
ep.startTranscription({
|
||||||
|
|||||||
Reference in New Issue
Block a user