Created
July 9, 2013 22:19
-
-
Save RobSpectre/5961823 to your computer and use it in GitHub Desktop.
Flask app creating a Twilio Conference room.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import our dependencies | |
from flask import Flask | |
from twilio import twiml | |
# Instantiate our Flask app | |
app = Flask(__name__) | |
# Create an endpoint '/conference' to serve as our | |
# Voice Request URL | |
@app.route('/conference', methods=['POST']) | |
def voice(): | |
# Use the Twilio Python Module's TwiML generator to | |
# create a response | |
response = twiml.Response() | |
# Have that response dial into a conference room we call | |
# "Today's Headlines" | |
with response.dial() as dial: | |
dial.conference("Today's Headlines") | |
return str(response) | |
# Add a little boilerplate to run our Flask app. | |
if __name__ == '__main__': | |
port = os.environ.get(5000) | |
if port == 5000: | |
app.debug = True | |
app.run(host='0.0.0.0', port=port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment