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.

Access and Manage Call and Voicemail Recordings

You can view all of your call and voicemail recordings together in one place - the Console Recordings Log. You can also fetch these recordings from your project programmatically via a GET request to the “Recordings” resource.

Recording files are kept in Twilio’s cloud storage until you delete them. For help deleting recordings, please see our article Deleting Twilio Call Recordings.

Related Topics

Have more questions? Submit a request
Powered by Zendesk