From 6d64a2ca9e13995539ff28339d76e832264d41fa Mon Sep 17 00:00:00 2001 From: Fsocietyhhh <1211904451@qq.com> Date: Tue, 19 May 2026 22:37:54 -0700 Subject: [PATCH] feat(voice): expose voicemail_action + voicemail_message on VoiceCall MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Lets the agent control what happens when voicemail picks up, instead of always falling back to the gateway's hang-up default. Parsed from natural language ("if it goes to voicemail, leave this message...") into structured params rather than buried as if-then logic in the free-text task prompt. Both fields are optional and only forwarded when present, so plain calls are unchanged. The schema notes that voicemail is a one-way monologue so the agent doesn't try to script a back-and-forth. Depends on the gateway accepting these fields (blockrun voicemail PR) — the gateway validates with strict mode, so deploy that first. --- src/tools/voice.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/tools/voice.ts b/src/tools/voice.ts index 0417aae..e82ae21 100644 --- a/src/tools/voice.ts +++ b/src/tools/voice.ts @@ -283,6 +283,20 @@ export const voiceCallCapability: CapabilityHandler = { type: 'boolean', description: 'If true, AI waits for the recipient to speak first before talking.', }, + voicemail_action: { + type: 'string', + enum: ['hangup', 'leave_message', 'ignore'], + description: + 'What to do if voicemail is detected. Default (omitted): hang up without a message. ' + + '"leave_message" speaks voicemail_message once then hangs up (voicemail_message required). ' + + '"ignore" skips detection and treats the call as live — only use when sure a human answers.', + }, + voicemail_message: { + type: 'string', + description: + 'The message to leave when voicemail_action is "leave_message" (≤1000 chars). ' + + 'Voicemail is one-way — this is spoken once as a monologue, there is no back-and-forth.', + }, }, required: ['to', 'from', 'task'], }, @@ -306,6 +320,8 @@ export const voiceCallCapability: CapabilityHandler = { if (typeof input.language === 'string') body.language = input.language; if (typeof input.first_sentence === 'string') body.first_sentence = input.first_sentence; if (typeof input.wait_for_greeting === 'boolean') body.wait_for_greeting = input.wait_for_greeting; + if (typeof input.voicemail_action === 'string') body.voicemail_action = input.voicemail_action; + if (typeof input.voicemail_message === 'string') body.voicemail_message = input.voicemail_message; try { const res = await postWithPayment>(