Skip to content

Instantly share code, notes, and snippets.

@RobSpectre
Last active December 19, 2015 13:28
Show Gist options
  • Save RobSpectre/5961860 to your computer and use it in GitHub Desktop.
Save RobSpectre/5961860 to your computer and use it in GitHub Desktop.
Adjust Flask app to use custom conference room.
from flask import Flask
from twilio import twiml
app = Flask(__name__)
# Let's adjust this route to create a custom wait
# experience for our conference call.
@app.route('/conference', methods=['POST'])
def voice():
response = twiml.Response()
with response.dial() as dial:
# Let's add a waitUrl attribute to this Conference
# noun and point it to a new endpoint we will
# create below.
dial.conference("Today's Headlines", waitUrl="/wait")
return str(response)
# Here's a new TwiML endpoint we'll create to customize what
# our callers hear when they wait to be connected to conference.
@app.route('/wait', methods=['POST'])
def wait():
response = twiml.Response()
response.say("This is totally a custom waiting room experience.")
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