* fix #1025

* redirect verb should be able to redirect to a new websocket endpoint
This commit is contained in:
Dave Horton
2025-01-09 15:45:20 -05:00
committed by GitHub
parent fcefa1ff31
commit 6bad1a22f3
2 changed files with 13 additions and 3 deletions

View File

@@ -41,9 +41,7 @@ class TaskLlm extends Task {
switch (this.vendor) { switch (this.vendor) {
case 'openai': case 'openai':
case 'microsoft': case 'microsoft':
if (this.model.startsWith('gpt-4o-realtime')) { llm = new TaskLlmOpenAI_S2S(this.logger, this.data, this);
llm = new TaskLlmOpenAI_S2S(this.logger, this.data, this);
}
break; break;
case 'voiceagent': case 'voiceagent':

View File

@@ -1,5 +1,6 @@
const Task = require('./task'); const Task = require('./task');
const {TaskName} = require('../utils/constants'); const {TaskName} = require('../utils/constants');
const WsRequestor = require('../utils/ws-requestor');
/** /**
* Redirects to a new application * Redirects to a new application
@@ -13,6 +14,17 @@ class TaskRedirect extends Task {
async exec(cs) { async exec(cs) {
await super.exec(cs); await super.exec(cs);
if (cs.requestor instanceof WsRequestor && cs.application.requestor._isAbsoluteUrl(this.actionHook)) {
this.logger.info(`Task:performAction redirecting to ${this.actionHook}, requires new ws connection`);
try {
this.cs.requestor.close();
const requestor = new WsRequestor(this.logger, cs.accountSid, {url: this.actionHook}, this.webhook_secret) ;
this.cs.application.requestor = requestor;
} catch (err) {
this.logger.info(err, `Task:performAction error redirecting to ${this.actionHook}`);
}
}
await this.performAction(); await this.performAction();
} }
} }