Skip to content

Add the Let callers leave voicemail guide - #992

Open
Devon-White wants to merge 2 commits into
mainfrom
devon/platform/voicemail-guide
Open

Devon-White wants to merge 2 commits into
mainfrom
devon/platform/voicemail-guide

Conversation

@Devon-White

Copy link
Copy Markdown
Collaborator

Closes #903
Refs #765

Summary

  • New capability guide Let callers leave voicemail (/docs/platform/voice/voicemail), concept-first with one tab per approach inside each step, in SDK-first order: SWML served by the Server SDKs, WebSocket (Relay), cXML, Call Flow Builder.
    • How voicemail works: what ends a recording, and a table mapping the setting names across SWML/Relay, cXML, and Call Flow Builder.
    • Take a message on every call: a walkthrough that runs a handler, points the number at it, and leaves a test message. Each handler prints the recording's URL.
    • Forward calls first, then take a message: rings a second phone and takes a message only on no answer, busy, or decline. SWML uses connect's result branch, Relay uses calling.call.connect events, and cXML uses the <Dial> action with DialCallStatus.
    • Get each voicemail in your app: where the URL arrives on each surface, how an empty message looks, the Call Flow Builder Request node, and the media URL protection warning.
    • Leave a voicemail on a call you place: links to the existing machine detection guide instead of repeating it.
  • Card on the voice overview after Forward calls, and a fern/llms.txt bullet after Forward calls, using the page's description.
  • The voice nav is folder-driven and sorted by title. The title "Let callers leave voicemail" sorts directly after "Forward calls", so the nav yml doesn't change.

Behavior verified against source

  • SWML record:
    • Parameter whitelist and defaults: terminators #, beep false, end_silence_timeout 5 s, initial_timeout 4 s. These match the record reference.
    • status_url posts calling.call.record events with states recording, then finished or no_input.
    • A caller who hangs up without speaking is reported as no_input.
    • record_url is set even when nothing was captured, which is why the guide tells readers to check the event state.
    • play answers the call by default.
  • SWML connect:
    • After the destination hangs up, the document continues for the caller. After the caller hangs up, it stops.
    • connect_result is connected or failed. result given as an object runs as a switch on connect_result. The guide covers both cases so no "no matching case" warning fires.
  • Relay: the calling.record audio whitelist includes beep, initial_timeout, end_silence_timeout, max_length, and terminators.
  • Server SDKs (latest signalwire-sdk and @signalwire/sdk are both 3.15.3):
    • call.record() returns a RecordAction. wait() resolves on finished or no_input, and the event params carry url and duration.
    • play_tts/playTTS, connect, and ConnectEvent.connect_state match the samples.
    • SWMLService.as_router()/getApp() is used.
    • phone_numbers.set_cxml_webhook/setCxmlWebhook sets call_handler: laml_webhooks and call_request_url.
  • cXML:
    • <Record> without action re-requests the current document, so the caller hears the greeting again. Every sample sets action.
    • The action request carries RecordingUrl, RecordingDuration, and Digits plus the call's standard parameters. For an empty recording it carries no RecordingUrl.
    • <Dial> without action continues to the next verb whatever the outcome. DialCallStatus is completed, busy, no-answer, or failed.
    • Relative action URLs resolve against the current document's URL.
  • Call Flow Builder: node names, outputs, and %{record_url} come from the existing node reference pages.

Notes for reviewers

  • cXML needs a server here. A static cXML document can't run voicemail only on no-answer: <Dial> continues to the next verb after a completed call too. A <Record> without action loops back to the greeting. Both cXML samples are small FastAPI and Hono servers rather than a hosted cXML script.
  • cXML number assignment is shown in code only. It uses the Server SDKs' set_cxml_webhook, or PUT phone number. I couldn't confirm the Dashboard labels for assigning a cXML webhook, so the Dashboard steps aren't shown for cXML. The cXML entry route accepts GET and POST, so it works whichever request method the number uses.
  • TypeScript call.record() type gap. The type doesn't list max_length, though the backend accepts it. The TypeScript Relay samples pass the audio settings through a variable, as the Record calls guide does, with a comment.
  • Left out, unverified:
    • Whether a recording's file has finished uploading when the cXML action request or SWML record_url is available. The guide tells SWML readers to rely on the finished event.
    • Whether a cXML caller who hangs up after a few seconds of silence still produces a RecordingUrl. The verification step only promises No message for SWML and Relay.
    • What Call Flow Builder reports for an empty message.
    • The Call Flow Builder Initial Timeout setting. Its reference page describes it as waiting for a DTMF digit, which doesn't match SWML's initial_timeout, so the guide doesn't map or set it.
  • Overview card icon. The overview already uses regular voicemail for Detect machines, so the new card uses regular inbox.
  • fern-check fails only on "Missing redirects check skipped: could not reach FDR (FDR returned 403)". This is environmental.

Verification

  • Python: every sample passes pyflakes.
  • Python SWML and cXML servers: run locally.
    • The SWML document is served with basic auth and returns 401 without it.
    • Sample calling.call.record POSTs print the URL.
    • The cXML routes return well-formed XML for /incoming, /dial-result (no-answer and completed), and /recorded, with and without RecordingUrl.
  • TypeScript: every sample passes tsc --strict against @signalwire/sdk 3.15.3. The SWML and cXML servers also ran locally with the same checks as Python.
  • Relay samples: start and attempt to connect with tsx.
  • SWML output: the builder output is identical between Python and TypeScript, and matches the hand-written YAML and JSON.
  • Code blocks: all JSON and YAML blocks parse, and all bash blocks pass bash -n.
  • Links: every internal link checked against the target page's slug:, and every #anchor checked against the target heading.
  • Checks: yarn fern-md-check passes. yarn fern-check fails only on the FDR 403 above.

