def voice(): """Respond to incoming phone calls with a menu of options""" # Start our TwiML response resp = VoiceResponse() # If Twilio's request to our app included already gathered digits, # process them if 'Digits' in request.values: # Get which digit the caller chose choice = request.values['Digits'] # <Say> a different message depending on the caller's choice if choice == '1': resp.say('You selected sales. Good for you!') return str(resp) elif choice == '2': resp.say('You need support. We will help!') return str(resp) else: # If the caller didn't choose 1 or 2, apologize and ask them again resp.say("Sorry, I don't understand that choice.") # Start our <Gather> verb gather = Gather(num_digits=1) gather.say('For sales, press 1. For support, press 2.') resp.append(gather) # If the user doesn't select an option, redirect them into a loop resp.redirect('/voice') return str(resp)
def conference(request, name, muted=None, beep=None, start_conference_on_enter=None, end_conference_on_exit=None, wait_url=None, wait_method='POST', max_participants=None): """ See: http://www.twilio.com/docs/api/twiml/conference. Usage:: # urls.py urlpatterns = patterns('', # ... url(r'^conference/(?P<name>\w+)/$', 'django_twilio.views.conference', {'max_participants': 10}), # ... ) """ r = VoiceResponse() dial = Dial() dial.conference(name=name, muted=muted, beep=beep, startConferenceOnEnter=start_conference_on_enter, endConferenceOnExit=end_conference_on_exit, waitUrl=wait_url, waitMethod=wait_method, ) r.append(dial) return r
def test(request): resp = VoiceResponse() gather = Gather(action="/api/v1/ivr/test/route_call/", method="POST", num_digits=1, timeout=10) gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-welcome.mp3") gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-sales.mp3") gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-customer-service.mp3") gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-accounting.mp3") resp.append(gather) return HttpResponse(resp)
def enqueue_call(): digit_pressed = request.values.get('Digits') if digit_pressed == "2" : want_text = False else: want_text = True resp = VoiceResponse() enqueue = resp.enqueue(None, workflow_sid=workflow_sid) enqueue.task('{"want_text":"' + str(want_text) +'"}') resp.append(enqueue) return str(resp)
def connect_call(): """ Connects the call to autopilot """ app.logger.info("Connecting call to autopilot task.") response = VoiceResponse() connect = Connect() connect.autopilot(ASSISTANT_SID, TargetTask="conduct_interview") response.append(connect) response = make_response(str(response)) response.headers['Content-type'] = 'text/html; charset=utf-8' return response
def voice(_num_digits=6, _timeout=10): """Respond to incoming phone calls with a menu of options""" # Start our TwiML response resp = VoiceResponse() app.logger.error("") # Start our <Gather> verb # num_digits is how many digits in authentication gather = Gather(num_digits=_num_digits, timeout=_timeout, action='/app/gather') gather.say('Please enter your 6 digit passcode.') resp.append(gather) return str(resp)
def twiml(self): resp = VoiceResponse() if self.say and self.text: resp.say(self.text, voice=self.voice) gather = Gather(input="speech", method="POST", action=self.url, language=self.language, speechTimeout='auto') resp.append(gather) resp.redirect(self.url, method='POST') return str(resp)
def outboundP(text, hints, sufix='', add_step=True): global step, ngrok_url if add_step: step += 1 twiml_response = VoiceResponse() gather = Gather(action=ngrok_url + str(step) + sufix, input='speech', speechTimeout='auto', hints=hints) gather.say(text) twiml_response.append(gather) twiml_response.say('We didn\'t receive any input. Goodbye!') return twiml_response.to_xml()
def generate_twilio_dial_response(self, from_number: str, to_number: str): """Generates voice call instructions to forward the call to agents Phone. """ resp = VoiceResponse() dial = Dial( caller_id=from_number, record=self.settings.record_calls, recording_status_callback=self.get_recording_status_callback_url(), recording_status_callback_event='completed' ) dial.number(to_number) resp.append(dial) return resp
def voice(): """Respond to incoming phone calls with a menu of options""" # Start our TwiML response resp = VoiceResponse() # Gather the digits gather = Gather(num_digits=6, action='/gather') gather.say( 'Welcome to Corgi bank. Please enter your identification number') resp.append(gather) # If no digits entered, loop resp.redirect('/voice') return str(resp)
def generate_twilio_client_response(self, client, ring_tone='at'): """Generates voice call instructions to forward the call to agents computer. """ resp = VoiceResponse() dial = Dial( ring_tone=ring_tone, record=self.settings.record_calls, recording_status_callback=self.get_recording_status_callback_url(), recording_status_callback_event='completed' ) dial.client(client) resp.append(dial) return resp
def ReceivedStopCall(counter): """Respond to incoming requests.""" resp = VoiceResponse() resp.say("Hello Monkey", voice='alice') print("Inside Received Stop Call method") #logger.debug("Inside Received Stop Call method") stop_num = Gather(action="/RecordInputSchedule?counter=" + str(counter), method="GET", input="DTMF Speech") stop_num.say("Please press or say the stop number, followed by # key", voice='alice') resp.append(stop_num) return str(resp)
def call(): from_number = request.form['From'] if from_number != PRIVATE_NUMBER: # if an attendee is calling return perform_call(PRIVATE_NUMBER) else: # if I am calling response = VoiceResponse() g = Gather(action="/aliasing", finish_on_key="#", method="POST") g.say( "Hello organizer. Dial the number you want to call followed by the hash symbol." ) response.append(g) return str(response)
def test_sip_username_password(self): """ should redirect the call """ d = Dial() d.sip('*****@*****.**', username='******', password='******') r = VoiceResponse() r.append(d) assert_equal( self.strip(r), '<?xml version="1.0" encoding="UTF-8"?><Response><Dial>' '<Sip password="******" username="******">[email protected]</Sip></Dial></Response>' )
def main_menu(): resp = VoiceResponse() gather = Gather( num_digits=1, action='/discord_msg_menu', ) gather.say( "Main Menu. To Listen to recent messages in the discord, Press One. To post a message to the discord, Press Two.", voice='alice') resp.append(gather) return str(resp)
def msg_record_content(): resp = VoiceResponse() if 'SpeechResult' in request.values: global name name = request.values['SpeechResult'] gather = Gather(action='/msg_post_content', input='speech', timeout=3) gather.say("Great!, Now go ahead and record your message.", voice='alice') resp.append(gather) return str(resp)
def whisper(): response = VoiceResponse() dial = Dial() dial.conference('AgentConference', beep=False, coach=agent_sid, status_callback="/statuscallback", status_callback_event="start end join leave mute hold") response.append(dial) return str(response)
def voiceGreeting(): currentDay = time.strftime("%A") currentTime = int(time.strftime("%H")) if((currentDay == 'Saturday') or (currentDay == 'Sunday') or (currentTime >= 18) or (currentTime < 10)): resp = VoiceResponse() resp.play(afterHours_mp3) resp.redirect("/voicemail-handle") return str(resp) else: resp = VoiceResponse() resp.play(greeting_mp3) press = Gather(numDigit=1, action="/key-handle", method="POST") resp.append(press) return str(resp)
def voice(): """Respond to incoming phone calls with a menu of options""" # Start our TwiML response resp = VoiceResponse() # Start our <Gather> verb gather = Gather(numDigits=1) gather.say('For sales, press 1. For support, press 2.') resp.append(gather) # If the user doesn't select an option, redirect them into a loop resp.redirect('/voice') return str(resp)
def my_conference_line(request): response = VoiceResponse() dial = Dial() target_number = config('TARGET_NUMBER') number = Number(target_number) response.say( 'Thank you for allowing TireTutor to make tire buying easier ' + 'for you! Please wait while we connect you to your tire dealer now!') dial.number(target_number, url=CALL_WHISPER_URL, method='GET') response.append(dial) return HttpResponse(str(response))
def get_team(): intro = 'Welcome to the Integrichain on call hotline. ' command = '' for i in range(len(schedules)): command += 'Press %d for %s. ' % (i + 1, schedules[i]) # command = "Press 1 for S.R.E.. Press 2 for Nick" print command response = VoiceResponse() gather = Gather(num_digits=1, action='/forward', method='POST') gather.say(intro, voice='alice') gather.say(command, voice='alice') response.append(gather) return (str(response), 200)
def enqueue_to_flex(): caller = request.args.get('Caller') formatted_caller = caller[1:] print(formatted_caller) location = fetch_sync_data(formatted_caller) print(location) resp = VoiceResponse() enqueue = resp.enqueue( None, workflow_sid='WW753b6e8c074d797802e6e68cc823b74d') enqueue.task(json.dumps( {'type': 'inbound', 'name': caller, 'lat': location['lat'], 'lng': location['lng']})) resp.append(enqueue) return str(resp)
def call_handler(call_sid, _from, to, call_status, error_tuple, direction, forwarded_from, parent_call_sid, digits): """ EXAMPLE HANDLER Place Code Here to Handle Calls """ response = VoiceResponse() #Review Say Command Documentationhttps://www.twilio.com/docs/voice/twiml/say say = Say("Hello, your Serverless Application is Working.", voice="Polly.Joanna") response.append(say) response.hangup() return response
def voice(): """Respond to incoming phone calls with a menu of options""" # Start our TwiML response resp = VoiceResponse() # Start our <Gather> verb gather = Gather(num_digits=1, action='/gather') gather.say('For sales, press 1. For support, press 2.') resp.append(gather) # If the user doesn't select an option, redirect them into a loop resp.redirect('/voice') return str(resp)
def conf_call(): response = VoiceResponse() with Dial() as dial: if request.values.get('From') == MODERATOR: dial.conference( "My Conference Room", start_conference_on_enter=True, end_conference_on_exit=True, waitUrl="http://twimlets.com/holdmusic?Bucket=com.twilio.music.electronica&Message=please%20wait", ) else: dial.conference('My Conference Room', start_conference_on_enter=False) response.append(dial) return str(response)
def test_add_number_status_callback_event(self): """ add a number to a dial with status callback events""" d = Dial() d.number('1231231234', status_callback='http://example.com', status_callback_event='initiated completed') r = VoiceResponse() r.append(d) assert_equal( self.strip(r), '<?xml version="1.0" encoding="UTF-8"?><Response><Dial><Number statusCallback="http://example.com" statusCallbackEvent="initiated completed">1231231234</Number></Dial></Response>' )
def test_nested_say_play_pause(self): """ a gather with a say, play, and pause """ g = Gather() g.say('Hey') g.play(url='hey.mp3') g.pause() r = VoiceResponse() r.append(g) assert_equal( self.strip(r), '<?xml version="1.0" encoding="UTF-8"?><Response><Gather><Say>Hey</Say><Play>hey.mp3</Play><Pause /></Gather></Response>' )
def call(): numbers = ['720-938-7168', '774-232-6921', '513-675-5664', '310-502-9285'] response = VoiceResponse() caller = request.values['From'] if not validateNumber(caller): response.reject() else: response.say('Thank you for calling LikeWallet! Please remain on the line and the next available representative will assist you.', voice='woman', language='en') dial = Dial() for number in numbers: dial.number(number) response.append(dial) return str(response)
def post(self, request, *args, **kwargs): logger.info(f'Voice POST received: {json.dumps(request.data)}') response = VoiceResponse() gather = Gather(num_digits=1, action=reverse("api_webhooks_voice_enqueue"), method="POST", timeout=5) gather.say("For English, please hold or press one.", language='en') gather.say("Para Español oprime dos.", language='es') response.append(gather) response.redirect(reverse("api_webhooks_voice_enqueue")) return HttpResponse(str(response))
def voice(text): if "static" in text: return send_file(text, mimetype='text/xml', as_attachment=True) else: """Respond to incoming phone calls and mention the caller's city""" intro = False number = request.values['From'] # Get caller's number state = request.values['FromState'] # Get caller's state # Start our TwiML response resp = VoiceResponse() if 'Digits' in request.values: # Get which digit the caller chose choice = request.values['Digits'] # <Say> a different message depending on the caller's choice if choice == '1': resp.play('static/joinspeech.mp3') addNumber(number, state) return str(resp) elif choice == '2': resp.play('static/leavespeech.mp3') removeNumber(number, state) return str(resp) elif choice == '3': resp.play('static/moreinfospeech.mp3') send_message( number, "For more information, please visit our website at COVcall.tech" ) return str(resp) else: # If the caller didn't choose 1 or 2, apologize and ask them again intro = True resp.play('static/redospeech.mp3') # Read intro message aloud to the caller if not intro: resp.play('static/introspeech.mp3') # Start our <Gather> verb gather = Gather(num_digits=1) gather.play('static/newgatherspeech.mp3') resp.append(gather) # If the user doesn't select an option, redirect them into a loop resp.redirect('/voice') return str(resp) # Dummy return statement
def generate_twilio_dial_response(self, from_number: str, to_number: str): """Generates voice call instructions needed for twilio. """ url_path = "/api/method/twilio_integration.twilio_integration.api.update_recording_info" recording_status_callback = get_public_url(url_path) resp = VoiceResponse() dial = Dial(caller_id=from_number, record=self.settings.record_calls, recording_status_callback=recording_status_callback, recording_status_callback_event='completed') dial.number(to_number) resp.append(dial) return resp
def voice(): """Respond to incoming requests.""" resp = VoiceResponse() #esp.say("Hello this is Acme company. We have created a new high severity incident for Commodity Malware. Press 1 to acknowledge this alert and stop the call tree. Press 2 for the incident's description. Press 3 for the host's IP address. ") # If Twilio's request to our app included already gathered digits, # process them if 'Digits' in request.values: # Get which digit the caller chose choice = request.values['Digits'] # <Say> a different message depending on the caller's choice if choice == '1': #Need to record the response somehow here... resp.say( 'Thank you, your response has been recorded and the call tree stopped', voice="alice", language="en-US") resp.redirect('/') elif choice == '2': resp.say( 'The incident summary is Zeus/Zbot (or Variant) Infection - 10.46.14.208', voice="alice", language="en-US") resp.redirect('/') #Redirect back to to the main. elif choice == '3': resp.say( 'The affected host is located at 10.46.14.208. Is this better? 10 Dot. 4 6 Dot. 14 Dot. 2 0 8.', voice="alice", language="en-US") resp.redirect('/') else: # If the caller didn't choose 1 or 2, apologize and ask them again resp.say("Sorry, I don't understand that choice.", voice="alice", language="en-US") # Start our <Gather> verb gather = Gather(num_digits=1) gather.say( 'Hello this is Acme company. We have created a new high severity incident for Commodity Malware. Press 1 to acknowledge this alert and stop the call tree. Press 2 for the incident description. Press 3 for the IP address.', voice="alice", language="en-US") resp.append(gather) # If the user doesn't select an option, redirect them into a loop resp.redirect('/') return str(resp)
def selection(): speech = request.values.get('SpeechResult') caller = request.values.get('Caller') response = VoiceResponse() if speech == 'food': gather = Gather(input='speech', action='/voice/food', language=locale) gather.say( "Please say what food you require. For example baked beans.", voice='alice', language=locale) response.append(gather) elif speech == 'medication': gather = Gather(input='speech', action='/voice/medication', language=locale) gather.say("Please say the medication you require.", voice='alice', language=locale) response.append(gather) elif speech == 'emotional support': if caller != None: conn = sqlite3.connect('hubapp.sqlite') c = conn.cursor() response.say( 'You said you need emotional support. One of our volunteers will be in touch soon. In the meantime if you want to talk to someone immediately please contact Samaritans at 1. 1. 6. 1. 2. 3. The Lines are open 24 hours a day 7 days a week.', voice='alice', language=locale) response.say('Thank you for calling. Goodbye.', voice='alice', language=locale) speech = "requires emotional support callback." c.execute("insert into phonereport values (?, ?, ?, ?, ?)", (None, caller, 'emotional support', speech, 'open')) conn.commit() conn.close() response.hangup() else: response.say( 'Unfortauntely your caller ID has been witheald. We are unable to process your emotional support request unless we are able to get your caller ID. However you can call Samaritans for free at 1. 1. 6. 1. 2. 3.' ) else: response.say( 'I\'m sorry, I was unable to identify what you said. Please call back or alternatively text this number your request. Goodbye!', voice='alice', language=locale) response.hangup() return str(response)
def voice(): blink(GPIO(pins)) callers = { "+18577010279": "Sherry"} from_number = request.values.get('From', None) print ("calling") if from_number in callers: caller = callers[from_number] else: caller = "Monkey" resp = VoiceResponse() resp.say("Hello " + caller) gather = Gather(num_digits=1, action='/storytime') gather.say('To listen to Three Little Pigs, press 1. To listen to Little Red Riding Hood, press 2.') resp.append(gather) return str(resp)
def voice(request): """Returns TwiML instructions to Twilio's POST requests""" resp = VoiceResponse() dial = Dial(caller_id='+6625088681') # If the browser sent a phoneNumber param, we know this request # is a support agent trying to call a customer's phone if 'phoneNumber' in request.POST: dial.number(request.POST['phoneNumber']) else: # Otherwise we assume this request is a customer trying # to contact support from the home page dial.client('support_agent') resp.append(dial) return HttpResponse(resp)
def get_voice_twiml(): """Respond to incoming calls with a simple text message.""" resp = VoiceResponse() if "To" in request.form: dial = Dial(callerId="+15017250604") # wrap the phone number or client name in the appropriate TwiML verb # by checking if the number given has only digits and format symbols if phone_pattern.match(request.form["To"]): dial.number(request.form["To"]) else: dial.client(request.form["To"]) resp.append(dial) else: resp.say("Thanks for calling!") return Response(str(resp), mimetype='text/xml')
def generate_connect_conference(call_sid, wait_url, start_on_enter, end_on_exit): twiml_response = VoiceResponse() dial = Dial() dial.conference(call_sid, start_conference_on_enter=start_on_enter, end_conference_on_exit=end_on_exit, wait_url=wait_url) return str(twiml_response.append(dial))
def intro_wait_human(params, campaign): """ Play intro message, and wait for key press to ensure we have a human on the line. Then, redirect to _make_calls. """ resp = VoiceResponse() play_or_say(resp, campaign.audio('msg_intro')) action = url_for("call._make_calls", **params) # wait for user keypress, in case we connected to voicemail # give up after 10 seconds g = Gather(num_digits=1, method="POST", timeout=10, action=action) play_or_say(g, campaign.audio('msg_intro_confirm'), lang=campaign.language_code) resp.append(g) return str(resp)
def call(): """Return TwiML for a moderated conference call.""" # Start our TwiML response response = VoiceResponse() # Start with a <Dial> verb with Dial() as dial: # If the caller is our MODERATOR, then start the conference when they # join and end the conference when they leave if request.values.get('From') == MODERATOR: dial.conference( 'My conference', start_conference_on_enter=True, end_conference_on_exit=True) else: # Otherwise have the caller join as a regular participant dial.conference('My conference', start_conference_on_enter=False) response.append(dial) return str(response)
def schedule_prompt(params, campaign): """ Prompt the user to schedule calls """ if not params or not campaign: abort(400) resp = VoiceResponse() g = Gather(num_digits=1, timeout=3, method="POST", action=url_for("call.schedule_parse", **params)) existing_schedule = ScheduleCall.query.filter_by(campaign_id=campaign.id, phone_number=params['userPhone']).first() if existing_schedule and existing_schedule.subscribed: play_or_say(g, campaign.audio('msg_alter_schedule'), lang=campaign.language_code) else: play_or_say(g, campaign.audio('msg_prompt_schedule'), lang=campaign.language_code) resp.append(g) # in case the timeout occurs, we need a redirect verb to ensure that the call doesn't drop params['scheduled'] = False resp.redirect(url_for('call._make_calls', **params)) return str(resp)
def call(): """Returns TwiML instructions to Twilio's POST requests""" response = VoiceResponse() dial = Dial(callerId=app.config['TWILIO_NUMBER']) # If the browser sent a phoneNumber param, we know this request # is a support agent trying to call a customer's phone if 'phoneNumber' in request.form: dial.number(request.form['phoneNumber']) else: # Otherwise we assume this request is a customer trying # to contact support from the home page dial.client('support_agent') return str(response.append(dial))
from twilio.twiml.voice_response import Dial, VoiceResponse, Sip response = VoiceResponse() dial = Dial() dial.sip('sip:[email protected]') response.append(dial) print(response)
def make_single(): params, campaign = parse_params(request) if not params or not campaign: abort(400) i = int(request.values.get('call_index', 0)) params['call_index'] = i (uid, prefix) = parse_target(params['targetIds'][i]) (current_target, cached) = Target.get_or_cache_key(uid, prefix) if cached: # save Target to database db.session.add(current_target) db.session.commit() resp = VoiceResponse() if not current_target.number: play_or_say(resp, campaign.audio('msg_invalid_location'), lang=campaign.language_code) return str(resp) if current_target.offices: if campaign.target_offices == TARGET_OFFICE_DISTRICT: office = random.choice(current_target.offices) target_phone = office.number elif campaign.target_offices == TARGET_OFFICE_BUSY: # TODO keep track of which ones we have tried undialed_offices = current_target.offices # then pick a random one office = random.choice(undialed_offices) target_phone = office.number #elif campaign.target_offices == TARGET_OFFICE_CLOSEST: # office = find_closest(current_target.offices, params['userLocation']) # target_phone = office.phone else: office = None target_phone = current_target.number else: office = None target_phone = current_target.number play_or_say(resp, campaign.audio('msg_target_intro'), title=current_target.title, name=current_target.name, office_type = office.name if office else '', lang=campaign.language_code) if current_app.debug: current_app.logger.debug(u'Call #{}, {} ({}) from {} in call.make_single()'.format( i, current_target.name, target_phone.e164, params['userPhone'])) try: parsed = PhoneNumber(params['userPhone'], params['userCountry']) userPhone = parsed.e164 except phonenumbers.NumberParseException: current_app.logger.error('Unable to parse %(userPhone)s for %(userCountry)s' % params) # press onward, but we may not be able to actually dial userPhone = params['userPhone'] # sending a twiml.Number to dial init will not nest properly # have to add it after creation d = Dial(None, caller_id=userPhone, time_limit=current_app.config['TWILIO_TIME_LIMIT'], timeout=current_app.config['TWILIO_TIMEOUT'], hangup_on_star=True, action=url_for('call.complete', **params)) \ .number(target_phone.e164, sendDigits=target_phone.extension) resp.append(d) return str(resp)
def route_call(request): digits = int(request.POST.get('Digits', '0')) call_origin = request.POST.get('From', None) call_log = Call.objects.create(twilio_id=request.POST.get('CallSid', None), type="incoming", incoming_number=call_origin) if digits == 1: message = "https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-transferring-sales.mp3" numbers = [(73, '+66819189145')] clients = [(73, "sidarat")] caller_id = call_origin or '+6625088681' call_log.forwarding_number = '+66819189145' call_log.save() elif digits == 2: message = "https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-transferring-customer-service.mp3" numbers = [(16, '+66914928558'), (42, '+66952471426'), (42, '+66634646465')] clients = [(16, "chup"), (42, 'apaporn')] caller_id = '+6625088681' elif digits == 3: message = "https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-transferring-accounting.mp3" numbers = [(63, '+66988325610')] clients = [(63, "mays")] caller_id = '+6625088681' elif digits == 8: message = "https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-transferring-accounting.mp3" numbers = [(1, '+66990041468')] clients = [(1, "charliephairoj")] caller_id = "+6625088681" call_log.forwarding_number = '+66990041468' call_log.save() else: message = "https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-transferring-customer-service.mp3" numbers = [(16, '+66914928558'), (42, '+66952471426')] clients = [(16, "chup"), (42, 'apaporn')] caller_id = '+6625088681' or '+6625088681' resp = VoiceResponse() resp.play(message) dial = Dial(caller_id=caller_id, record='record-from-ringing', recording_status_callback="/api/v1/ivr/recording/") for number in numbers: dial.number(number[1], status_callback_event='answered completed', status_callback=_get_status_callback_url(number[0]), status_callback_method="GET") for client in clients: dial.client(client[1], status_callback_event='answered completed', status_callback=_get_status_callback_url(client[0]), status_callback_method="GET") resp.append(dial) return HttpResponse(resp)
from twilio.twiml.voice_response import Gather, Redirect, VoiceResponse, Say response = VoiceResponse() gather = Gather(action='/process_gather.php', method='GET') gather.say('Enter something, or not') response.append(gather) response.redirect('/process_gather.php?Digits=TIMEOUT', method='GET') print(response)