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.
pip
installed, you'll want to follow these guides: for Mac, Windows, and Linuxfirst.
$ pip install flask plivo
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'.
1
2
3
4
5
6
7
8
9
10
11
12
13
#!/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/
1
2
3
4
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
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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.
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.
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!