How to record a single side of a call
By default Twilio's voice recordings capture all audio from a call in a single mono-channel file. To separate audio tracks in two channels, you can use recordingChannel=dual
Single Party Call Recordings is a feature that provides flexibility over which parties should be recorded during a call and it allows you to programmatically record only one side of the call.
How it works
RecordingTrack
is an optional parameter that can be used to select whether the inbound, outbound or both audio tracks of the call should be recorded. The inbound
track represents the audio received by Twilio, and the outbound
track represents the audio that Twilio generates on the call.
For example, if the caller is interacting with an IVR, the inbound track contains the caller's voice and the outbound track contains the audio generated via either <Say>
or <Play>
. Alternatively, if the caller is connected to agent via <Dial>
, then the outbound track will contain the audio spoken by agent.
When inbound or outbound audio track is recorded, the resulting recording file will always be mono-channel. When audio is recorded using both, you can choose either separate channel (dual) or mixed (mono).
This table illustrates the expected outcome when using recordingTrack
and attributes together to request a recording:
RecordingTrack |
RecordingChannel |
Outcome |
- |
- |
Records the inbound and the outbound audio of the call mixed in a single channel of the recording file. |
- |
mono |
Records the inbound and the outbound audio of the call mixed in a single channel of the recording file. |
- |
dual |
Records the inbound and the outbound audio of the call in two separate channels of the recording file. |
inbound |
- |
Records the inbound audio of the call in a single channel of the recording file. The inbound track is the audio that is received by Twilio from the call. |
outbound |
- |
Records the outbound audio of the call in a single channel of the recording file. The outbound track is the audio that is generated by Twilio. |
both |
- |
Records the inbound and the outbound audio of the call mixed in a single channel of the recording file. |
inbound |
mono |
Records the inbound audio of the call in a single channel of the recording file. The inbound track is the audio that is received by Twilio from the call. |
inbound |
dual (→ mono) |
Records the inbound audio of the call in a single channel of the recording file. The inbound track is the audio that is received by Twilio from the call. Note: if you set “RecordingChannel=dual”, this will be ignored and automatically set to mono. |
outbound |
mono |
Records the outbound audio of the call in a single channel of the recording file. The outbound track is the audio that is generated by Twilio. |
outbound |
dual (→ mono) |
Records the outbound audio of the call in a single channel of the recording file. The outbound track is the audio that is generated by Twilio. Note: if you set “RecordingChannel=dual”, this will be ignored and automatically set to mono. |
both |
mono |
Records the inbound and the outbound audio of the call mixed in a single channel of the recording file. |
both |
dual |
Records the inbound and the outbound audio of the call in two separate channels of the recording file |
How to configure Single Party Call Recording
You can enable single party recording for any given call using the following Twilio’s Programmable Voice APIs:
This feature is not yet available in TwiML <Record> or <Conference>. SIP Trunking calls also do not currently support this functionality.
The default value of the record
attribute is do-not-record
. Make sure you set this to true
as it will not be automatically enabled regardless of RecordingTrack
property.
Configure recording party using <Dial>
Use <Dial>
verb to dial a new participant from an active ongoing call and record the call specifying what audio should be recorded using recordingTrack parameter. The following example illustrates how to record the inbound audio:
The default value of the record
attribute is do-not-record
. Make sure you set this to true
as it will not be automatically enabled regardless of RecordingTrack
property.
How to determine which track has been recorded
The request made to recordingStatusCallback contains the track
attribute to indicate which audio track was recorded. It is recommended to subscribe to the recordings callback in order to know which audio track has been chosen.
You can also check this information from the Recordings Logs section and Recording details page within the Programmable Voice area in the Twilio Console.
Need some help?
We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.