fix: return TwiML for outbound conversation calls

This commit is contained in:
Peter Steinberger
2026-01-24 23:20:52 +00:00
parent 1b17453942
commit 0752ae6d6d
3 changed files with 74 additions and 0 deletions

View File

@@ -294,6 +294,7 @@ export class TwilioProvider implements VoiceCallProvider {
const isStatusCallback = type === "status";
const callStatus = params.get("CallStatus");
const direction = params.get("Direction");
const isOutbound = direction?.startsWith("outbound") ?? false;
const callIdFromQuery =
typeof ctx.query?.callId === "string" && ctx.query.callId.trim()
? ctx.query.callId.trim()
@@ -313,6 +314,14 @@ export class TwilioProvider implements VoiceCallProvider {
if (this.notifyCalls.has(callIdFromQuery)) {
return TwilioProvider.EMPTY_TWIML;
}
// Conversation mode: return streaming TwiML immediately for outbound calls.
if (isOutbound) {
const streamUrl = this.getStreamUrl();
return streamUrl
? this.getStreamConnectXml(streamUrl)
: TwilioProvider.PAUSE_TWIML;
}
}
// Status callbacks should not receive TwiML.