def twilio_preset_handler(): ''' Preview handler ''' r, digit = get_response_and_digit(request) if digit == '0': return generate_presets_selection_twiml(r) elif digit == '*': return generate_intro_twiml(r) elif digit == '#': r.say('Invalid input, try again.') return generate_presets_menu_twiml(r) else: url = get_preset_url(digit) return generate_presets_twiml(r, url)
def twilio_play_beat(): r, digits = get_response_and_digit(request) r.play(get_preset_url(digits),loop=0) return r.toxml()