Conference App

A conferencing app is where 2 or more people can chat at the same time. It can be as simple as connecting two or more people in a conference bridge or involve many different users and or moderators.

Bridge 3 people in a conference call

  1. Plivo simultaneously calls all 3 phone numbers that were inserted by the user into the conference app
  2. Plivo responds with the following message when any of the 3 calls are answered, "You will now be placed into a demo conference. This is brought to you by Plivo. To know more visit us at plivo.com"
  3. Plivo connects all answered calls into a conference call
  4. If no calls are answered, Plivo hangs up

Note: we use python in this tutorial, but you can write your apps in any programming language. Check out Plivo's pre-built helper libraries for details.

Prerequisites

  1. Get a Free Plivo Trial Account Sign up for a Free Developer account at Plivo.com.
  2. Get a Heroku account and install the Heroku Toolbelt Head over to the Heroku documentation, setup an account, and install the Heroku toolbelt. Note: you may also use your own servers, but to simplify things, we will use Heroku.
  3. Install Flask (a Python microframework) and Plivo Type the following into your console (i.e., Terminal for OS X, Command Prompt for Windows) . For more in-depth info, go to the Flask on Heroku tutorial. Note: If you don’t already have pip installed, you'll want to follow these guides: for Mac, Windows, and Linuxfirst. $ pip install flask plivo

Build the App

Use the Conference XML Create a new file in your favorite text editor, copy the following code into it and save it as conferenceXML.py. To place these calls into a conference, we need to use the <Conference> XML. In this route we added a message using the <Speak> XML and then created a Conference called 'demo'.

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask, Response, request, url_for
import plivoxml
app=Flask(__name__)
@app.route('/response/conference/', methods=['GET'])
def conference():
response = plivoxml.Response()
response.addSpeak('You will now be placed into a demo conference. This is brought to you by Plivo. To know more visit us at plivo.com')

conference_name = "demo"
response.addConference(conference_name)
return Response(str(response), mimetype='text/xml')

Upload your conferenceXML.py app to your server or use a cloud application platform like Heroku. Refer to Heroku's docs on Deploying Applications for more details.

Take a note of your app url in the console. Our output looks like the following and in this case, our app url is http://fluffy-unicorns-1234.herokuapp.com/

Creating fluffy-unicorns-1234... done, stack is cedar
http://fluffy-unicorns-1234.herokuapp.com/
git@heroku.com:fluffy-unicorns-1234.git
Git remote heroku added

Create the main Conference app file Create a new file in your favorite text editor, copy the following code into it and save it as conference.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import plivo

# Your PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN can be found on your Plivo Dashboard https://console.plivo.com/dashboard

PLIVO_AUTH_ID = "Enter your Plivo AUTH ID here"
PLIVO_AUTH_TOKEN = "Enter your Plivo AUTH TOKEN here"

# Enter your Plivo phone number. This will show up on your caller ID
plivo_number = "14153337777"

# Enter the URL of where your conferenceXML.py file is
answer_url = "http://www.yourURL.com"

# Enter the 3 phone numbers you want to join in on the conference call

# The following format is supported only when bulk calling is enabled: 14155555555<14156666666<14157777777

# Note that this is a delimiter that's specific to Plivo's API
# which allows you to call multiple numbers at the same time

# Check out plivo.com/docs/api/call for more info

p = plivo.RestAPI(PLIVO_AUTH_ID, PLIVO_AUTH_TOKEN)

conference_numbers = ["14155555555", "14156666666", "14157777777"]

call_params = {"from": plivo_number,
"answer_url": answer_url,
}

for number in conference_numbers:
    call_params['to'] = number
    print p.make_call(call_params)

Add your Plivo Credentials Open the conference.py file in your favorite text editor and add your PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN (line 8 and 9 above). Get your PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN from your Plivo Dashboard.

HipChat API Bot - Auth ID Token

Add any of your Plivo phone numbers found on your Numbers tab in the Plivo Dashboard to plivo_number (line 12).

If you don't yet have a number, you get one from the Numbers tab.

Assign your phone number to plivo_number

Add your answer_url (line 15) that you noted in step 1.

Type the following in your console to launch your new conference app!$ python conference.py

Is anything on this page unclear? Suggest edits and help us improve our documentation!