Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

TwiML™ Voice: <Recording>


The <Recording> TwiML noun is used with the <Start> verb to begin recording an inbound or outbound call. When Twilio executes <Start><Recording>, it immediately starts recording the call's audio before processing any other TwiML instructions.

After Twilio starts recording the call, it continues executing the next TwiML instruction. If there are no instructions, the call will end.

You can stop, pause, or resume the recording at any time by making requests to the Recordings resource.

<Recording> is part of Twilio's Voice Recording product. Learn more about how to programmatically start and manage a recording using the Recordings resource.

The following is an example of <Start><Recording>:

1
<?xml version="1.0" encoding="UTF-8"?>
2
<Response>
3
<Start>
4
<Recording channels="dual" recordingStatusCallback =
5
"https://example.com/your-callback-url" />
6
</Start>
7
<Say>The recording has started.</Say>
8
</Response>

Noun attributes

attributes page anchor

The <Recording> TwiML noun supports the following attributes:

Attribute nameAllowed valuesDefault value
recordingStatusCallbackA relative or absolute URLnone
recordingStatusCallbackMethodGET, POSTPOST
recordingStatusCallbackEventin-progress, completed, absentcompleted
trimtrim-silence, do-not-trimtrim-silence
trackinbound, outbound, bothboth
channelsmono, dualdual
trimtrim-silence, do-not-trimtrim-silence

recordingStatusCallback

attributes-recording-status-callback page anchor

The recordingStatusCallback attribute specifies a URL for Twilio to send webhook requests to for each event specified in the recordingStatusCallbackEvent attribute.

The recordingStatusCallback request includes the following parameters:

ParameterDescription
AccountSidThe SID of the account responsible for this recording.
CallSidThe SID of the call associated with the recording. This always refers to the parent leg of a two-leg call.
RecordingSidThe SID of the recording.
RecordingUrlThe URL of the recorded audio.
RecordingStatusThe status of the recording. Possible values: in-progress, completed, absent.
RecordingDurationThe length of the recording in seconds. Only provided when RecordingStatus is completed.
RecordingChannelsThe number of channels in the recording file. Possible values: 1, 2.
RecordingStartTimeThe timestamp when the recording started.
RecordingSourceThe method used to initiate this recording. Returns OutboundAPI for recordings initiated when Record=true is set on the REST API.
RecordingTrackThe audio track recorded. Possible values: inbound, outbound, both.

The HTTP method to use when requesting the recordingStatusCallback URL. Possible values: GET, POST. The default is POST.

The recordingStatusCallbackEvent specifies which recording status changes should trigger a callback to your application. To specify multiple events, separate them with a space (in-progress completed absent). If recordingStatusCallback is provided without recordingStatusCallbackEvent, completed is sent by default.

ParameterDescription
in-progressThe recording has started.
completedThe recording is complete and available for access.
absentThe recording is absent and inaccessible. This can occur due to a system error, when a recording is less than one minute after trimming silence, or when the recording was silent and your account is set to automatically delete silent recordings. To change this option, contact Twilio Support(link takes you to an external page).

Whether to trim any leading and trailing silence from the recording. Possible values: trim-silence, do-not-trim. The default is trim-silence.

The audio track to record for the call. Possible values: inbound, outbound, both. The default is both`.

  • inbound records the audio that is received by Twilio.
  • outbound records the audio that is generated from Twilio.
  • both records the audio that is received and generated by Twilio.

The number of channels in the final recording. Possible values: mono, dual. The default is dual.

  • mono records both legs of the call in a single channel of the recording file.
  • dual records each leg to a separate channel of the recording file.

In a dual-channel recording, the first channel contains the parent call and the second channel contains the child call.