mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 08:58:37 +00:00
fix(voice-call): speak inbound greeting for twilio answered calls
This commit is contained in:
committed by
Peter Steinberger
parent
b8b8a5f314
commit
fe4c627432
@@ -111,28 +111,31 @@ describe("CallManager", () => {
|
|||||||
expect(manager.getCallByProviderCallId("request-uuid")).toBeUndefined();
|
expect(manager.getCallByProviderCallId("request-uuid")).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("speaks initial message on answered for notify mode (non-Twilio)", async () => {
|
it.each(["plivo", "twilio"] as const)(
|
||||||
const { manager, provider } = createManagerHarness();
|
"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, {
|
const { callId, success } = await manager.initiateCall("+15550000002", undefined, {
|
||||||
message: "Hello there",
|
message: "Hello there",
|
||||||
mode: "notify",
|
mode: "notify",
|
||||||
});
|
});
|
||||||
expect(success).toBe(true);
|
expect(success).toBe(true);
|
||||||
|
|
||||||
manager.processEvent({
|
manager.processEvent({
|
||||||
id: "evt-2",
|
id: `evt-2-${providerName}`,
|
||||||
type: "call.answered",
|
type: "call.answered",
|
||||||
callId,
|
callId,
|
||||||
providerCallId: "call-uuid",
|
providerCallId: "call-uuid",
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
});
|
});
|
||||||
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 0));
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
||||||
|
|
||||||
expect(provider.playTtsCalls).toHaveLength(1);
|
expect(provider.playTtsCalls).toHaveLength(1);
|
||||||
expect(provider.playTtsCalls[0]?.text).toBe("Hello there");
|
expect(provider.playTtsCalls[0]?.text).toBe("Hello there");
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
it("rejects inbound calls with missing caller ID when allowlist enabled", () => {
|
it("rejects inbound calls with missing caller ID when allowlist enabled", () => {
|
||||||
const { manager, provider } = createManagerHarness({
|
const { manager, provider } = createManagerHarness({
|
||||||
|
|||||||
@@ -166,12 +166,6 @@ export class CallManager {
|
|||||||
return;
|
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);
|
void this.speakInitialMessage(call.providerCallId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user