diff --git a/lib/tasks/llm/index.js b/lib/tasks/llm/index.js index 97146a46..c0d6f316 100644 --- a/lib/tasks/llm/index.js +++ b/lib/tasks/llm/index.js @@ -41,9 +41,7 @@ class TaskLlm extends Task { switch (this.vendor) { case 'openai': 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; case 'voiceagent': diff --git a/lib/tasks/redirect.js b/lib/tasks/redirect.js index 55d5d9dd..4a5f5b10 100644 --- a/lib/tasks/redirect.js +++ b/lib/tasks/redirect.js @@ -1,5 +1,6 @@ const Task = require('./task'); const {TaskName} = require('../utils/constants'); +const WsRequestor = require('../utils/ws-requestor'); /** * Redirects to a new application @@ -13,6 +14,17 @@ class TaskRedirect extends Task { async 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(); } }