If a bridge fails, play a voicemail prompt, record the caller's message, and send its download URL to a status webhook.
Also called voicemail box, missed call handling
recording
The claim
connect dials the owner with a timeout. Per the connect reference, result runs “once the peer leg of the call has ended” against connect_result, which is connected or failed. You put the voicemail in the failed case: a prompt, then record. The record reference describes record as recording “in the foreground pausing further SWML execution until recording ends”. It stops on a terminator digit, on silence, or at max_length. The platform sets record_url and record_result on the call and POSTs recording events to status_url.
How it works
- connect:
to: "+15550100001"
timeout: 20
result:
case:
connected:
- hangup: {}
failed:
- play: { url: "say:Leave a message after the tone." }
- record:
beep: true
format: "mp3"
max_length: 120
end_silence_timeout: 5
terminators: "#"
status_url: "https://your-host.example.com/recording-status"
- play: { url: "say:Thanks. We will call you back." }
- hangup: {}
Per the reference, beep plays a tone before recording and terminators is the digit string that stops it. end_silence_timeout is the silence that ends it, and max_length is the ceiling in seconds. The status_url callback carries the recording state, the download URL, the duration and the recording id. You receive it at an endpoint you run; this recipe does not serve one.
The connected branch runs after the owner hangs up and only ends the call. The Python surface builds the same document with SWMLService, reading the owner’s number and your host from the environment.
Limitations
The verifier proves the document. The recording, its URL and the callback are what the platform does on a live call; record_result says success or failed there.
initial_timeout is the “time in seconds to wait for the start of speech”, default four, per the bundled schema. A caller who stays silent that long records nothing, and the thanks still plays.
What to change first
Change terminators to "*" and max_length to 30 in both surfaces and run the verifier. The record equality fails. The record object in each surface defines every setting of the message, and the verifier holds both to one value.
Swap the record in the failed branch for a send_sms verb carrying a link, and the same document is missed call text-back. The caller who reached no one gets a text instead of a tone. text-the-caller-during-the-call shows the verb.