@kodelyth/voice-call 2026.5.39 → 2026.6.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/README.md +167 -0
- package/dist/api.js +2 -0
- package/dist/cli-metadata.js +12 -0
- package/dist/config-DAwbG2aw.js +621 -0
- package/dist/config-compat-BYfJ5ueI.js +129 -0
- package/dist/guarded-json-api-xAIbFPZh.js +591 -0
- package/dist/index.js +1341 -0
- package/dist/mock-jtSdKDQN.js +135 -0
- package/dist/plivo-L-JTeuEc.js +392 -0
- package/dist/realtime-handler-5pSItXxX.js +1227 -0
- package/dist/realtime-transcription.runtime-CAbQKwCN.js +2 -0
- package/dist/realtime-voice.runtime-vCpCAutg.js +2 -0
- package/dist/response-generator-B-MjbtsM.js +199 -0
- package/dist/runtime-api.js +6 -0
- package/dist/runtime-entry-ohPMJR46.js +3435 -0
- package/dist/runtime-entry.js +2 -0
- package/dist/setup-api.js +37 -0
- package/dist/telnyx-BWr9EZ4x.js +278 -0
- package/dist/twilio-D9B0zY1k.js +679 -0
- package/klaw.plugin.json +30 -133
- package/package.json +18 -6
- package/api.js +0 -7
- package/cli-metadata.js +0 -7
- package/index.js +0 -7
- package/runtime-api.js +0 -7
- package/runtime-entry.js +0 -7
- package/setup-api.js +0 -7
package/README.md
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
# @klaw/voice-call
|
|
2
|
+
|
|
3
|
+
Official Voice Call plugin for **Klaw**.
|
|
4
|
+
|
|
5
|
+
Providers:
|
|
6
|
+
|
|
7
|
+
- **Twilio** (Programmable Voice + Media Streams)
|
|
8
|
+
- **Telnyx** (Call Control v2)
|
|
9
|
+
- **Plivo** (Voice API + XML transfer + GetInput speech)
|
|
10
|
+
- **Mock** (dev/no network)
|
|
11
|
+
|
|
12
|
+
Docs: `https://klaw.kodelyth.com/plugins/voice-call`
|
|
13
|
+
Plugin system: `https://klaw.kodelyth.com/plugin`
|
|
14
|
+
|
|
15
|
+
## Install (local dev)
|
|
16
|
+
|
|
17
|
+
### Option A: install via Klaw (recommended)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
klaw plugins install @klaw/voice-call
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Restart the Gateway afterwards.
|
|
24
|
+
|
|
25
|
+
### Option B: copy into your global extensions folder (dev)
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
PLUGIN_HOME=~/.klaw/extensions
|
|
29
|
+
mkdir -p "$PLUGIN_HOME"
|
|
30
|
+
cp -R <local-plugin-checkout> "$PLUGIN_HOME/voice-call"
|
|
31
|
+
cd "$PLUGIN_HOME/voice-call" && pnpm install
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Config
|
|
35
|
+
|
|
36
|
+
Put under `plugins.entries.voice-call.config`:
|
|
37
|
+
|
|
38
|
+
```json5
|
|
39
|
+
{
|
|
40
|
+
provider: "twilio", // or "telnyx" | "plivo" | "mock"
|
|
41
|
+
fromNumber: "+15550001234",
|
|
42
|
+
toNumber: "+15550005678",
|
|
43
|
+
sessionScope: "per-phone", // or "per-call"
|
|
44
|
+
|
|
45
|
+
twilio: {
|
|
46
|
+
accountSid: "ACxxxxxxxx",
|
|
47
|
+
authToken: "your_token",
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
telnyx: {
|
|
51
|
+
apiKey: "KEYxxxx",
|
|
52
|
+
connectionId: "CONNxxxx",
|
|
53
|
+
// Telnyx webhook public key from the Telnyx Mission Control Portal
|
|
54
|
+
// (Base64 string; can also be set via TELNYX_PUBLIC_KEY).
|
|
55
|
+
publicKey: "...",
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
plivo: {
|
|
59
|
+
authId: "MAxxxxxxxxxxxxxxxxxxxx",
|
|
60
|
+
authToken: "your_token",
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
// Webhook server
|
|
64
|
+
serve: {
|
|
65
|
+
port: 3334,
|
|
66
|
+
path: "/voice/webhook",
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
// Public exposure (pick one):
|
|
70
|
+
// publicUrl: "https://example.ngrok.app/voice/webhook",
|
|
71
|
+
// tunnel: { provider: "ngrok" },
|
|
72
|
+
// tailscale: { mode: "funnel", path: "/voice/webhook" }
|
|
73
|
+
|
|
74
|
+
outbound: {
|
|
75
|
+
defaultMode: "notify", // or "conversation"
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
// Optional response agent workspace. Defaults to "main".
|
|
79
|
+
agentId: "main",
|
|
80
|
+
|
|
81
|
+
streaming: {
|
|
82
|
+
enabled: true,
|
|
83
|
+
// optional; if omitted, Voice Call picks the first registered
|
|
84
|
+
// realtime-transcription provider by autoSelectOrder
|
|
85
|
+
provider: "<realtime-transcription-provider-id>",
|
|
86
|
+
streamPath: "/voice/stream",
|
|
87
|
+
providers: {
|
|
88
|
+
"<realtime-transcription-provider-id>": {
|
|
89
|
+
// provider-owned options
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
preStartTimeoutMs: 5000,
|
|
93
|
+
maxPendingConnections: 32,
|
|
94
|
+
maxPendingConnectionsPerIp: 4,
|
|
95
|
+
maxConnections: 128,
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Notes:
|
|
101
|
+
|
|
102
|
+
- Twilio/Telnyx/Plivo require a **publicly reachable** webhook URL.
|
|
103
|
+
- `mock` is a local dev provider (no network calls).
|
|
104
|
+
- Telnyx requires `telnyx.publicKey` (or `TELNYX_PUBLIC_KEY`) unless `skipSignatureVerification` is true.
|
|
105
|
+
- If older configs still use `provider: "log"`, `twilio.from`, or legacy `streaming.*` OpenAI keys, run `klaw doctor --fix` to rewrite them.
|
|
106
|
+
- advanced webhook, streaming, and tunnel notes: `https://klaw.kodelyth.com/plugins/voice-call`
|
|
107
|
+
- `responseModel` is optional. When unset, voice responses use the runtime default model.
|
|
108
|
+
- `sessionScope` defaults to `per-phone`, preserving caller memory across calls. Use `per-call` for reception, booking, IVR, and bridge flows where each carrier call should start fresh.
|
|
109
|
+
- `realtime.consultThinkingLevel` is optional. When set, it overrides the thinking level used by the model behind realtime `klaw_agent_consult` calls.
|
|
110
|
+
- `realtime.consultFastMode` is optional. When set, it toggles fast mode for realtime `klaw_agent_consult` calls.
|
|
111
|
+
|
|
112
|
+
## Stale call reaper
|
|
113
|
+
|
|
114
|
+
See the plugin docs for recommended ranges and production examples:
|
|
115
|
+
`https://klaw.kodelyth.com/plugins/voice-call#stale-call-reaper`
|
|
116
|
+
|
|
117
|
+
## TTS for calls
|
|
118
|
+
|
|
119
|
+
Voice Call uses the core `messages.tts` configuration for
|
|
120
|
+
streaming speech on calls. Override examples and provider caveats live here:
|
|
121
|
+
`https://klaw.kodelyth.com/plugins/voice-call#tts-for-calls`
|
|
122
|
+
|
|
123
|
+
## CLI
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
klaw voicecall call --to "+15555550123" --message "Hello from Klaw"
|
|
127
|
+
klaw voicecall continue --call-id <id> --message "Any questions?"
|
|
128
|
+
klaw voicecall speak --call-id <id> --message "One moment"
|
|
129
|
+
klaw voicecall end --call-id <id>
|
|
130
|
+
klaw voicecall status --json
|
|
131
|
+
klaw voicecall status --call-id <id>
|
|
132
|
+
klaw voicecall tail
|
|
133
|
+
klaw voicecall expose --mode funnel
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Tool
|
|
137
|
+
|
|
138
|
+
Tool name: `voice_call`
|
|
139
|
+
|
|
140
|
+
Actions:
|
|
141
|
+
|
|
142
|
+
- `initiate_call` (message, to?, mode?)
|
|
143
|
+
- `continue_call` (callId, message)
|
|
144
|
+
- `speak_to_user` (callId, message)
|
|
145
|
+
- `end_call` (callId)
|
|
146
|
+
- `get_status` (callId)
|
|
147
|
+
|
|
148
|
+
## Gateway RPC
|
|
149
|
+
|
|
150
|
+
- `voicecall.initiate` (to?, message, mode?)
|
|
151
|
+
- `voicecall.continue` (callId, message)
|
|
152
|
+
- `voicecall.speak` (callId, message)
|
|
153
|
+
- `voicecall.end` (callId)
|
|
154
|
+
- `voicecall.status` (callId)
|
|
155
|
+
|
|
156
|
+
## Notes
|
|
157
|
+
|
|
158
|
+
- Uses webhook signature verification for Twilio/Telnyx/Plivo.
|
|
159
|
+
- Adds replay protection for Twilio and Plivo webhooks (valid duplicate callbacks are ignored safely).
|
|
160
|
+
- Twilio speech turns include a per-turn token so stale/replayed callbacks cannot complete a newer turn.
|
|
161
|
+
- `responseModel` / `responseSystemPrompt` control AI auto-responses.
|
|
162
|
+
- Voice-call auto-responses enforce a spoken JSON contract (`{"spoken":"..."}`) and filter reasoning/meta output before playback.
|
|
163
|
+
- While a Twilio stream is active, playback does not fall back to TwiML `<Say>`; stream-TTS failures fail the playback request.
|
|
164
|
+
- Outbound conversation calls suppress barge-in only while the initial greeting is actively speaking, then re-enable normal interruption.
|
|
165
|
+
- Twilio stream disconnect auto-end uses a short grace window so quick reconnects do not end the call.
|
|
166
|
+
- Realtime provider selection is generic. Configure `streaming.provider` / `realtime.provider` and put provider-owned options under `providers.<id>`.
|
|
167
|
+
- Runtime fallback still accepts the old voice-call keys for now, but migration is a doctor step and the compat shim is scheduled to go away in a future release.
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { TtsAutoSchema, TtsConfigSchema, TtsModeSchema, TtsProviderSchema, definePluginEntry, fetchWithSsrFGuard, isBlockedHostnameOrIp, isRequestBodyLimitError, readRequestBodyWithLimit, requestBodyErrorToText, sleep } from "./runtime-api.js";
|
|
2
|
+
export { TtsAutoSchema, TtsConfigSchema, TtsModeSchema, TtsProviderSchema, definePluginEntry, fetchWithSsrFGuard, isBlockedHostnameOrIp, isRequestBodyLimitError, readRequestBodyWithLimit, requestBodyErrorToText, sleep };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { definePluginEntry } from "klaw/plugin-sdk/plugin-entry";
|
|
2
|
+
//#region extensions/voice-call/cli-metadata.ts
|
|
3
|
+
var cli_metadata_default = definePluginEntry({
|
|
4
|
+
id: "voice-call",
|
|
5
|
+
name: "Voice Call",
|
|
6
|
+
description: "Voice call channel plugin",
|
|
7
|
+
register(api) {
|
|
8
|
+
api.registerCli(() => {}, { commands: ["voicecall"] });
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { cli_metadata_default as default };
|