bugfixes for queue events

This commit is contained in:
Dave Horton
2021-08-30 17:12:00 -04:00
parent 3d0c7fea52
commit 28415dc750
4 changed files with 11 additions and 4 deletions

View File

@@ -8,7 +8,7 @@
"jsx": false, "jsx": false,
"modules": false "modules": false
}, },
"ecmaVersion": 2018 "ecmaVersion": 2020
}, },
"plugins": ["promise"], "plugins": ["promise"],
"rules": { "rules": {

View File

@@ -192,6 +192,10 @@ class CallSession extends Emitter {
return this.constructor.name === 'SmsCallSession'; return this.constructor.name === 'SmsCallSession';
} }
get webhook_secret() {
return this.accountInfo?.account?.webhook_secret;
}
/** /**
* Check for speech credentials for the specified vendor * Check for speech credentials for the specified vendor
* @param {*} vendor - google or aws * @param {*} vendor - google or aws
@@ -784,7 +788,8 @@ class CallSession extends Emitter {
} }
else { else {
this.logger.info({accountSid: this.accountSid, webhook: r[0]}, 'performQueueWebhook: webhook found'); this.logger.info({accountSid: this.accountSid, webhook: r[0]}, 'performQueueWebhook: webhook found');
this.queueEventHookRequestor = new Requestor(this.logger, r[0]); this.queueEventHookRequestor = new Requestor(this.logger, this.accountSid,
r[0], this.webhook_secret);
this.queueEventHook = r[0]; this.queueEventHook = r[0];
} }
} catch (err) { } catch (err) {

View File

@@ -8,14 +8,15 @@ const CallSession = require('./call-session');
*/ */
class ConfirmCallSession extends CallSession { class ConfirmCallSession extends CallSession {
constructor({logger, application, dlg, ep, tasks, callInfo}) { constructor({logger, application, dlg, ep, tasks, callInfo, accountInfo}) {
super({ super({
logger, logger,
application, application,
srf: dlg.srf, srf: dlg.srf,
callSid: dlg.callSid, callSid: dlg.callSid,
tasks, tasks,
callInfo callInfo,
accountInfo
}); });
this.dlg = dlg; this.dlg = dlg;
this.ep = ep; this.ep = ep;

View File

@@ -346,6 +346,7 @@ class TaskEnqueue extends Task {
dlg, dlg,
ep: cs.ep, ep: cs.ep,
callInfo: cs.callInfo, callInfo: cs.callInfo,
accountInfo: cs.accountInfo,
tasks: tasksToRun tasks: tasksToRun
}); });
await this._playSession.exec(); await this._playSession.exec();