mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
bugfix: cs not passed to kill()
This commit is contained in:
@@ -94,7 +94,7 @@ class TaskGather extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.input.includes('digits')) {
|
if (this.input.includes('digits')) {
|
||||||
ep.on('dtmf', this._onDtmf.bind(this, ep));
|
ep.on('dtmf', this._onDtmf.bind(this, cs, ep));
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.awaitTaskDone();
|
await this.awaitTaskDone();
|
||||||
@@ -108,19 +108,19 @@ class TaskGather extends Task {
|
|||||||
|
|
||||||
kill(cs) {
|
kill(cs) {
|
||||||
super.kill(cs);
|
super.kill(cs);
|
||||||
this._killAudio();
|
this._killAudio(cs);
|
||||||
this.ep.removeAllListeners('dtmf');
|
this.ep.removeAllListeners('dtmf');
|
||||||
this._resolve('killed');
|
this._resolve('killed');
|
||||||
}
|
}
|
||||||
|
|
||||||
_onDtmf(ep, evt) {
|
_onDtmf(cs, ep, evt) {
|
||||||
this.logger.debug(evt, 'TaskGather:_onDtmf');
|
this.logger.debug(evt, 'TaskGather:_onDtmf');
|
||||||
if (evt.dtmf === this.finishOnKey) this._resolve('dtmf-terminator-key');
|
if (evt.dtmf === this.finishOnKey) this._resolve('dtmf-terminator-key');
|
||||||
else {
|
else {
|
||||||
this.digitBuffer += evt.dtmf;
|
this.digitBuffer += evt.dtmf;
|
||||||
if (this.digitBuffer.length === this.numDigits) this._resolve('dtmf-num-digits');
|
if (this.digitBuffer.length === this.numDigits) this._resolve('dtmf-num-digits');
|
||||||
}
|
}
|
||||||
this._killAudio();
|
this._killAudio(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
async _initSpeech(cs, ep) {
|
async _initSpeech(cs, ep) {
|
||||||
@@ -191,14 +191,14 @@ class TaskGather extends Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_killAudio() {
|
_killAudio(cs) {
|
||||||
if (this.sayTask && !this.sayTask.killed) {
|
if (this.sayTask && !this.sayTask.killed) {
|
||||||
this.sayTask.removeAllListeners('playDone');
|
this.sayTask.removeAllListeners('playDone');
|
||||||
this.sayTask.kill();
|
this.sayTask.kill(cs);
|
||||||
}
|
}
|
||||||
if (this.playTask && !this.playTask.killed) {
|
if (this.playTask && !this.playTask.killed) {
|
||||||
this.playTask.removeAllListeners('playDone');
|
this.playTask.removeAllListeners('playDone');
|
||||||
this.playTask.kill();
|
this.playTask.kill(cs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user