Call Recording and Voicemail with Twilio Flex

While call recording is not built-in to Twilio Flex, it's customizable nature offers users a number of options for call recording and setting up a voicemail box. Read on for more information.

Record Calls

You can record incoming calls with Flex using the Actions Framework. In only a few lines of code, you can add commands to record the agent-leg of any conference call. Here’s an example of what this code might look like in your plugin:

flex.Actions.addListener("beforeAcceptTask", (payload) => {
payload.conferenceOptions.record = 'true';
payload.conferenceOptions.recordingStatusCallback = '';

This example tells Flex to modify the conferenceOptions before a task is accepted.

  • ...conferenceOptions.record = 'true' tells us to record the agent-leg of the conference call.
  • ...conferenceOptions.recordingStatusCallback = '...' tells us to reach out or call back to the url given when the call recording file has been processed, and is available for you.

For help adding this code to your hosted Flex instance, please see Creating Plugins for Twilio Flex.

Start and Stop Recording

Using the Recording Controls API, you can begin, pause, and stop recording a call at any time with a simple API request. For full details, please see our article Getting Started with Call Recording Controls.

Record Voicemail

We also support sending queued calls to voicemail. When assigning a new task in TaskRouter, use the redirect instruction in your Assignment Callback JSON response to connect the call to a new TwiML URL with the <Record> verb. Here’s an example of what this might look like:

“instruction”: “redirect”,
“url”: “”

This example will remove the incoming call from the queue, and then redirect it to the new TwiML script at

If not using a queue or TaskRouter, calls can be sent directly to a voicemail script. For more information on building your voicemail box, please see Recording a Phone Call with Twilio: Record using the <Record> TwiML Verb.

View, Download, and Delete Call Recordings

Call recordings are accessible via the Recordings Log section of the Console, and the REST API. You can see a list of your recordings, download them, and delete them from either of these resources. Recording files are kept in Twilio’s cloud storage until you delete them.

For more information, please see our article Downloading and Deleting Twilio Call Recordings.

Legal Implications of Call Recording

If you choose to record calls, you need to comply with certain laws and regulations, including those 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.

Notice: Twilio recommends that you consult with your legal counsel to make sure that you are complying with all applicable laws in connection with communications you record or store using Twilio.

Related Topics

Have more questions? Submit a request
Powered by Zendesk