How to Build a Protected Conference Line in a Few Minutes using Studio

March 27, 2020
Written by

Conference Line Protected Header

With many people shifting to working remotely, the need for collaboration tools is increasing. Twilio offers many options that allow developers to build collaboration solutions like video chat or voice conferencing solutions.

This blog post walks you through how to create a protected voice conferencing line using Twilio Studio in a couple of minutes - to help your remote workforce continue to communicate.  

In Studio, a Flow is executed from an incoming call or SMS to your Twilio number, or you could trigger an outbound flow via a REST API request. Once in a Flow, Studio offers various ways to control calls and message flows, including but not limited to:

  • Saying or playing messages to a callee
  • Gathering input from the callee such as digits or voice messages
  • Making an HTTP request to a third-party system

It is simple to build a protected conference line using Twilio Studio and studio widgets. Let us see how it is done.

Prerequisites

Twilio Studio Flow

We will walk through setting up the Studio Flow for a conference line, and configure our Twilio number. Twilio Studio is managed from a UI. You use widgets to describe how you want to control your communication flows, and little to no code is required.  

Set up a protected Conference line

Now that you have seen how to build a simple conference line, we can build a protected line as demonstrated in this post. A customer can call our Twilio number, hear a greeting and enter a PIN, and join the conference bridge. If they enter the wrong PIN they can re-enter.

The Flow looks like this:

Studio flow for a protected conference line

In this Flow, when a customer calls our number, they hear a welcome message that asks the user to enter a conference pin. The callee can enter the pin using their keypad. The flow diverts the call to check if they have entered the correct pin for the conference line. If they entered the wrong pin or did not enter anything, they will be prompted to re-enter the pin again. Once the right pin is entered, the call is diverted to the Twilio conference.

In my example, the pin is 1368. You can edit it by clicking the 'checkPin' widget and switching to the 'Transitions' tab.

Import the Studio Flow

To quickly get you going, we're going to import my Studio flow. I'll walk you through step-by-step, but for a longer description of importing and and exporting, see the Studio documentation.

