mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
fix say verb does not close streaming when finish say (#1412)
* fix say verb does not close streaming when finish say * wip * wip * ttsStreamingBuffer reset eventHandlerCount after remove listeners * only send tokens to module if connected * wip * sent stream_open when successfully connected to vendor
This commit is contained in:
@@ -950,6 +950,12 @@ class CallSession extends Emitter {
|
||||
this.ttsStreamingBuffer?.start();
|
||||
}
|
||||
|
||||
stopTtsStream() {
|
||||
this.requestor?.request('tts:streaming-event', '/streaming-event', {event_type: 'stream_closed'})
|
||||
.catch((err) => this.logger.info({err}, 'CallSession:clearTtsStream - Error sending user_interruption'));
|
||||
this.ttsStreamingBuffer?.stop();
|
||||
}
|
||||
|
||||
async enableBotMode(gather, autoEnable) {
|
||||
try {
|
||||
let task;
|
||||
@@ -1272,6 +1278,7 @@ class CallSession extends Emitter {
|
||||
this.ttsStreamingBuffer.on(TtsStreamingEvents.Pause, this._onTtsStreamingPause.bind(this));
|
||||
this.ttsStreamingBuffer.on(TtsStreamingEvents.Resume, this._onTtsStreamingResume.bind(this));
|
||||
this.ttsStreamingBuffer.on(TtsStreamingEvents.ConnectFailure, this._onTtsStreamingConnectFailure.bind(this));
|
||||
this.ttsStreamingBuffer.on(TtsStreamingEvents.Connected, this._onTtsStreamingConnected.bind(this));
|
||||
}
|
||||
else {
|
||||
this.logger.info(`CallSession:exec - not a normal call session: ${this.constructor.name}`);
|
||||
@@ -2556,7 +2563,7 @@ Duration=${duration} `
|
||||
this.backgroundTaskManager.stopAll();
|
||||
this.clearOrRestoreActionHookDelayProcessor().catch((err) => {});
|
||||
|
||||
this.ttsStreamingBuffer?.stop();
|
||||
this.stopTtsStream();
|
||||
|
||||
this.sttLatencyCalculator?.stop();
|
||||
}
|
||||
@@ -3103,6 +3110,11 @@ Duration=${duration} `
|
||||
}
|
||||
}
|
||||
|
||||
_onTtsStreamingConnected() {
|
||||
this.requestor?.request('tts:streaming-event', '/streaming-event', {event_type: 'stream_open'})
|
||||
.catch((err) => this.logger.info({err}, 'CallSession:_onTtsStreamingConnected - Error sending'));
|
||||
}
|
||||
|
||||
_onTtsStreamingEmpty() {
|
||||
const task = this.currentTask;
|
||||
if (task && TaskName.Say === task.name) {
|
||||
|
||||
Reference in New Issue
Block a user