further fixes for customerData

This commit is contained in:
Dave Horton
2021-08-11 11:01:11 -04:00
parent 7c629e6faf
commit 3fed15b3b9
3 changed files with 6 additions and 6 deletions

View File

@@ -364,13 +364,13 @@ class CallSession extends Emitter {
async _lccCallHook(opts) { async _lccCallHook(opts) {
const webhooks = []; const webhooks = [];
let sd; let sd;
if (opts.call_hook) webhooks.push(this.requestor.request(opts.call_hook, this.callInfo)); if (opts.call_hook) webhooks.push(this.requestor.request(opts.call_hook, this.callInfo.toJSON()));
if (opts.child_call_hook) { if (opts.child_call_hook) {
/* child call hook only allowed from a connected Dial state */ /* child call hook only allowed from a connected Dial state */
const task = this.currentTask; const task = this.currentTask;
sd = task.sd; sd = task.sd;
if (task && TaskName.Dial === task.name && sd) { if (task && TaskName.Dial === task.name && sd) {
webhooks.push(this.requestor.request(opts.child_call_hook, sd.callInfo)); webhooks.push(this.requestor.request(opts.child_call_hook, sd.callInfo.toJSON()));
} }
} }
const [tasks1, tasks2] = await Promise.all(webhooks); const [tasks1, tasks2] = await Promise.all(webhooks);
@@ -450,7 +450,7 @@ class CallSession extends Emitter {
// allow user to provide a url object, a url string, an array of tasks, or a single task // allow user to provide a url object, a url string, an array of tasks, or a single task
if (typeof whisper === 'string' || (typeof whisper === 'object' && whisper.url)) { if (typeof whisper === 'string' || (typeof whisper === 'object' && whisper.url)) {
// retrieve a url // retrieve a url
const json = await this.requestor(opts.call_hook, this.callInfo); const json = await this.requestor(opts.call_hook, this.callInfo.toJSON());
tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata)); tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata));
} }
else if (Array.isArray(whisper)) { else if (Array.isArray(whisper)) {
@@ -916,7 +916,7 @@ class CallSession extends Emitter {
// update calls db // update calls db
//this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`); //this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
this.updateCallStatus(Object.assign({}, this.callInfo), this.serviceUrl) this.updateCallStatus(Object.assign({}, this.callInfo.toJSON()), this.serviceUrl)
.catch((err) => this.logger.error(err, 'redis error')); .catch((err) => this.logger.error(err, 'redis error'));
} }
} }

View File

@@ -242,7 +242,7 @@ class TaskDial extends Task {
this.logger.info(`Dial:_onDtmf got digits on B leg after adulting: ${evt.dtmf}`); this.logger.info(`Dial:_onDtmf got digits on B leg after adulting: ${evt.dtmf}`);
} }
else { else {
requestor.request(this.dtmfHook, {dtmf: match, ...cs.callInfo}) requestor.request(this.dtmfHook, {dtmf: match, ...cs.callInfo.toJSON()})
.catch((err) => this.logger.info(err, 'Dial:_onDtmf - error')); .catch((err) => this.logger.info(err, 'Dial:_onDtmf - error'));
} }
} }

View File

@@ -255,7 +255,7 @@ class SingleDialer extends Emitter {
async _executeApp(confirmHook) { async _executeApp(confirmHook) {
try { try {
// retrieve set of tasks // retrieve set of tasks
const tasks = await this.requestor.request(confirmHook, this.callInfo); const tasks = await this.requestor.request(confirmHook, this.callInfo.toJSON());
// verify it contains only allowed verbs // verify it contains only allowed verbs
const allowedTasks = tasks.filter((task) => { const allowedTasks = tasks.filter((task) => {