added initial support for dialogflow

This commit is contained in:
Dave Horton
2020-07-08 14:16:37 -04:00
parent c1112ea477
commit a4bcfca9e6
11 changed files with 579 additions and 6 deletions

View File

@@ -99,6 +99,18 @@ class Task extends Emitter {
}
}
async performHook(hook, results, expectResponse = true) {
const json = await this.cs.requestor.request(hook, results);
if (expectResponse && json && Array.isArray(json)) {
const makeTask = require('./make_task');
const tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata));
if (tasks && tasks.length > 0) {
this.logger.info({tasks: tasks}, `${this.name} replacing application with ${tasks.length} tasks`);
this.callSession.replaceApplication(tasks);
}
}
}
async transferCallToFeatureServer(cs, sipAddress, opts) {
const uuid = uuidv4();
const {addKey} = cs.srf.locals.dbHelpers;