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>
The <Recording> TwiML noun supports the following attributes:
| Attribute name | Allowed values | Default value |
|---|---|---|
| recordingStatusCallback | A relative or absolute URL | none |
| recordingStatusCallbackMethod | GET, POST | POST |
| recordingStatusCallbackEvent | in-progress, completed, absent | completed |
| trim | trim-silence, do-not-trim | trim-silence |
| track | inbound, outbound, both | both |
| channels | mono, dual | dual |
| trim | trim-silence, do-not-trim | trim-silence |
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:
| Parameter | Description |
|---|---|
AccountSid | The SID of the account responsible for this recording. |
CallSid | The SID of the call associated with the recording. This always refers to the parent leg of a two-leg call. |
RecordingSid | The SID of the recording. |
RecordingUrl | The URL of the recorded audio. |
RecordingStatus | The status of the recording. Possible values: in-progress, completed, absent. |
RecordingDuration | The length of the recording in seconds. Only provided when RecordingStatus is completed. |
RecordingChannels | The number of channels in the recording file. Possible values: 1, 2. |
RecordingStartTime | The timestamp when the recording started. |
RecordingSource | The method used to initiate this recording. Returns OutboundAPI for recordings initiated when Record=true is set on the REST API. |
RecordingTrack | The 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.
| Parameter | Description |
|---|---|
in-progress | The recording has started. |
completed | The recording is complete and available for access. |
absent | The 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. |
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`.
inboundrecords the audio that is received by Twilio.outboundrecords the audio that is generated from Twilio.bothrecords 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.
monorecords both legs of the call in a single channel of the recording file.dualrecords 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.