if dial.confirmHook returns empty array do not create a confirmSession (#513)

This commit is contained in:
Dave Horton
2023-11-01 08:47:41 -04:00
committed by GitHub
parent 3cdf568fb6
commit 6b9f6a7d90

View File

@@ -326,6 +326,10 @@ class SingleDialer extends Emitter {
try { try {
// retrieve set of tasks // retrieve set of tasks
const json = await this.requestor.request('dial:confirm', confirmHook, this.callInfo.toJSON()); const json = await this.requestor.request('dial:confirm', confirmHook, this.callInfo.toJSON());
if (!json || (Array.isArray(json) && json.length === 0)) {
this.logger.info('SingleDialer:_executeApp: no tasks returned from confirm hook');
return;
}
const tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata)); const tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata));
// verify it contains only allowed verbs // verify it contains only allowed verbs
const allowedTasks = tasks.filter((task) => { const allowedTasks = tasks.filter((task) => {