Fixed Gather digits does not work without nested say/play (#914)

* Fixed Gather digits does not work without nested say/play

* fix review comment

* add assert to make sure we don't register dtmf twice in gather verb
This commit is contained in:
Hoan Luu Huu
2024-09-30 18:46:21 +07:00
committed by GitHub
parent 68fa3c013d
commit b9ef00dfc7

View File

@@ -177,8 +177,10 @@ class TaskGather extends SttTask {
this._startVad(); this._startVad();
const startDtmfListener = () => { const startDtmfListener = () => {
assert(!this._dtmfListenerStarted);
if (this.input.includes('digits') || this.dtmfBargein || this.asrDtmfTerminationDigit) { if (this.input.includes('digits') || this.dtmfBargein || this.asrDtmfTerminationDigit) {
ep.on('dtmf', this._onDtmf.bind(this, cs, ep)); ep.on('dtmf', this._onDtmf.bind(this, cs, ep));
this._dtmfListenerStarted = true;
} }
}; };
@@ -281,7 +283,8 @@ class TaskGather extends SttTask {
} }
} }
if (this.listenDuringPrompt) { // https://github.com/jambonz/jambonz-feature-server/issues/913
if (this.listenDuringPrompt || (!this.sayTask && !this.playTask)) {
startDtmfListener(); startDtmfListener();
} }