Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

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

how-it-works page anchor

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.

(warning)

Warning

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:

RecordingTrackRecordingChannelOutcome
--Records the inbound and the outbound audio of the call mixed in a single channel of the recording file.
-monoRecords the inbound and the outbound audio of the call mixed in a single channel of the recording file.
-dualRecords 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.
inboundmonoRecords 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.
inbounddual (→ 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.
outboundmonoRecords 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.
outbounddual (→ 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.
bothmonoRecords the inbound and the outbound audio of the call mixed in a single channel of the recording file.
bothdualRecords the inbound and the outbound audio of the call in two separate channels of the recording file

How to configure Single Party Call Recording

how-to-configure-single-party-call-recording page anchor

You can enable single party recording for any given call using the following Twilio's Programmable Voice APIs:

(information)

Info

This feature is not yet available in TwiML <Record> or <Conference>. SIP Trunking calls also do not currently support this functionality.

Set RecordingTrack on a new outbound Call

set-recordingtrack-on-a-new-outbound-call page anchor

Ensure to set both Record and RecordingTrack

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = require('twilio')(accountSid, authToken);
_16
_16
client.calls
_16
.create({
_16
record: true,
_16
recordingTrack: 'outbound',
_16
url: 'https://example.com',
_16
to: '+15558675310',
_16
from: '+15017122661'
_16
})
_16
.then(call => console.log(call.sid));

Output

_37
{
_37
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_37
"answered_by": null,
_37
"api_version": "2010-04-01",
_37
"caller_name": null,
_37
"date_created": "Tue, 31 Aug 2010 20:36:28 +0000",
_37
"date_updated": "Tue, 31 Aug 2010 20:36:44 +0000",
_37
"direction": "inbound",
_37
"duration": "15",
_37
"end_time": "Tue, 31 Aug 2010 20:36:44 +0000",
_37
"forwarded_from": "+141586753093",
_37
"from": "+14158675308",
_37
"from_formatted": "(415) 867-5308",
_37
"group_sid": null,
_37
"parent_call_sid": null,
_37
"phone_number_sid": "PNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_37
"price": "-0.03000",
_37
"price_unit": "USD",
_37
"sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_37
"start_time": "Tue, 31 Aug 2010 20:36:29 +0000",
_37
"status": "completed",
_37
"subresource_uris": {
_37
"notifications": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications.json",
_37
"recordings": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings.json",
_37
"payments": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Payments.json",
_37
"events": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Events.json",
_37
"siprec": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Siprec.json",
_37
"streams": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Streams.json",
_37
"user_defined_message_subscriptions": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/UserDefinedMessageSubscriptions.json",
_37
"user_defined_messages": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/UserDefinedMessages.json"
_37
},
_37
"to": "+14158675309",
_37
"to_formatted": "(415) 867-5309",
_37
"trunk_sid": null,
_37
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_37
"queue_time": "1000"
_37
}

(warning)

Warning

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.

Record a side of an ongoing call

record-a-side-of-an-ongoing-call page anchor

Use the Call Recording Controls to start and configure the recording

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_11
// Download the helper library from https://www.twilio.com/docs/node/install
_11
// Find your Account SID and Auth Token at twilio.com/console
_11
// and set the environment variables. See http://twil.io/secure
_11
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11
const authToken = process.env.TWILIO_AUTH_TOKEN;
_11
const client = require('twilio')(accountSid, authToken);
_11
_11
client.calls('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11
.recordings
_11
.create({recordingTrack: 'inbound'})
_11
.then(recording => console.log(recording.sid));

Output

_20
{
_20
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_20
"api_version": "2010-04-01",
_20
"call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_20
"conference_sid": null,
_20
"channels": 2,
_20
"date_created": "Fri, 14 Oct 2016 21:56:34 +0000",
_20
"date_updated": "Fri, 14 Oct 2016 21:56:34 +0000",
_20
"start_time": "Fri, 14 Oct 2016 21:56:34 +0000",
_20
"price": null,
_20
"price_unit": null,
_20
"duration": null,
_20
"sid": "REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_20
"source": "StartCallRecordingAPI",
_20
"status": "in-progress",
_20
"error_code": null,
_20
"encryption_details": null,
_20
"track": "both",
_20
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Recordings/REXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_20
}

Configure recording party when adding a new participant to a conference

configure-recording-party-when-adding-a-new-participant-to-a-conference page anchor

Ensure to set both Record and RecordingTrack

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = require('twilio')(accountSid, authToken);
_16
_16
client.conferences('CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_16
.participants
_16
.create({
_16
record: true,
_16
recordingTrack: 'inbound',
_16
from: '+15017122661',
_16
to: '+15558675310'
_16
})
_16
.then(participant => console.log(participant.callSid));

Output

_16
{
_16
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"call_sid": "CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"label": "customer",
_16
"conference_sid": "CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_16
"date_created": "Fri, 18 Feb 2011 21:07:19 +0000",
_16
"date_updated": "Fri, 18 Feb 2011 21:07:19 +0000",
_16
"end_conference_on_exit": false,
_16
"muted": false,
_16
"hold": false,
_16
"status": "queued",
_16
"start_conference_on_enter": true,
_16
"coaching": false,
_16
"call_sid_to_coach": null,
_16
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Conferences/CFXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Participants/CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_16
}

Configure recording party using <Dial>

configure-recording-party-using-dial page anchor

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:

(warning)

Warning

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.

Record only the inbound track of the call

record-only-the-inbound-track-of-the-call page anchor
Node.js
Python
C#
Java
PHP
Ruby

_11
const VoiceResponse = require('twilio').twiml.VoiceResponse;
_11
_11
const response = new VoiceResponse();
_11
const dial = response.dial({
_11
record: 'record-from-answer',
_11
recordingTrack: 'inbound',
_11
recordingStatusCallback: 'https://www.myexample.com/recording-handler'
_11
});
_11
dial.number('+15551239876');
_11
_11
console.log(response.toString());

Output

_10
<Response>
_10
<Dial record="record-from-answer"
_10
recordingTrack="inbound"
_10
recordingStatusCallback="https://www.myexample.com/recording-handler">
_10
<Number>+15551239876</Number>
_10
</Dial>
_10
</Response>


How to determine which track has been recorded

how-to-determine-which-track-has-been-recorded page anchor

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(link takes you to an external page) and Recording details page within the Programmable Voice area in the Twilio Console.


Rate this page: