fix(voice-call): speak inbound greeting for twilio answered calls

This commit is contained in:
Xinhua Gu
2026-02-27 21:36:31 +01:00
committed by Peter Steinberger
parent b8b8a5f314
commit fe4c627432
2 changed files with 21 additions and 24 deletions

View File

@@ -111,8 +111,10 @@ describe("CallManager", () => {
expect(manager.getCallByProviderCallId("request-uuid")).toBeUndefined();
});
it("speaks initial message on answered for notify mode (non-Twilio)", async () => {
const { manager, provider } = createManagerHarness();
it.each(["plivo", "twilio"] as const)(
"speaks initial message on answered for notify mode (%s)",
async (providerName) => {
const { manager, provider } = createManagerHarness({}, new FakeProvider(providerName));
const { callId, success } = await manager.initiateCall("+15550000002", undefined, {
message: "Hello there",
@@ -121,7 +123,7 @@ describe("CallManager", () => {
expect(success).toBe(true);
manager.processEvent({
id: "evt-2",
id: `evt-2-${providerName}`,
type: "call.answered",
callId,
providerCallId: "call-uuid",
@@ -132,7 +134,8 @@ describe("CallManager", () => {
expect(provider.playTtsCalls).toHaveLength(1);
expect(provider.playTtsCalls[0]?.text).toBe("Hello there");
});
},
);
it("rejects inbound calls with missing caller ID when allowlist enabled", () => {
const { manager, provider } = createManagerHarness({

View File

@@ -166,12 +166,6 @@ export class CallManager {
return;
}
// Twilio has provider-specific state for speaking (<Say> fallback) and can
// fail for inbound calls; keep existing Twilio behavior unchanged.
if (this.provider.name === "twilio") {
return;
}
void this.speakInitialMessage(call.providerCallId);
}