Skip to content

Instantly share code, notes, and snippets.

@meganspeir
Created October 5, 2016 17:21
Show Gist options
  • Save meganspeir/309650dcf768f11701ee018ecb2cf401 to your computer and use it in GitHub Desktop.
Save meganspeir/309650dcf768f11701ee018ecb2cf401 to your computer and use it in GitHub Desktop.
This gist calls two numbers from a given Twilio number and then connects the callers to a conference.
from flask import Flask
from twilio.rest import TwilioRestClient
from twilio import twiml
app = Flask(__name__)
client = TwilioRestClient(SID, token)
client.calls.create(to="FIRST_PHONE_NUMBER", from_="YOUR_TWILIO_NUMBER", url='http://URL/conference')
client.calls.create(to="SECOND_PHONE_NUMBER", from_="YOUR_TWILIO_NUMBER", url='http://URL/conference')
@app.route('/conference', methods=['GET', 'POST'])
def conference_call():
res = twiml.Response()
with res.dial() as dial:
dial.conference("My Conf")
return res.toxml()
if __name__ == "__main__":
app.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment