fix(voice-call): reap stale pre-answer calls · openclaw/openclaw@a669ba7
steipete
·
2026-04-25
·
via Recent Commits to openclaw:main
File tree
extensions/voice-call/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -73,7 +73,7 @@ Docs: https://docs.openclaw.ai
|
73 | 73 | - Config/doctor: reject legacy `secretref-env:<ENV_VAR>` marker strings on SecretRef credential paths and migrate valid markers to structured env SecretRefs with `openclaw doctor --fix`. Fixes #51794. Thanks @halointellicore. |
74 | 74 | - Providers/OpenAI: separate API-key and Codex sign-in onboarding groups, and avoid replaying stale OpenAI Responses reasoning blocks after a model route switch. |
75 | 75 | - Providers/ElevenLabs: omit the MP3-only `Accept` header for PCM telephony synthesis, so Voice Call requests for `pcm_22050` no longer receive MP3 audio. Fixes #67340. Thanks @marcchabot. |
76 | | -- Plugins/Voice Call: honor configured TTS timeouts for Twilio media-stream playback and fail empty telephony audio instead of completing as silence. Fixes #42071; supersedes #60957. Thanks @Ryce and @sliekens. |
| 76 | +- Plugins/Voice Call: reap stale pre-answer calls by default, honor configured TTS timeouts for Twilio media-stream playback, and fail empty telephony audio instead of completing as silence. Fixes #42071; supersedes #60957. Thanks @Ryce and @sliekens. |
77 | 77 | - Skills: honor legacy `metadata.clawdbot` requirements and installer hints when `metadata.openclaw` is absent, so older skills no longer appear ready when required binaries are missing. Fixes #71323. Thanks @chen-zhang-cs-code. |
78 | 78 | - Browser/config: expand `~` in `browser.executablePath` before Chromium launch, so home-relative custom browser paths no longer fail with `ENOENT`. Fixes #67264. Thanks @Quratulain-bilal. |
79 | 79 | - Telegram/streaming: hide tool-progress status updates by default while keeping explicit `streaming.preview.toolProgress` opt-in support for edited preview messages. Fixes #71320. Thanks @neeravmakwana. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -226,6 +226,14 @@ describe("validateProviderConfig", () => {
|
226 | 226 | }); |
227 | 227 | }); |
228 | 228 | |
| 229 | +describe("resolveVoiceCallConfig", () => { |
| 230 | +it("enables the pre-answer stale call reaper by default", () => { |
| 231 | +const config = resolveVoiceCallConfig({ enabled: true, provider: "mock" }); |
| 232 | + |
| 233 | +expect(config.staleCallReaperSeconds).toBe(120); |
| 234 | +}); |
| 235 | +}); |
| 236 | + |
229 | 237 | describe("normalizeVoiceCallConfig", () => { |
230 | 238 | it("fills nested runtime defaults from a partial config boundary", () => { |
231 | 239 | const normalized = normalizeVoiceCallConfig({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -331,11 +331,10 @@ export const VoiceCallConfigSchema = z
|
331 | 331 | |
332 | 332 | /** |
333 | 333 | * Maximum age of a call in seconds before it is automatically reaped. |
334 | | - * Catches calls stuck in unexpected states (e.g., notify-mode calls that |
335 | | - * never receive a terminal webhook). Set to 0 to disable. |
336 | | - * Default: 0 (disabled). Recommended: 120-300 for production. |
| 334 | + * Catches calls stuck before answer (for example, local mock calls that |
| 335 | + * never receive provider webhooks). Set to 0 to disable. |
337 | 336 | */ |
338 | | -staleCallReaperSeconds: z.number().int().nonnegative().default(0), |
| 337 | +staleCallReaperSeconds: z.number().int().nonnegative().default(120), |
339 | 338 | |
340 | 339 | /** Silence timeout for end-of-speech detection (ms) */ |
341 | 340 | silenceTimeoutMs: z.number().int().positive().default(800), |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -353,11 +353,12 @@ async function runStaleCallReaperCase(params: {
|
353 | 353 | callAgeMs: number; |
354 | 354 | staleCallReaperSeconds: number; |
355 | 355 | advanceMs: number; |
| 356 | +callOverrides?: Partial<CallRecord>; |
356 | 357 | }) { |
357 | 358 | const now = new Date("2026-02-16T00:00:00Z"); |
358 | 359 | vi.setSystemTime(now); |
359 | 360 | |
360 | | -const call = createCall(now.getTime() - params.callAgeMs); |
| 361 | +const call = { ...createCall(now.getTime() - params.callAgeMs), ...params.callOverrides }; |
361 | 362 | const { manager, endCall } = createManager([call]); |
362 | 363 | const config = createConfig({ staleCallReaperSeconds: params.staleCallReaperSeconds }); |
363 | 364 | const server = new VoiceCallWebhookServer(config, manager, provider); |
@@ -485,6 +486,19 @@ describe("VoiceCallWebhookServer stale call reaper", () => {
|
485 | 486 | await server.stop(); |
486 | 487 | } |
487 | 488 | }); |
| 489 | + |
| 490 | +it("does not reap calls that reached the answered state", async () => { |
| 491 | +const { endCall } = await runStaleCallReaperCase({ |
| 492 | +callAgeMs: 120_000, |
| 493 | +staleCallReaperSeconds: 60, |
| 494 | +advanceMs: 30_000, |
| 495 | +callOverrides: { |
| 496 | +state: "answered", |
| 497 | +answeredAt: new Date("2026-02-15T23:58:30Z").getTime(), |
| 498 | +}, |
| 499 | +}); |
| 500 | +expect(endCall).not.toHaveBeenCalled(); |
| 501 | +}); |
488 | 502 | }); |
489 | 503 | |
490 | 504 | describe("VoiceCallWebhookServer path matching", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import type { CallManager } from "../manager.js"; |
| 2 | +import { TerminalStates } from "../types.js"; |
2 | 3 | |
3 | 4 | const CHECK_INTERVAL_MS = 30_000; |
4 | 5 | |
@@ -15,6 +16,10 @@ export function startStaleCallReaper(params: {
|
15 | 16 | const interval = setInterval(() => { |
16 | 17 | const now = Date.now(); |
17 | 18 | for (const call of params.manager.getActiveCalls()) { |
| 19 | +if (call.answeredAt || TerminalStates.has(call.state)) { |
| 20 | +continue; |
| 21 | +} |
| 22 | + |
18 | 23 | const age = now - call.startedAt; |
19 | 24 | if (age > maxAgeMs) { |
20 | 25 | console.log( |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。