Preview

Cover straight-to-voicemail and forward-then-voicemail on SWML (served by the
Server SDKs), Relay, cXML, and Call Flow Builder, and how each delivers the
recording's URL. Link machine detection for leaving a message on an outbound
call. Add the voice overview card and the root llms.txt entry.
@Devon-White Devon-White self-assigned this Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

@Manny-r31

Copy link
Copy Markdown
Collaborator

Nice work, Devon. The SWML and Relay content holds up. I checked the fields, defaults, event states, and SDK calls and found one small bug. The two things I'd change before merging are structural. The cXML approach should come off this page, and the page should use the approach-first headings that the sibling voice guides use.

Structure and conventions

1. Drop cXML from the page. The platform voice guides stay SWML-native, and none of the other capability guides in fern/products/platform/pages/calling/voice/ cover cXML or the Compatibility API. The capability-guides rule also leaves cXML out of its surface list. Remove:

  • the compatibility-api, cxml-record, and cxml-dial link definitions (lines 25-27)
  • the cXML bullet under "Choose an approach" (lines 53-54) and "For SWML and cXML" in the prepare list (line 67)
  • the cXML column of the settings table (lines 106-111)
  • the three cXML tabs (lines 401-499, 552-611, 1033-1143) and the cXML troubleshooting bullet (lines 648-649)
  • the cXML row of the "Get each voicemail in your app" table (line 1184)
  • the "Record verb" card in Next steps (lines 1230-1232)
  • "cXML" in the frontmatter description (line 4) and in the matching fern/llms.txt bullet. Keep the two descriptions identical after the edit.

The cXML assignment step is also the only place the page shows the Server SDKs and a PUT phone number call. Removing it takes care of the "Dashboard labels unconfirmed" note in the PR description.

2. Use approach-first headings, not tabs per approach. "Choose an approach" sets the page up as approach-first. The rule for that layout is one ## per approach with the same ### tasks under each one, which is what forward-calls.mdx and machine-detection.mdx do. Here every approach sits in a tab inside two task-level <Steps> blocks, so the TOC, site search, and anyone linking to a heading never see a surface-specific section. Tabs inside Steps are meant for steps that differ only by transport (REST vs WebSocket (Relay)). The outbound-api groupId belongs to that pair, so a reader who picked REST on another voice page lands here with no matching tab.

Suggested outline:

## Choose an approach
## Prepare for voicemail
## How voicemail works
## Take voicemail via SWML
   ### Take a message on every call via SWML        (Steps: run, point the number, leave a message)
   ### Forward calls first, then take a message via SWML
## Take voicemail via WebSocket (Relay)
   ### Take a message on every call via WebSocket (Relay)
   ### Forward calls first, then take a message via WebSocket (Relay)
## Take voicemail in Call Flow Builder
   ### Take a message on every call in Call Flow Builder
   ### Forward calls first, then take a message in Call Flow Builder
## Get each voicemail in your app
## Leave a voicemail on a call you place
## Next steps

Rewrite the "Choose an approach" paragraph (lines 44-46) to match: "pick one and follow only its section", as forward-calls.mdx puts it.

Technical

3. The Python SWML status handler can raise on an error event (lines 174 and 726). The record reference says status_url can also receive a calling.error event. Its params has error and no state, so params["state"] raises KeyError and the route returns a 500. The TypeScript handler is fine. Suggested fix for both Python samples:

    state = params.get("state")
    if state == "finished":
        print(f"New voicemail on call {params['call_id']}: {params['url']} ({params['duration']} s)")
    elif state == "no_input":

Everything else I checked is right:

  • the record fields and defaults
  • the recording, finished, and no_input states, and a speechless hangup coming back as no_input
  • the event's url, duration, size, and recording_id
  • record_url behavior
  • connect result and connect_result
  • max_length being accepted on the Relay record command
  • the Python and TypeScript SDK calls against 3.15.3, including the TypeScript record() type that doesn't list max_length

Other

4. Link the new guide from its siblings. The rule's "Ships with the page" list asks for this. record-calls.mdx line 694 ("Record a single message or voicemail") and the no-answer message in forward-calls.mdx (intro, line 24, and the SWML bullet, line 35) both describe this exact flow, and each should get a one-line pointer to /docs/platform/voice/voicemail.

5. First-mention links. "Resource" (line 45) should link to /docs/platform/resources. The "WebSocket (Relay)" bullet (line 51) has no link, while the other bullets do. call-queues.mdx links Relay to /docs/server-sdks/guides/relay-client, and that would work here too.

6. Please run the Call Flow Builder flow once in the Dashboard. I couldn't check the node's runtime behavior. The Voicemail Recording reference opens with "This node uses the asynchronous recording method". If that were true, the goodbye node would play during the message, not after it. The same page's example says the nodes after it run once the caller finishes, so the reference probably just contradicts itself. Still, a test call that confirms the goodbye plays after # would settle it. If it does, the "asynchronous" line in that reference is the bug, and it predates this PR.

Nav, links, and anchors are fine. The voice folder is folder-driven, so no yml change is needed. Every link definition and #anchor resolves to a real slug: and heading. The overview card and the fern/llms.txt placement after Forward calls both look right.

- Remove the cXML approach: link definitions, approach bullet, settings
  column, the three cXML tabs, troubleshooting bullet, table row, Record
  verb card, and cXML in the description (page and llms.txt).
- Replace per-step approach tabs with one section per approach (SWML,
  WebSocket (Relay), Call Flow Builder), each with the same two tasks.
- Read the SWML status event's state with params.get so a calling.error
  event doesn't raise in the Python handlers.
- Link Resource and WebSocket (Relay) on first mention.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Voicemail guide

2 participants