Creating A Twilio Hosted Conference Service
Aug 26, 2022

In this article, we're going to cover how to create a Conference or Call Masking Service within Twilio Studio. For a tldr version, I've linked to the final json below for import.


Things you'll need for this:


Go ahead and long into your Twilio Account and in the console, search for Studio and then navigate to Flows.

Once there, click the plus sign to create a new Flow. Feel free to name it however you'd like.

Twilio's visual Studio editor should now launch and there should be a blank box at the top labeled Trigger and another to the right of the screen labeled Widget Library

Our basic call flow that we want is the following:

  • Greet the caller and ask for a PIN (this is so only authorized users can utilize the service and intercepts people calling the number back)
    • If the PIN is invalid, prompt the caller that the PIN was invalid and end the call.
  • Next gather the number the caller wants to dial out to. The number needs to include the country code so we can dial this number without any additional formatting.
  • We take the caller inputs and make an Outbound Call to the number input in the step above.
  • Once the call ends or the party hangs up, play a message and then end the call for all parties.

First, lets create our Greeting Prompt. In the widget library, select Gather Input on Call and drag it onto the canvas. Update the widget name to whatever you'd like. In my example I've named it greeting_split. Select Say a Message and enter in your welcome prompt stating that you're gathering a PIN. Chose your language settings and set the STOP GATHERING AFTER to 20 seconds along with the keypress option of #. Set your PIN length here as well. I've set it to 8 digits for this example, but you can choose your own PIN length. Make sure to Save your Widgets after you edit them. On the widget named Trigger, click and drag the dot under Incoming Call to the black dot on this widget.

Now we'll need a new widget to verify the entered PIN against a list of allowed PINs. Select the widget Split Based On... widget, and as before, drag it onto the canvas. Name the widget and under variable to test, select the inputs from the previous widget. In my example Flow, it would be widgets.greeting_split.Digits. Select the Transitions tab in the Widget Editor and add a New Condition. The new condition should be IF VALUE MATCHES, Matches Any Of and then in the input below, add your desired PINs, seperated by commas. As before, make sure to press save after editing this widget. As before, connect the previous widget to this one by clicking from User Pressed Keys to this widget's entry point.

Next up, lets go ahead and create the message that plays on an invalid PIN. Select the widget Say/Play and drag it onto the canvas along with giving it a name and, similar to the input widget, a prompt to play. Press Save and connect the No Condition Matches from the previous widget to this widget's entry point.

With that one out of the way, let's continue the successful call flow. We need another Gather Input On Call widget to gather the number we'd like to dial out to. Follow the same steps as the first widget we created but this time, don't enter anything into the STOP GATHER AFTER X DIGITS section and make sure that STOP GATHERING ON KEYPRESS is enabled and set to # or *. Make sure to press Save and connect the entry point for this widget to the if value matches_any_of to the previous widget.

Now that we know the caller is authorized and has entered a number, we can make an outbound call to the dialed number and connect them. This Outbound Call will be from the number this is connected to in Twilio and not the originating caller's number. Select the widget Connect Call To and drag it onto the canvas. As with the others, give it a name. Under this widget's options, select Single Number and the digits from the previous widget's input. In this example it would be widgets.gather_number.Digits. For the Caller ID, you need to use a number that is owned by your Twilio account so it is easier just to use the default or contact.channel.address. Enable any other settings you want and press Save. Connect this widget's entry point to the User Pressed Keys node of the previous widget.

Optional: You can add a message to be played after the call ends by utilizing a Say/Play widget similar to how the Invalid Pin message was created. Just link the entry point to this widget to both the Connected Call Ended and the Caller Hung Up nodes of the previous widget.

Click the Publish button at the top of the window and it should give a green pill with the text that the flow is up to date.

Now for testing. Go back to the main console and search for Phone Numbers and navigate to your active phone numbers. If you don't have any active numbers, purchase one that you'd like to use for this. Navigate into the configuration of this number and scroll down to where the option for A CALL COMES IN is available. Change this to Studio Flow and the name of your Flow. Also the Messaging configuration for A MESSAGE COMES IN can be removed if it is not being used.

Dial the number and test your flow.

Final Studio Flow: