@openclaw/voice-call 2026.5.2 → 2026.5.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +2 -0
- package/dist/call-status-CXldV5o8.js +32 -0
- package/dist/cli-metadata.js +12 -0
- package/dist/config-7w04YpHh.js +548 -0
- package/dist/config-compat-B0me39_4.js +129 -0
- package/dist/guarded-json-api-Btx5EE4w.js +591 -0
- package/dist/http-headers-BrnxBasF.js +10 -0
- package/dist/index.js +1284 -0
- package/dist/mock-CeKvfVEd.js +135 -0
- package/dist/plivo-B-a7KFoT.js +393 -0
- package/dist/realtime-handler-B63CIDP2.js +325 -0
- package/dist/realtime-transcription.runtime-B2h70y2W.js +2 -0
- package/dist/realtime-voice.runtime-Bkh4nvLn.js +2 -0
- package/dist/response-generator-BrcmwDZU.js +182 -0
- package/dist/response-model-CyF5K80p.js +12 -0
- package/dist/runtime-api.js +6 -0
- package/dist/runtime-entry-88ytYAQa.js +3119 -0
- package/dist/runtime-entry.js +2 -0
- package/dist/setup-api.js +37 -0
- package/dist/telnyx-jjBE8boz.js +260 -0
- package/dist/twilio-1OqbcXLL.js +676 -0
- package/dist/voice-mapping-BYDGdWGx.js +40 -0
- package/package.json +14 -6
- package/api.ts +0 -16
- package/cli-metadata.ts +0 -10
- package/config-api.ts +0 -12
- package/index.test.ts +0 -943
- package/index.ts +0 -794
- package/runtime-api.ts +0 -20
- package/runtime-entry.ts +0 -1
- package/setup-api.ts +0 -47
- package/src/allowlist.test.ts +0 -18
- package/src/allowlist.ts +0 -19
- package/src/cli.ts +0 -845
- package/src/config-compat.test.ts +0 -120
- package/src/config-compat.ts +0 -227
- package/src/config.test.ts +0 -479
- package/src/config.ts +0 -808
- package/src/core-bridge.ts +0 -14
- package/src/deep-merge.test.ts +0 -40
- package/src/deep-merge.ts +0 -23
- package/src/gateway-continue-operation.ts +0 -200
- package/src/http-headers.test.ts +0 -16
- package/src/http-headers.ts +0 -15
- package/src/manager/context.ts +0 -42
- package/src/manager/events.test.ts +0 -581
- package/src/manager/events.ts +0 -288
- package/src/manager/lifecycle.ts +0 -53
- package/src/manager/lookup.test.ts +0 -52
- package/src/manager/lookup.ts +0 -35
- package/src/manager/outbound.test.ts +0 -528
- package/src/manager/outbound.ts +0 -486
- package/src/manager/state.ts +0 -48
- package/src/manager/store.ts +0 -106
- package/src/manager/timers.test.ts +0 -129
- package/src/manager/timers.ts +0 -113
- package/src/manager/twiml.test.ts +0 -13
- package/src/manager/twiml.ts +0 -17
- package/src/manager.closed-loop.test.ts +0 -236
- package/src/manager.inbound-allowlist.test.ts +0 -188
- package/src/manager.notify.test.ts +0 -377
- package/src/manager.restore.test.ts +0 -183
- package/src/manager.test-harness.ts +0 -127
- package/src/manager.ts +0 -392
- package/src/media-stream.test.ts +0 -768
- package/src/media-stream.ts +0 -708
- package/src/providers/base.ts +0 -97
- package/src/providers/mock.test.ts +0 -78
- package/src/providers/mock.ts +0 -185
- package/src/providers/plivo.test.ts +0 -93
- package/src/providers/plivo.ts +0 -601
- package/src/providers/shared/call-status.test.ts +0 -24
- package/src/providers/shared/call-status.ts +0 -24
- package/src/providers/shared/guarded-json-api.test.ts +0 -106
- package/src/providers/shared/guarded-json-api.ts +0 -42
- package/src/providers/telnyx.test.ts +0 -340
- package/src/providers/telnyx.ts +0 -394
- package/src/providers/twilio/api.test.ts +0 -145
- package/src/providers/twilio/api.ts +0 -93
- package/src/providers/twilio/twiml-policy.test.ts +0 -84
- package/src/providers/twilio/twiml-policy.ts +0 -87
- package/src/providers/twilio/webhook.ts +0 -34
- package/src/providers/twilio.test.ts +0 -591
- package/src/providers/twilio.ts +0 -861
- package/src/providers/twilio.types.ts +0 -17
- package/src/realtime-defaults.ts +0 -3
- package/src/realtime-fast-context.test.ts +0 -88
- package/src/realtime-fast-context.ts +0 -165
- package/src/realtime-transcription.runtime.ts +0 -4
- package/src/realtime-voice.runtime.ts +0 -5
- package/src/response-generator.test.ts +0 -321
- package/src/response-generator.ts +0 -318
- package/src/response-model.test.ts +0 -71
- package/src/response-model.ts +0 -23
- package/src/runtime.test.ts +0 -536
- package/src/runtime.ts +0 -510
- package/src/telephony-audio.test.ts +0 -61
- package/src/telephony-audio.ts +0 -12
- package/src/telephony-tts.test.ts +0 -196
- package/src/telephony-tts.ts +0 -235
- package/src/test-fixtures.ts +0 -73
- package/src/tts-provider-voice.test.ts +0 -34
- package/src/tts-provider-voice.ts +0 -21
- package/src/tunnel.test.ts +0 -166
- package/src/tunnel.ts +0 -314
- package/src/types.ts +0 -291
- package/src/utils.test.ts +0 -17
- package/src/utils.ts +0 -14
- package/src/voice-mapping.test.ts +0 -34
- package/src/voice-mapping.ts +0 -68
- package/src/webhook/realtime-handler.test.ts +0 -598
- package/src/webhook/realtime-handler.ts +0 -485
- package/src/webhook/stale-call-reaper.test.ts +0 -88
- package/src/webhook/stale-call-reaper.ts +0 -38
- package/src/webhook/tailscale.test.ts +0 -214
- package/src/webhook/tailscale.ts +0 -129
- package/src/webhook-exposure.test.ts +0 -33
- package/src/webhook-exposure.ts +0 -84
- package/src/webhook-security.test.ts +0 -770
- package/src/webhook-security.ts +0 -994
- package/src/webhook.hangup-once.lifecycle.test.ts +0 -135
- package/src/webhook.test.ts +0 -1470
- package/src/webhook.ts +0 -908
- package/src/webhook.types.ts +0 -5
- package/src/websocket-test-support.ts +0 -72
- package/tsconfig.json +0 -16
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it } from "vitest";
|
|
2
|
-
import { VoiceCallConfigSchema, type VoiceCallConfig } from "./config.js";
|
|
3
|
-
import { CallManager } from "./manager.js";
|
|
4
|
-
import { createTestStorePath, FakeProvider } from "./manager.test-harness.js";
|
|
5
|
-
import type { WebhookContext, WebhookParseOptions } from "./types.js";
|
|
6
|
-
import { VoiceCallWebhookServer } from "./webhook.js";
|
|
7
|
-
|
|
8
|
-
const createConfig = (overrides: Partial<VoiceCallConfig> = {}): VoiceCallConfig => {
|
|
9
|
-
const base = VoiceCallConfigSchema.parse({
|
|
10
|
-
enabled: true,
|
|
11
|
-
provider: "plivo",
|
|
12
|
-
fromNumber: "+15550000000",
|
|
13
|
-
inboundPolicy: "disabled",
|
|
14
|
-
});
|
|
15
|
-
base.serve.port = 0;
|
|
16
|
-
|
|
17
|
-
return {
|
|
18
|
-
...base,
|
|
19
|
-
...overrides,
|
|
20
|
-
serve: {
|
|
21
|
-
...base.serve,
|
|
22
|
-
...overrides.serve,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
async function postWebhookForm(server: VoiceCallWebhookServer, baseUrl: string, body: string) {
|
|
28
|
-
const address = (
|
|
29
|
-
server as unknown as { server?: { address?: () => unknown } }
|
|
30
|
-
).server?.address?.();
|
|
31
|
-
const requestUrl = new URL(baseUrl);
|
|
32
|
-
if (
|
|
33
|
-
!address ||
|
|
34
|
-
typeof address !== "object" ||
|
|
35
|
-
!("port" in address) ||
|
|
36
|
-
(typeof address.port !== "number" && typeof address.port !== "string") ||
|
|
37
|
-
!address.port
|
|
38
|
-
) {
|
|
39
|
-
throw new Error("voice webhook server did not expose a bound port");
|
|
40
|
-
}
|
|
41
|
-
requestUrl.port = String(address.port);
|
|
42
|
-
return await fetch(requestUrl.toString(), {
|
|
43
|
-
method: "POST",
|
|
44
|
-
headers: {
|
|
45
|
-
"content-type": "application/x-www-form-urlencoded",
|
|
46
|
-
"x-plivo-signature-v2": "sig",
|
|
47
|
-
"x-plivo-signature-v2-nonce": "nonce",
|
|
48
|
-
},
|
|
49
|
-
body,
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function runDuplicateInboundReplayLifecycleTest(provider: FakeProvider) {
|
|
54
|
-
const config = createConfig();
|
|
55
|
-
const manager = new CallManager(config, createTestStorePath());
|
|
56
|
-
await manager.initialize(provider, "https://example.com/voice/webhook");
|
|
57
|
-
const server = new VoiceCallWebhookServer(config, manager, provider);
|
|
58
|
-
|
|
59
|
-
try {
|
|
60
|
-
const baseUrl = await server.start();
|
|
61
|
-
const first = await postWebhookForm(server, baseUrl, "CallSid=CA123&From=%2B15552222222");
|
|
62
|
-
const second = await postWebhookForm(server, baseUrl, "CallSid=CA123&From=%2B15552222222");
|
|
63
|
-
return { first, second, manager };
|
|
64
|
-
} finally {
|
|
65
|
-
await server.stop();
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function expectSingleRejectedReplayHangup(params: {
|
|
70
|
-
first: Response;
|
|
71
|
-
second: Response;
|
|
72
|
-
provider: FakeProvider;
|
|
73
|
-
manager: CallManager;
|
|
74
|
-
}) {
|
|
75
|
-
expect(params.first.status).toBe(200);
|
|
76
|
-
expect(params.second.status).toBe(200);
|
|
77
|
-
expect(params.provider.hangupCalls).toHaveLength(1);
|
|
78
|
-
expect(params.provider.hangupCalls[0]).toEqual(
|
|
79
|
-
expect.objectContaining({
|
|
80
|
-
providerCallId: "provider-inbound-1",
|
|
81
|
-
reason: "hangup-bot",
|
|
82
|
-
}),
|
|
83
|
-
);
|
|
84
|
-
expect(params.manager.getCallByProviderCallId("provider-inbound-1")).toBeUndefined();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
class RejectInboundReplayProvider extends FakeProvider {
|
|
88
|
-
override verifyWebhook() {
|
|
89
|
-
return { ok: true, verifiedRequestKey: "verified:req:reject-once" };
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
override parseWebhookEvent(_ctx: WebhookContext, options?: WebhookParseOptions) {
|
|
93
|
-
return {
|
|
94
|
-
statusCode: 200,
|
|
95
|
-
events: [
|
|
96
|
-
{
|
|
97
|
-
id: "evt-reject-once",
|
|
98
|
-
dedupeKey: options?.verifiedRequestKey,
|
|
99
|
-
type: "call.initiated" as const,
|
|
100
|
-
callId: "provider-inbound-1",
|
|
101
|
-
providerCallId: "provider-inbound-1",
|
|
102
|
-
timestamp: Date.now(),
|
|
103
|
-
direction: "inbound" as const,
|
|
104
|
-
from: "+15552222222",
|
|
105
|
-
to: "+15550000000",
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
class RejectInboundReplayWithHangupFailureProvider extends RejectInboundReplayProvider {
|
|
113
|
-
override async hangupCall(input: Parameters<FakeProvider["hangupCall"]>[0]): Promise<void> {
|
|
114
|
-
this.hangupCalls.push(input);
|
|
115
|
-
throw new Error("hangup failed");
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
describe("Voice-call webhook hangup-once lifecycle", () => {
|
|
120
|
-
afterEach(() => {
|
|
121
|
-
// Each test uses an isolated store path, so only server cleanup is needed.
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it("hangs up a rejected inbound replay only once across duplicate webhook delivery", async () => {
|
|
125
|
-
const provider = new RejectInboundReplayProvider("plivo");
|
|
126
|
-
const { first, second, manager } = await runDuplicateInboundReplayLifecycleTest(provider);
|
|
127
|
-
expectSingleRejectedReplayHangup({ first, second, provider, manager });
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it("does not attempt a second hangup when replay arrives after the first hangup fails", async () => {
|
|
131
|
-
const provider = new RejectInboundReplayWithHangupFailureProvider("plivo");
|
|
132
|
-
const { first, second, manager } = await runDuplicateInboundReplayLifecycleTest(provider);
|
|
133
|
-
expectSingleRejectedReplayHangup({ first, second, provider, manager });
|
|
134
|
-
});
|
|
135
|
-
});
|