mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
support disable/enable listen DTMF in prompt
This commit is contained in:
@@ -176,6 +176,12 @@ class TaskGather extends SttTask {
|
|||||||
|
|
||||||
this._startVad();
|
this._startVad();
|
||||||
|
|
||||||
|
const startDtmfListener = () => {
|
||||||
|
if (this.input.includes('digits') || this.dtmfBargein || this.asrDtmfTerminationDigit) {
|
||||||
|
ep.on('dtmf', this._onDtmf.bind(this, cs, ep));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const startListening = async(cs, ep) => {
|
const startListening = async(cs, ep) => {
|
||||||
this._startTimer();
|
this._startTimer();
|
||||||
if (this.isContinuousAsr && 0 === this.timeout) this._startAsrTimer();
|
if (this.isContinuousAsr && 0 === this.timeout) this._startAsrTimer();
|
||||||
@@ -199,6 +205,9 @@ class TaskGather extends SttTask {
|
|||||||
const {span, ctx} = this.startChildSpan(`nested:${this.sayTask.summary}`);
|
const {span, ctx} = this.startChildSpan(`nested:${this.sayTask.summary}`);
|
||||||
const process = () => {
|
const process = () => {
|
||||||
this.logger.debug('Gather: nested say task completed');
|
this.logger.debug('Gather: nested say task completed');
|
||||||
|
if (!this.listenDuringPrompt) {
|
||||||
|
startDtmfListener();
|
||||||
|
}
|
||||||
this._stopVad();
|
this._stopVad();
|
||||||
if (!this.killed) {
|
if (!this.killed) {
|
||||||
startListening(cs, ep);
|
startListening(cs, ep);
|
||||||
@@ -226,6 +235,9 @@ class TaskGather extends SttTask {
|
|||||||
const {span, ctx} = this.startChildSpan(`nested:${this.playTask.summary}`);
|
const {span, ctx} = this.startChildSpan(`nested:${this.playTask.summary}`);
|
||||||
const process = () => {
|
const process = () => {
|
||||||
this.logger.debug('Gather: nested play task completed');
|
this.logger.debug('Gather: nested play task completed');
|
||||||
|
if (!this.listenDuringPrompt) {
|
||||||
|
startDtmfListener();
|
||||||
|
}
|
||||||
this._stopVad();
|
this._stopVad();
|
||||||
if (!this.killed) {
|
if (!this.killed) {
|
||||||
startListening(cs, ep);
|
startListening(cs, ep);
|
||||||
@@ -269,8 +281,8 @@ class TaskGather extends SttTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.input.includes('digits') || this.dtmfBargein || this.asrDtmfTerminationDigit) {
|
if (this.listenDuringPrompt) {
|
||||||
ep.on('dtmf', this._onDtmf.bind(this, cs, ep));
|
startDtmfListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.awaitTaskDone();
|
await this.awaitTaskDone();
|
||||||
|
|||||||
Reference in New Issue
Block a user