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 inject commands to record the conference, and then return to the original payload. Here’s an example of what this might look like:

Flex.Actions.replaceAction("AcceptTask", (payload, original)=>{
payload.conferenceOptions.record='true';
return original(payload);
});

This example tells Flex to replace the default AcceptTask behavior, record the worker leg of the conference, and then proceed as normal. Please note that conferenceOptions only applies to voice tasks; non-voice tasks will fail. We recommend performing a voice task check first.

For more details on Actions, please see Twilio Flex: Actions Framework (Twilio Docs).

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”,
“call_sid”: “CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX”
“url”: “https://myapp.com/voicemail.xml”
}

This example will remove the incoming call from the queue, and then redirect it to the new TwiML script at https://myapp.com/voicemail.xml.

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