mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
Fix/0.8.5 cherries (#724)
* kill play task if bot responds verbs while actionHook delay is enabled (#712) * kill play task if bot responds verbs while actionHook delay is enabled * fix actionHook delay continues even the bot already responded verbs * wip * wip * wip * gather is hang if listenDuringPrompt = false and say/play task throw exception (#717) * merge fix for Support ASR TTS fallback (#713) --------- Co-authored-by: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com>
This commit is contained in:
@@ -193,6 +193,24 @@ class CallSession extends Emitter {
|
||||
this._synthesizer = synth;
|
||||
}
|
||||
|
||||
/**
|
||||
* ASR TTS fallback
|
||||
*/
|
||||
get hasFallbackAsr() {
|
||||
return this._hasFallbackAsr || false;
|
||||
}
|
||||
|
||||
set hasFallbackAsr(i) {
|
||||
this._hasFallbackAsr = i;
|
||||
}
|
||||
|
||||
get hasFallbackTts() {
|
||||
return this._hasFallbackTts || false;
|
||||
}
|
||||
|
||||
set hasFallbackTts(i) {
|
||||
this._hasFallbackTts = i;
|
||||
}
|
||||
/**
|
||||
* default vendor to use for speech synthesis if not provided in the app
|
||||
*/
|
||||
@@ -1980,6 +1998,7 @@ Duration=${duration} `
|
||||
/**
|
||||
* called when the caller has hung up. Provided for subclasses to override
|
||||
* in order to apply logic at this point if needed.
|
||||
* return true if success fallback, return false if not
|
||||
*/
|
||||
_callerHungup() {
|
||||
assert(false, 'subclass responsibility to override this method');
|
||||
@@ -2421,6 +2440,7 @@ Duration=${duration} `
|
||||
|
||||
_startActionHookNoResponseTimer(options) {
|
||||
this._clearActionHookNoResponseTimer();
|
||||
this._actionHookDelayResolved = false;
|
||||
if (options.noResponseTimeoutMs) {
|
||||
this.logger.debug(`CallSession:_startActionHookNoResponseTimer ${options.noResponseTimeoutMs}`);
|
||||
this._actionHookNoResponseTimer = setTimeout(() => {
|
||||
@@ -2434,7 +2454,9 @@ Duration=${duration} `
|
||||
if (t.length) {
|
||||
t[0].on('playDone', (err) => {
|
||||
if (err) this.logger.error({err}, `Call-Session:exec Error delay action, play ${verb}`);
|
||||
this._startActionHookNoResponseTimer(options);
|
||||
if (!this._actionHookDelayResolved) {
|
||||
this._startActionHookNoResponseTimer(options);
|
||||
}
|
||||
});
|
||||
}
|
||||
this.tasks.push(...t);
|
||||
@@ -2452,7 +2474,16 @@ Duration=${duration} `
|
||||
|
||||
_clearActionHookNoResponseTimer() {
|
||||
if (this._actionHookNoResponseTimer) {
|
||||
// Action Hook delay is solved.
|
||||
this._actionHookDelayResolved = true;
|
||||
clearTimeout(this._actionHookNoResponseTimer);
|
||||
// if delay action is enabled
|
||||
// and bot has responded with list of new verbs
|
||||
// Only kill current running play task.
|
||||
//https://github.com/jambonz/jambonz-feature-server/issues/710
|
||||
if (this.currentTask?.name === TaskName.Play) {
|
||||
this.currentTask.kill(this);
|
||||
}
|
||||
}
|
||||
this._actionHookNoResponseTimer = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user