From 46302703da197835a013b01406afd9672396614f Mon Sep 17 00:00:00 2001 From: Dave Horton Date: Mon, 5 Dec 2022 10:53:41 -0500 Subject: [PATCH] further fix for #192, also bug fix for starting with a ws connection and switching to webhooks later in the same call --- lib/http-routes/api/update-call.js | 2 +- lib/tasks/gather.js | 4 ++-- lib/utils/ws-requestor.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/http-routes/api/update-call.js b/lib/http-routes/api/update-call.js index 6cb329b7..92614627 100644 --- a/lib/http-routes/api/update-call.js +++ b/lib/http-routes/api/update-call.js @@ -41,7 +41,7 @@ function retrieveCallSession(callSid, opts) { router.post('/:callSid', async(req, res) => { const logger = req.app.locals.logger; const callSid = req.params.callSid; - logger.debug({body: req.body}, 'got upateCall request'); + logger.debug({body: req.body}, 'got updateCall request'); try { const cs = retrieveCallSession(callSid, req.body); if (!cs) { diff --git a/lib/tasks/gather.js b/lib/tasks/gather.js index 41033048..5b2430a8 100644 --- a/lib/tasks/gather.js +++ b/lib/tasks/gather.js @@ -268,6 +268,7 @@ class TaskGather extends Task { const {timeout} = opts; this.timeout = timeout; this._startTimer(); + return true; } _onDtmf(cs, ep, evt) { @@ -439,8 +440,7 @@ class TaskGather extends Task { if (0 === this.timeout) return; this._clearTimer(); this._timeoutTimer = setTimeout(() => { - if (this.isContinuousAsr) this._startAsrTimer(); - else this._resolve(this.digitBuffer.length >= this.minDigits ? 'dtmf-num-digits' : 'timeout'); + this._resolve(this.digitBuffer.length >= this.minDigits ? 'dtmf-num-digits' : 'timeout'); }, this.timeout); } diff --git a/lib/utils/ws-requestor.js b/lib/utils/ws-requestor.js index 9946f6f7..59684752 100644 --- a/lib/utils/ws-requestor.js +++ b/lib/utils/ws-requestor.js @@ -54,7 +54,7 @@ class WsRequestor extends BaseRequestor { /* if we have an absolute url, and it is http then do a standard webhook */ if (this._isAbsoluteUrl(url) && url.startsWith('http')) { this.logger.debug({hook}, 'WsRequestor: sending a webhook (HTTP)'); - const requestor = new HttpRequestor(this.logger, this.account_sid, hook, this.secret); + const requestor = new HttpRequestor(this.logger, this.account_sid, {url: hook}, this.secret); return requestor.request(type, hook, params, httpHeaders); }