Skip to content

Instantly share code, notes, and snippets.

@elyase
Last active January 3, 2016 19:49
Show Gist options
  • Save elyase/8510943 to your computer and use it in GitHub Desktop.
Save elyase/8510943 to your computer and use it in GitHub Desktop.
hangup_static_xml = """
<Response>
<Hangup reason="rejected"/>
</Response>
"""
@app.route('/incoming_call', methods=['POST'])
def handle_call():
app.logger.info("Received request: {}".format(request))
to_number = request.form['From']
app.logger.info("Received call from: {}".format(to_number))
text = "*Comen 2 y paga 1*,Le Chansonnier,J # 257 e/ 13 y 15 Vedado | *70% descuento*,Rio Mar,3ra y Final # 11 La Puntilla Playa"
#------- send SMS -------#
if is_allowed(to_number):
app.logger.info("Sending message {} to: {}".format(text, to_number))
response = send_sms(to_number, text)
app.logger.info("Message response: {}".format(response))
return hangup_static_xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment