

























@@ -274,20 +274,16 @@ describe("VoiceCallWebhookServer realtime transcription provider selection", ()
274274payload: { text: "hello", role: "user" },
275275});
276276277-expect(call.metadata).toEqual(
278-expect.objectContaining({
279-lastTalkEventAt: "2026-05-05T06:00:00.000Z",
280-lastTalkEventType: "transcript.done",
281-recentTalkEvents: [
282-{
283-at: "2026-05-05T06:00:00.000Z",
284-type: "transcript.done",
285-sessionId: "voice-call:provider-call-1:MZ-talk",
286-turnId: "MZ-talk:turn:1",
287-},
288-],
289-}),
290-);
277+expect(call.metadata?.lastTalkEventAt).toBe("2026-05-05T06:00:00.000Z");
278+expect(call.metadata?.lastTalkEventType).toBe("transcript.done");
279+expect(call.metadata?.recentTalkEvents).toEqual([
280+{
281+at: "2026-05-05T06:00:00.000Z",
282+type: "transcript.done",
283+sessionId: "voice-call:provider-call-1:MZ-talk",
284+turnId: "MZ-talk:turn:1",
285+},
286+]);
291287} finally {
292288await server.stop();
293289}
@@ -1535,15 +1531,16 @@ describe("VoiceCallWebhookServer barge-in suppression during initial message", (
15351531media.config.onSpeechStart?.("CA-inbound");
15361532media.config.onTranscript?.("CA-inbound", "hello");
15371533expect(clearTtsQueue).toHaveBeenCalledTimes(2);
1538-expect(processEvent).toHaveBeenCalledWith(
1539-expect.objectContaining({
1540-type: "call.speech",
1541-callId: "call-inbound",
1542-providerCallId: "CA-inbound",
1543-transcript: "hello",
1544-isFinal: true,
1545-}),
1546-);
1534+expect(processEvent).toHaveBeenCalledTimes(1);
1535+const event = processEvent.mock.calls[0]?.[0] as NormalizedEvent | undefined;
1536+expect(event?.type).toBe("call.speech");
1537+if (event?.type !== "call.speech") {
1538+throw new Error("expected media transcript callback to emit a speech event");
1539+}
1540+expect(event.callId).toBe("call-inbound");
1541+expect(event.providerCallId).toBe("CA-inbound");
1542+expect(event.transcript).toBe("hello");
1543+expect(event.isFinal).toBe(true);
15471544expect(handleInboundResponse).toHaveBeenCalledWith("call-inbound", "hello");
15481545} finally {
15491546await server.stop();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。