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

Enabling Dual-Channel Recordings


Dual-Channel recording allows you to obtain a recording of your call with two distinct channels: a customer (caller) channel and an agent channel.

Dual-Channel recording offers many advantages over single-channel (mono) recordings. With each party's audio separated into its own track, it's easier to analyze the content of a recording using transcription and keyword analysis. Also, there's an advantage in the quality of the voice recording upon playback. Dual-Channel recordings allow your call center managers and quality supervisors to focus on a single channel (just the customer or just the agent) when analyzing calls.

With Dual-Channel recordings, it's also easier to understand the call recording during playback - customer and agent talks are represented by different colors in the Flex Insights Player.

In this guide, we'll set up dual-channel recordings that begin on the customer's audio when they call in. This will produce a recording with two distinct channels:

  1. The Customer channel (the left speaker when played with stereo speakers).
  2. The Agent channel (the right speaker when played with stereo speakers) for the rest of the conversation participants.

In most cases, the Agent channel will only include a single contact center agent.

(warning)

Warning

If you choose to record calls, you need to comply with certain laws and regulations regarding obtaining consent to record (such as California's Invasion of Privacy Act and similar laws in other jurisdictions). Additional information on the legal implications of call recording can be found here(link takes you to an external page).

With this approach of recording the customer-leg, we're recording the customer even before reaching an agent. The file could contain the recording of the customer waiting in the queue. Abandoned conversations are also recorded.

Please consider the legal implications of recording the customer before reaching an agent.


Using Studio to Enable Recordings

using-studio-to-enable-recordings page anchor

By default, every incoming Flex call will trigger the execution of the Studio flow. You can identify the exact Studio flow by inspecting your Active Phone Numbers(link takes you to an external page) in the Twilio Console. By default, this would be the Voice IVR(link takes you to an external page) flow. We need to modify this flow to trigger the recording and provide additional information to Flex Insights to correctly process the recording and the metadata.

This is what the final Studio flow will look like:

Flex-Dual_channel_recordings-final_flow.

The Building Blocks

the-building-blocks page anchor

The standard voice flow contains only the SendCallToAgent widget. To record a call, we need to add the Call Recording widget to the flow.

Call Recording:

Call Recording in Widget Library.

Required Configuration:

You must toggle the RECORD CALL button to "Start Recording". This widget will tell the Studio flow to create a new recording for every call that comes in. You can get more info about the widget in the Call Recording widget documentation.

For the purposes of this guide, connect both the Success and Failed transitions to the Send To Flex widget. In your production environment, it may make sense to add some additional logic to handle these cases appropriately.

Say/Play:

The Call recording widget cannot be placed as the first widget after the trigger - it must come after another widget like an initial Say/Play or Gather. Say/Play allows you to play a recorded message or dictate text to a user on call. Consider whether your use case requires that your customers be warned before a call is recorded - this could be the perfect opportunity to get their consent!

Say/Play widget in Widget Library.

Required configuration:

You need to decide what you want to say/play! For simplicity's sake, this Studio flow reads a simple welcome message.

The Studio say/play widget configuration with the widget name and text to say fields filled out.

Please refer to the Say/Play widget documentation for details on other customization options.

Modifying Task Attributes

modifying-task-attributes page anchor

In order for Flex Insights to correctly process the dual-channel recording, you'll need to modify the Send To Flex widget and add some more info to its Attributes. The content of Attributes will be added to the Task attributes when the Task is created.

You can find more details in the Send to Flex widget documentation.

Configuration

The default content of the Attributes field is:


_10
{
_10
"type": "inbound",
_10
"name": "{{trigger.call.From}}"
_10
}

You'll need to modify the object to look like this:


_14
{
_14
"type": "inbound",
_14
"name": "{{trigger.call.From}}",
_14
"conversations": {
_14
"media": [
_14
{
_14
"url": "https://api.twilio.com/2010-04-01/Accounts/{{widgets.CallRecording.AccountSid}}/Recordings/{{widgets.CallRecording.Sid}}",
_14
"type": "VoiceRecording",
_14
"start_time": "{{widgets.CallRecording.StartTime}}",
_14
"channels": [ "customer", "others" ]
_14
}
_14
]
_14
}
_14
}

This adds the conversations JSON object that contains the recorded media metadata.

Required values

KeyValue
urlThe URL of the recording. You don't need to append the ".wav" suffix.

Please make sure you enter the correct widget name (CallRecording in our case).



Note: Variable names are case-sensitive. Foo is a different variable to foo.
typeStatic value: "VoiceRecording".
start_timeWe need to know the start time of the recording to correctly calculate segment offsets in the conversation. The start time of the recording is accessible in liquid via the {{widgets.CallRecording.StartTime}} key. The start time should be defined in ISO 8601 format.
channelsThe order of channels in the recording.



Static value: ["customer", "others"].



For inbound calls, the first one is the caller (customer) and the second one is the rest of the Flex conference, e.g. agent.

Note: Providing incorrect values in the media object could introduce inconsistencies to metrics like conversation talk times in Flex Insights.


If you previously enabled single-channel (mono) call recordings in the Flex Settings(link takes you to an external page), go ahead and disable it - your new dual-channel recordings can take its place!

Additionally, for higher security of your recordings, please consider enabling HTTP authentication on the Recording API endpoint. Go to Twilio Console(link takes you to an external page) and enable "Enforce HTTP Auth on Media URLs". Your recording URLs are visible to any service that consume TaskRouter events (e.g., third party applications via add-ons), and securing the endpoint is a good practice. Make sure that your infrastructure does not require this endpoint to be unsecured.


Enabling Recordings Outside Studio

enabling-recordings-outside-studio page anchor

If you are not using the default Studio flow to send calls to Flex, you can still use dual-channel recordings by adding the conversations/media object to your Task, as defined above. This may involve you starting/retrieving the recording URL using the Programmable Voice API.

Start a dual-channel call recording

To start a dual-channel recording on a live call, make an HTTP Post request to the Recordings list resource of an in-progress Call:


_10
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Calls/{CallsSid}/Recordings.json

You need to specify the RecordingsChannel parameter to record into separate channels. Using cURL, the request will look like:


_10
curl -X POST https://api.twilio.com/2010-04-01/Accounts/ACXXXX..X/Calls/CAXXXX..X/Recordings.json \
_10
--data-urlencode "RecordingChannels=dual" \
_10
-u ACXXXX..X:your_auth_token

Get the recording URL

In the conversations/media object, you need to specify the URL of the recording file. API response to your recording request, you will find the required attributes: account_sid, sid (recording SID) and start_time. The start_time value should be in ISO 8601 format.

The recording URL looks like this:


_10
https://api.twilio.com/2010-04-01/Accounts/ACXXXX..X/Recordings/REXXXX..X

For more details about recordings, visit the Programmable Voice documentation.


Rate this page: