don't fetch if whisper is an object with a single verb in it (#1290)

* don't fetch if whisper is an object with a single verb in it

* disable URL fetching of verbs on whisper

* fixes for lint

* lint
This commit is contained in:
Sam Machin
2025-07-20 18:47:31 +01:00
committed by GitHub
parent 0cc6ea987f
commit d831a4ca7f

View File

@@ -1661,8 +1661,8 @@ Duration=${duration} `
async _lccWhisper(opts, callSid) { async _lccWhisper(opts, callSid) {
const {whisper} = opts; const {whisper} = opts;
let tasks; let tasks;
const b3 = this.b3; //const b3 = this.b3;
const httpHeaders = b3 && {b3}; //const httpHeaders = b3 && {b3};
// this whole thing requires us to be in a Dial verb // this whole thing requires us to be in a Dial verb
const task = this.currentTask; const task = this.currentTask;
@@ -1671,12 +1671,15 @@ Duration=${duration} `
} }
// 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)) { // Disable passing a URL as not functional Sam Machin - 17/07/2025
// retrieve a url //if (typeof whisper === 'string' || (typeof whisper === 'object' && whisper.url && !whisper.verb)) {
const json = await this.requestor(opts.call_hook, this.callInfo.toJSON(), httpHeaders); // // retrieve a url
tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata)); // const json = await this.requestor(opts.call_hook, this.callInfo.toJSON(), httpHeaders);
} // tasks = normalizeJambones(this.logger, json).map((tdata) => makeTask(this.logger, tdata));
else if (Array.isArray(whisper)) { //}
//else if (Array.isArray(whisper)) {
if (Array.isArray(whisper)) {
// an inline array of tasks // an inline array of tasks
tasks = normalizeJambones(this.logger, whisper).map((tdata) => makeTask(this.logger, tdata)); tasks = normalizeJambones(this.logger, whisper).map((tdata) => makeTask(this.logger, tdata));
} }