SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Route a Flex Voice Call to a Studio Flow After Task Completion

Objective

This article explains how to route a Flex voice call to a Twilio Studio Flow after a Flex task is completed. Many users want to trigger post-call automation, surveys, or other workflows in Studio after an agent finishes a Flex voice task. This guide covers the recommended approaches, limitations, and workarounds for achieving this with Flex, Studio, and Programmable Voice.

 

Product

Flex, Studio

 

Environment

Twilio Console

 

User Account Permission/Role(s) Required 

  • Access to Flex and Studio configuration in the Twilio Console
  • Ability to create and manage TwiML Bins, Functions, or Studio Flows
  • API credentials for programmatic call handling (if needed)

 

Procedure 

  1. End the Original Flex Conference
    • After the Flex task is completed, ensure the original conference is ended and the customer’s call leg is disconnected. Studio Flows cannot accept a live call leg from an in-progress conference.
  2. Initiate a New Call to Trigger Studio
    • Programmatically place a new outbound call to the customer’s number from a Twilio number configured to trigger your Studio Flow for inbound calls.
    • Set the call’s URL to your Studio Flow’s webhook, or to a TwiML Bin/Function that redirects to the Studio Flow.
  3. Passing Context Between Calls
    • Any context from the original call (such as Task attributes or Flex context) does not automatically transfer to the new call leg. You’ll need to handle context passing explicitly.
    • If you need to pass context (such as task attributes) from the original call to the new Studio Flow, consider:
      • Using Twilio Sync to store context keyed by the call SID.
      • Passing query parameters in the new call’s URL.
    • For anonymized callers, context passing may require creative solutions, such as using the call SID as a key.
  4. Advanced Option: In-Progress Call Trigger
    • You may attempt to trigger a Studio Flow for an in-progress call by adding the query parameter Trigger=inProgressCall to your Studio webhook URL.
    • Example TwiML:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Redirect>https://webhooks.twilio.com/v1/Accounts/ACxxxxxxxxxx/Flows/FWxxxxxxxxxxx?Trigger=inProgressCall</Redirect>
</Response>
  • Important Limitation: Voice Status Callback events (including Hangup) are not sent to the Studio execution in this scenario. This may result in stuck executions, so you must implement and run a timely process to regularly stop or clean up old ongoing executions.

 

Additional Information 

For more information, please refer:

Need help with custom implementation?

If you require hands-on assistance with designing or building a custom solution for your workflow, consider engaging Twilio Professional Services. Our experts can help you architect, implement, and optimize advanced integrations tailored to your needs.

Have more questions? Submit a request
Powered by Zendesk