Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Create conference calls


Learn to create and manage multi-party conference calls with Twilio Programmable Voice by using the <Conference> TwiML noun within a <Dial> verb response. You can use this guide to create inbound contact centers, create outbound contact centers, implement call tracking, and perform AI or ML transcription.

To learn more about the conference and participant resources used in this guide, see Related reference documentation.


Complete the prerequisites

complete-the-prerequisites page anchor

Complete the Twilio prerequisites

complete-the-twilio-prerequisites page anchor

Complete the language prerequisites

complete-the-language-prerequisites page anchor

Select your programming language and complete the prerequisites:

PythonNode.jsPHPC# or .NETJavaRuby
  • Install Python 3.3 or later(link takes you to an external page).
  • Install Flask(link takes you to an external page) and the Twilio Python Helper Library(link takes you to an external page). Using pip(link takes you to an external page), run the following command:
    pip install flask twilio
  • Install and set up ngrok(link takes you to an external page).

Get credentials and set as environment variables

get-credentials-and-set-as-environment-variables page anchor

Extract your credentials from your Twilio account then save these credentials as environment variables.

Twilio ConsoleLegacy Console
  1. Go to the Twilio Console(link takes you to an external page). The Let's get building page appears.

  2. Click API keys and Auth tokens. The API keys & auth tokens page appears with the Auth Tokens tab selected.

  3. Scroll to your Account SID.

  4. Click the copy button next to your Account SID.

  5. Run the following command, replacing YOUR_ACCOUNT_SID with your Account SID.

    macOS TerminalWindows command linePowerShell
    export TWILIO_ACCOUNT_SID=YOUR_ACCOUNT_SID

    This command creates an environment variable on your development system for your account SID.

  6. To display the Auth Token, click the eye button in the Primary auth token box.

  7. Highlight and copy the Auth Token.

  8. Run the following command, replacing YOUR_AUTH_TOKEN with your Authentication Token.

    macOS TerminalWindows command linePowerShell
    export TWILIO_AUTH_TOKEN=YOUR_AUTH_TOKEN

    This command creates an environment variable on your development system for your auth token.


Create dynamic conference calls with moderators

create-dynamic-conference-calls-with-moderators page anchor

To allow the moderator to control the call, this example uses two advanced <Conference> features:

  • startConferenceOnEnter puts all other participants on hold until the moderator joins
  • endConferenceOnExit ends the call for everyone as soon as the moderator leaves

To identify the moderator, use the From parameter on Twilio's webhook request.

PythonNode.jsPHPC# or .NETJavaRuby

Python only requires the Twilio Python helper library as noted in the prerequisites.

Create a moderated conference callLink to code sample: Create a moderated conference call
1
"""Demonstration of setting up a conference call in Flask with Twilio."""
2
from flask import Flask, request
3
from twilio.twiml.voice_response import VoiceResponse, Dial
4
5
app = Flask(__name__)
6
7
# Update with your own phone number in E.164 format
8
MODERATOR = '+18005551212'
9
10
11
@app.route("/voice", methods=['GET', 'POST'])
12
def call():
13
"""Return TwiML for a moderated conference call."""
14
# Start our TwiML response
15
response = VoiceResponse()
16
17
# Start with a <Dial> verb
18
with Dial() as dial:
19
# If the caller is our MODERATOR, then start the conference when they
20
# join and end the conference when they leave
21
if request.values.get('From') == MODERATOR:
22
dial.conference(
23
'My conference',
24
start_conference_on_enter=True,
25
end_conference_on_exit=True)
26
else:
27
# Otherwise have the caller join as a regular participant
28
dial.conference('My conference', start_conference_on_enter=False)
29
30
response.append(dial)
31
return str(response)
32
33
if __name__ == "__main__":
34
app.run(debug=True)

Expose your local dev environment to Twilio with ngrok

expose-your-local-dev-environment-to-twilio-with-ngrok page anchor

To use the webhooks in this code sample, Twilio must communicate with your web app. These communications consist of HTTP requests sent between URLs accessible over the internet. Twilio requires access to Internet-addressable, or public, URLs.

(warning)

Protect your webhooks

Twilio supports HTTP Basic and Digest Authentication. This type of authentication protects your TwiML URLs on your web server with an Auth Token. This limits access to the URLs to you and Twilio. Protect your auth tokens as you would your passwords. To learn more, see HTTP authentication.

Create a public URL for your app

create-a-public-url-for-your-app page anchor

Most production systems have a public URL, but development systems might not. To permit Twilio to access your local dev app, use ngrok. To create a public URL for your app, run ngrok at the command line:

ngrok http 3000 --url https://<your-app-name>.ngrok.dev

This command creates a public URL https://<your-app-name>.ngrok.dev. that forwards HTTP requests to your web app listening on localhost:3000.

API output resembles the following:

Configure Twilio connection to your web app

configure-twilio-connection-to-your-web-app page anchor

With your public URL created, configure its connection to Twilio using a webhook.


After following this guide, you can successfully host and manage a conference call using Twilio Programmable Voice in your application. You can dial into a specific conference room name dynamically and control participant behaviors, such as assigning a moderator to start and end the call.


Use cases for conference calls with Twilio Programmable Voice

use-cases-for-conference-calls-with-twilio-programmable-voice page anchor

This guide teaches the basics required for the following use cases:

Create an inbound contact center with Twilio Programmable Voice

create-an-inbound-contact-center-with-twilio-programmable-voice page anchor

You can use this guide to route incoming customer calls into a shared conference room where agents can join and assist them. To learn more advanced features that you can use with inbound contact centers, see Voice inbound contact center.

Create an outbound contact center with Twilio Programmable Voice

create-an-outbound-contact-center-with-twilio-programmable-voice page anchor

You can use this guide to programmatically spin up conference rooms and dial out to multiple agents and customers simultaneously for outbound campaigns. To learn more advanced features that you can use with outbound contact centers, see Voice outbound contact center.

Implement call tracking with Twilio Programmable Voice

implement-call-tracking-with-twilio-programmable-voice page anchor

You can use this guide to connect callers to specific destinations through a tracked conference line, allowing you to measure engagement and call metrics. To learn more advanced features that you can use with call tracking, see Voice call tracking.

Perform AI or ML transcription with Twilio Programmable Voice

perform-ai-or-ml-transcription-with-twilio-programmable-voice page anchor

You can use this guide to perform AI or ML transcription on your conference calls by connecting to the Media Streams API and streaming the audio in real-time to your application for processing. To learn more advanced features that you can use with the AI and ML transcription, see Voice AI or ML transcription.


After following this guide, you can successfully host and manage a conference call using Twilio Programmable Voice in your application. You can dial into a specific conference room name dynamically and control participant behaviors, such as assigning a moderator to start and end the call.


Explore the following guides to build on what you've learned in this guide: