Signals Docs
OneML reference

Record

The <Record> verb records the caller's voice and, once recording ends, sends the result to your action URL.

Attributes

NameTypeDefaultDescription
actionstring (uri)NoneURL to send the result to. When absent, the next verb in the document runs once recording ends.
methodstringPOSTHTTP method used to request action. GET or POST.
timeoutinteger5Seconds of silence that end the recording. Set to 0 to disable the silence timeout.
finishOnKeystring#Key that ends the recording. A single character: a digit, * or #. Set to an empty string to disable it.
maxLengthinteger3600Maximum recording length, in seconds.
playBeepbooleantrueWhether to play a beep before recording starts.
recordingStatusCallbackstring (uri)NoneURL to notify when the recording finishes. Signals requests it once, for the completed event only.
recordingStatusCallbackMethodstringPOSTHTTP method used to request recordingStatusCallback. GET or POST.

RecordingUrl points at the recording audio on the Calls API. Downloading it requires your AccountSid and auth token. See Download recording audio.

Nesting

<Record> is a self-closing element with no text content and no nested verbs.

Action parameters

NameTypeDescription
RecordingSidstringUnique identifier for the recording.
RecordingUrlstring (uri)URL of the recording audio, ending in .wav.
RecordingDurationintegerDuration of the recording, in seconds.

Recording status callback parameters

When recordingStatusCallback is set, Signals posts these parameters to it once the recording completes:

NameTypeDescription
AccountSidstringYour Voice Account SID.
CallSidstringUnique identifier for the call.
RecordingSidstringUnique identifier for the recording.
RecordingUrlstring (uri)URL of the recording audio, ending in .wav.
RecordingStatusstringAlways completed.
RecordingDurationintegerDuration of the recording, in seconds.
RecordingChannelsintegerNumber of audio channels in the recording.
RecordingSourcestringAlways RecordVerb for <Record>.

Examples

A voicemail prompt that records a message and requests action when done:

XMLCode
<?xml version="1.0" encoding="UTF-8"?> <Response> <Say>Leave a message after the beep. Press the pound key when you are finished.</Say> <Record action="/voicemail-complete" maxLength="120" finishOnKey="#"/> <Say>We did not receive a recording. Goodbye.</Say> <Hangup/> </Response>

The /voicemail-complete handler, complete and runnable:

const express = require("express"); const app = express(); app.use(express.urlencoded({ extended: false })); app.post("/voicemail-complete", (req, res) => { console.log("Voicemail received:", { recordingSid: req.body.RecordingSid, recordingUrl: req.body.RecordingUrl, durationSeconds: req.body.RecordingDuration, }); res.type("text/xml").send(`<?xml version="1.0" encoding="UTF-8"?> <Response> <Say>Thank you. Your message has been recorded. Goodbye.</Say> <Hangup/> </Response>`); }); app.listen(3000);

A silent recording of the rest of the call, reported through recordingStatusCallback instead of action:

XMLCode
<?xml version="1.0" encoding="UTF-8"?> <Response> <Say>This call may be recorded for quality purposes.</Say> <Record playBeep="false" timeout="0" maxLength="3600" recordingStatusCallback="/recording-status"/> <Hangup/> </Response>

See Recording calls for a complete /recording-status receiver and for downloading the audio.

See also

Last modified on