Import JSON flow for Studio
  1. First, visit the Studio console. Click the red plus ('+') button to 'Create new Flow'.
  2. Name it something like "Protected Conference Line" and hit the red 'Next' button.
  3. In the next screen, scroll down to 'Import from JSON' and hit the red 'Next' button.
  4. Now, paste in the JSON for the protected conference flow and continue:
{
  "description": "A New Flow",
  "states": [
    {
      "name": "Trigger",
      "type": "InitialState",
      "properties": {
        "offset": {
          "x": -20,
          "y": -40
        },
        "flow_url": "https://webhooks.twilio.com/v1/Accounts/ACb1b83e02c641c08353bb7fd2e3b9d08c/Flows/FW5a2c650fd4fa3a927275c2dc4ee1e783"
      },
      "transitions": [
        {
          "event": "incomingMessage",
          "conditions": [],
          "next": null,
          "uuid": "d2e21841-6486-4aa2-a74c-d55df8a65761"
        },
        {
          "event": "incomingCall",
          "conditions": [],
          "next": "FF8d19e9022e2eb81dc2ea32903ae2dc1c",
          "uuid": "b319a806-b738-4678-8116-31d51dd6fa5b"
        },
        {
          "event": "incomingRequest",
          "conditions": [],
          "next": null,
          "uuid": "697b5eb8-1e4f-4802-952a-b79006efcd55"
        }
      ],
      "sid": "FF5e88a8bb7e8399ff3668a0c126058556"
    },
    {
      "name": "Welcome",
      "type": "SayPlay",
      "properties": {
        "offset": {
          "x": 120,
          "y": 210
        },
        "say": "Thank you for joining our conference line",
        "play": null,
        "voice": "alice",
        "language": "en-US",
        "loop": 1,
        "digits": null
      },
      "transitions": [
        {
          "event": "audioComplete",
          "conditions": [],
          "next": "FF67839e3f047c488578e043f0c91f0901",
          "uuid": "ff321021-bcec-4bfc-a279-5a6738a09e05"
        }
      ],
      "sid": "FF8d19e9022e2eb81dc2ea32903ae2dc1c"
    },
    {
      "name": "AskForPin",
      "type": "Gather",
      "properties": {
        "offset": {
          "x": 110,
          "y": 440
        },
        "timeout": 5,
        "finish_on_key": "#",
        "stop_gather": true,
        "number_of_digits": null,
        "save_response_as": null,
        "say": "Please enter the conference pin",
        "play": null,
        "voice": null,
        "language": null,
        "loop": 1,
        "hints": null,
        "gather_language": "en",
        "speech_timeout": "auto",
        "speech_model": null,
        "profanity_filter": "true"
      },
      "transitions": [
        {
          "event": "keypress",
          "conditions": [],
          "next": "FFbcf32509e55a255111457f2b0391396c",
          "uuid": "e8735068-a575-4130-87da-f96119a3b02a"
        },
        {
          "event": "speech",
          "conditions": [],
          "next": "FFbcf32509e55a255111457f2b0391396c",
          "uuid": "3325e7ae-179c-499d-b14d-c9f53419b7ad"
        },
        {
          "event": "timeout",
          "conditions": [],
          "next": "FF194266b626a439335c733ac68ca5ff44",
          "uuid": "3531a996-c039-47db-9889-c4cc4110a623"
        }
      ],
      "sid": "FF67839e3f047c488578e043f0c91f0901"
    },
    {
      "name": "NoInput",
      "type": "SayPlay",
      "properties": {
        "offset": {
          "x": 710,
          "y": 440
        },
        "say": "Please enter the conference pin",
        "play": null,
        "voice": null,
        "language": null,
        "loop": 1,
        "digits": null
      },
      "transitions": [
        {
          "event": "audioComplete",
          "conditions": [],
          "next": "FF67839e3f047c488578e043f0c91f0901",
          "uuid": "c39b550d-256f-493f-a0e7-110d973520c8"
        }
      ],
      "sid": "FF194266b626a439335c733ac68ca5ff44"
    },
    {
      "name": "CheckPin",
      "type": "Branch",
      "properties": {
        "offset": {
          "x": 167,
          "y": 688
        },
        "input": "{{widgets.AskForPin.Digits}}"
      },
      "transitions": [
        {
          "event": "noMatch",
          "conditions": [],
          "next": "FF1ae4abf50b1678dd0cdf7d83f21c8d36",
          "uuid": "9724ef1e-c3f9-442f-8711-d23cef7d1967"
        },
        {
          "event": "match",
          "conditions": [
            {
              "friendly_name": "If value equal_to 1368",
              "type": "equal_to",
              "arguments": [
                "{{widgets.AskForPin.Digits}}"
              ],
              "value": "1368"
            }
          ],
          "next": "FF3ce7e85ad40c004332538618e4c5b209",
          "uuid": "d6e8bac0-d8ef-402c-96a7-06187ec42964"
        }
      ],
      "sid": "FFbcf32509e55a255111457f2b0391396c"
    },
    {
      "name": "WrongPin",
      "type": "SayPlay",
      "properties": {
        "offset": {
          "x": -170,
          "y": 710
        },
        "say": "That is an invalid pin",
        "play": null,
        "voice": null,
        "language": null,
        "loop": 1,
        "digits": null
      },
      "transitions": [
        {
          "event": "audioComplete",
          "conditions": [],
          "next": "FF67839e3f047c488578e043f0c91f0901",
          "uuid": "6850a058-3a13-4c69-b084-07ac78e60646"
        }
      ],
      "sid": "FF1ae4abf50b1678dd0cdf7d83f21c8d36"
    },
    {
      "name": "Conference",
      "type": "ConnectCaller",
      "properties": {
        "offset": {
          "x": 720,
          "y": 700
        },
        "to": "Covid-19 Response Center",
        "caller_id": "{{contact.channel.address}}",
        "record": null,
        "noun": "conference",
        "sip_endpoint": null,
        "sip_username": null,
        "sip_password": null,
        "timeout": 30
      },
      "transitions": [
        {
          "event": "callCompleted",
          "conditions": [],
          "next": null,
          "uuid": "4df37671-34d6-4139-b7fc-9ad1c361d127"
        },
        {
          "event": "hangup",
          "conditions": [],
          "next": null,
          "uuid": "8a335b0f-d62a-4b24-a84f-9edc1d5a1ad7"
        }
      ],
      "sid": "FF3ce7e85ad40c004332538618e4c5b209"
    }
  ]
}

Looking good! Next, let's try it out.

Run the Studio call for a Conference Line

Now you're ready to try this for real.

  1. Go to your incoming numbers configuration and select a Twilio number that will receive the calls from your customers (or, select more than one number!)
  2. Navigate to the phone number you like and configure it so that when a call comes in, it directs the call to your new Studio Flow.
  3. Now, once a call comes into your Twilio number, it will ask the caller to enter a pin after the welcome message

That’s all for now, but please get in touch with any questions or comments.

We can’t wait to see what you build!

Arvind Rangarajan is a senior member of the Product Marketing team at Twilio. He has many years of experience in developing technology and commercial solutions. He is a hands-on marketer, and to write this blog post, he built the Studio flow himself. He can be reached at arangarajan [at] twilio.com