def get_voice_twiml(): """Respond to incoming calls with a simple text message.""" resp = VoiceResponse() resp.say("Thanks for calling!") return Response(str(resp), mimetype='text/xml')
def generate_wait(): twiml_response = VoiceResponse() wait_message = 'Thank you for calling. Please wait in line for a few seconds. An agent will be with you shortly.' wait_music = 'http://com.twilio.music.classical.s3.amazonaws.com/BusyStrings.mp3' twiml_response.say(wait_message) twiml_response.play(wait_music) return str(twiml_response)
def voice(): """Respond to incoming calls with a simple text message.""" resp = VoiceResponse() resp.say("Hello. It's me.") resp.play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3") return str(resp)
def example(): """ Some example usage of different twilio resources. """ client = Client(ACCOUNT_SID, AUTH_TOKEN) # Get all messages all_messages = client.messages.list() print('There are {} messages in your account.'.format(len(all_messages))) # Get only last 10 messages... some_messages = client.messages.list(limit=10) print('Here are the last 10 messages in your account:') for m in some_messages: print(m) # Get messages in smaller pages... all_messages = client.messages.list(page_size=10) print('There are {} messages in your account.'.format(len(all_messages))) print('Sending a message...') new_message = client.messages.create(to='XXXX', from_='YYYY', body='Twilio rocks!') print('Making a call...') new_call = client.calls.create(to='XXXX', from_='YYYY', method='GET') print('Serving TwiML') twiml_response = VoiceResponse() twiml_response.say('Hello!') twiml_response.hangup() twiml_xml = twiml_response.to_xml() print('Generated twiml: {}'.format(twiml_xml))
def incoming_call(request): """ Returns TwiML instructions to Twilio's POST requests """ resp = VoiceResponse() resp.say("For Programmable SMS, press one. For Voice, press any other key.") resp.gather(numDigits=1, action="/call/enqueue", method="POST") return HttpResponse(resp)
def voice(): """Respond to incoming phone calls with a 'Hello world' message""" # Start our TwiML response resp = VoiceResponse() # Read a message aloud to the caller resp.say("hello world!", voice='alice') return str(resp)
def handle_recording(): """Play back the caller's recording.""" recording_url = request.values.get("RecordingUrl", None) resp = VoiceResponse() resp.say("Listen to your recorded message.") resp.play(recording_url) resp.say("Goodbye.") return str(resp)
def get_voice_twiml(): """Respond to incoming calls with a simple text message.""" resp = VoiceResponse() if "To" in request.form: resp.dial(request.form["To"], callerId="+15017250604") else: resp.say("Thanks for calling!") return Response(str(resp), mimetype='text/xml')
def voice(): """Respond to incoming phone calls with a text message.""" # Start our TwiML response resp = VoiceResponse() # Read a message aloud to the caller resp.say("Hello! You will get an SMS message soon.") # Also tell Twilio to send a text message to the caller resp.sms("This is the ship that made the Kessel Run in fourteen parsecs?") return str(resp)
def outbound(): response = VoiceResponse() response.say("Thank you for contacting our sales department. If this " "click to call application was in production, we would " "dial out to your sales team with the Dial verb.", voice='alice') ''' # Uncomment this code and replace the number with the number you want # your customers to call. response.number("+16518675309") ''' return str(response)
def voice_twiml(question): response = VoiceResponse() response.say(question.content) response.say(VOICE_INSTRUCTIONS[question.kind]) action_url = url_for('answer', question_id=question.id) transcription_url = url_for('answer_transcription', question_id=question.id) if question.kind == Question.TEXT: response.record(action=action_url, transcribe_callback=transcription_url) else: response.gather(action=action_url) return str(response)
def handle_key(): """Handle key press from a user.""" digit_pressed = request.values.get('Digits', None) logger.info("Digit pressed: {}".format(digit_pressed)) if digit_pressed == "1": resp = VoiceResponse() resp.say("""Record your story after the tone. Please keep your recording to under a minute. Once you have finished recording, you may hangup""", voice="alice") resp.record(maxLength="60", action="/handle-recording") return str(resp) # If the caller pressed anything but 1, redirect them to main menu else: return _redirect_welcome()
def record(): """Returns TwiML which prompts the caller to record a message""" # Start our TwiML response response = VoiceResponse() # Use <Say> to give the caller some instructions response.say('Ahoy! Call recording starts now.') # Use <Record> to record the caller's message response.record() # End the call with <Hangup> response.hangup() return str(response)
def voice(): """Respond to incoming phone calls with a connection message and forward""" # Start our TwiML response response = VoiceResponse() # Read a message aloud to the caller response.say("Connecting you to the PromptConf Code of Conduct team", voice='alice') for number in get_hotline_numbers(): response.dial(number, caller_id='PromptConf Hotline', action=url_for('end_call')) return Response(str(response), 200, mimetype="application/xml")
def record_twiml(request): """Returns TwiML which prompts the caller to record a message""" # Start our TwiML response response = VoiceResponse() # Use <Say> to give the caller some instructions response.say('Ahoy! Call recording starts now.') # Use <Record> to record the caller's message response.record() # End the call with <Hangup> response.hangup() return HttpResponse(str(response), content_type='application/xml')
def gather(): global choice_result global choice response = VoiceResponse() if 'Digits' in request.values: # Get which digit the caller chose c = request.values['Digits'] choice_result = c else: response.say("Sorry, I don't understand that choice.") response.redirect("/cur") response.redirect('/next') return str(response)
def route_hotline_error_api_version(api_version): # Error response in case an invalid api_version is requested resp = VoiceResponse() if api_version == "v1": for language in ['de', 'en-gb']: resp.say( hotline_translation['error_message_api_version'][language], voice='woman', language=language) else: resp.redirect('/v1/hotline/error/api_version') return str(resp)
def voice(): """Respond to incoming phone calls and mention the caller's city""" # Get the caller's city from Twilio's request to our app city = request.values['FromCity'] # Start our TwiML response resp = VoiceResponse() # Read a message aloud to the caller resp.say('Never gonna give you up, {}!'.format(city), voice='alice') # Play an audio file for the caller resp.play('https://demo.twilio.com/docs/classic.mp3') return str(resp)
def record(): """Returns TwiML which prompts the caller to record a message""" # Start our TwiML response response = VoiceResponse() # Use <Say> to give the caller some instructions response.say('Hello. Please leave a message and I will transcribe it.') # Use <Record> to record and transcribe the caller's message response.record(transcribe=True, max_length=30) # End the call with <Hangup> response.hangup() return str(response)
def record(): """Returns TwiML which prompts the caller to record a message""" # Start our TwiML response response = VoiceResponse() # Use <Say> to give the caller some instructions response.say('Hello. Please leave a message after the beep.') # Use <Record> to record the caller's message response.record() # End the call with <Hangup> response.hangup() return str(response)
def handle_response(request): digits=request.POST.get('Digits', '') twilio_response=VoiceResponse() if digits=='1': twilio_response.play('http://bit.ly/phaltsw') if digits == '2': number.request.POST.get('From','') twilio_response.say('Text Message') twilio_response.sms('Issue',to=number) return twilio_response
def answer_call(): """Respond to incoming phone calls with a brief message.""" # Start our TwiML response resp = VoiceResponse() # Read a message aloud to the caller resp.say( "Thank you for calling the alert hotline. Please record your alert message at the beep. Press the star key to end.", voice='alice') resp.record(action='http://859b7b5f.ngrok.io/data', method='GET', max_length=20, finish_on_key='*') return str(resp)
def response_xml(self): response = VoiceResponse() response.say( ' ピーっという発信音の後、お問い合わせ内容をお申し付けください。', voice='alice', language='ja-JP') response.record( timeout=10, maxLength=180, playBeep=True, trim='trim-silence', recordingStatusCallback='/' + stage + '/callback', recordingStatusCallbackMethod='POST' ) return str(response)
def voice(): resp = VoiceResponse() if "To" in request.form and request.form["To"] != '': dial = Dial(caller_id=os.environ['TWILIO_CALLER_ID']) # 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 get_data(): print('---------------------------') recordingurl = request.args.get('RecordingUrl') print(recordingurl) print('---------------------------') resp2 = VoiceResponse() resp2.say('thank you') resp2.hangup() print('-------------translate-part--------------') r = requests.get(recordingurl, allow_redirects=True) open('recording.wav', 'wb').write(r.content) client = speech.SpeechClient.from_service_account_json('googlecreds.json') translate_client = translate.Client.from_service_account_json( 'googlecreds.json') #translate whatever is found to english target = 'en' with io.open('recording.wav', 'rb') as audio_file: content = audio_file.read() audio = types.RecognitionAudio(content=content) ##audio = types.RecognitionAudio(uri=recordingurl) config = types.RecognitionConfig( encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16, sample_rate_hertz=8000, language_code='en-US') response = client.recognize(config, audio) # Each result is for a consecutive portion of the audio. Iterate through # them to get the transcripts for the entire audio file. for result in response.results: # The first alternative is the most likely one for this portion. print(u'Transcript: {}'.format(result.alternatives[0].transcript)) text = result.alternatives[0].transcript with open('transcript.txt', 'w') as the_file: the_file.write(text) translation = translate_client.translate(text, target_language=target) print(u'Translation: {}'.format(translation['translatedText'])) with open('translation.txt', 'w') as the_file2: the_file2.write(translation['translatedText']) return (str(resp2))
def process_recording(): # Start our TwiML response resp = VoiceResponse() resp.say("Thank you, I'm processing your problem. Hang on!") #rid = request.args.get('RecordingSid') url = 'https://api.twilio.com/2010-04-01/Accounts/' + account_sid + '/Recordings/' + rid r = requests.get(url, allow_redirects=True) open('rec.wav', 'wb').write(r.content) #process the audio file t = speechAPI() #text = t.start_transcribing('rec.wav') #speech-text with automatic punctuation sc = speech.SpeechClient() with io.open('rec.wav', 'rb') as audio_file: content = audio_file.read() audio = speech.types.RecognitionAudio(content=content) config = speech.types.RecognitionConfig( encoding=speech.enums.RecognitionConfig.AudioEncoding.LINEAR16, sample_rate_hertz=8000, language_code='en-US', # Enable automatic punctuation enable_automatic_punctuation=True) #choose the best punctuation transcript = [] text = sc.recognize(config, audio) for i, result in enumerate(text.results): alternative = result.alternatives[0] transcript.append(alternative.transcript) #break transcript = ' '.join(transcript) ts = text_summarizer() #text = 'Hi. My name is Paul. I am quite new to using SAP ERP products. Actually our company acquired SAP products last month. We were using a product from another vendor before. Alirght, so my question, is how do I implement planning phases inside the software. It has lots of features so it is difficult for me to go through each and every one of them and trying to find out what I need. Please refer to a specific page of the user guide or inuitive navigation guide. Thanks for the help.' summary = ts.summarize(transcript) resp.say( "Thanks for your patience, unfortunately, I cannot help you in this matter. I will now redirect you to one of our experts and brief them on your problem." ) #resp.redirect() render = '<div><h3> Service request </h3><p>' + transcript + '</p><h3> Summary </h3><p>' + summary + '</p></div>' return str(render)
def call(): from_number = request.values.get('From', None) resp = VoiceResponse() # Greet the caller by name resp.say("Hello user") # Say a command, and listen for the caller to press a key. When they press # a key, redirect them to /handle-key. g = Gather(numDigits=1, action="/handle-key", method="POST") g.say( "To connect to the other Tin Can user, press 1. Press any other key to start over." ) resp.append(g) return str(resp)
def amazon_voice_request_pin(): pin = request.args["AmazonPinCode"] topic = request.values["Topic"] response = VoiceResponse() if not request.args.get("said_step_four"): response.say(f"Step {'3' if topic == 'none' else '4'}!") response.say(f'Your pin is {", ".join(pin)}.') response.pause(2) response.redirect( url_for("amazon_voice_request_pin", AmazonPinCode=pin, Topic=topic, said_step_four="1")) return twiml_response(response)
def set_UserOTP(): response = VoiceResponse() global user_data user_data[request.form['Caller']]['OTP']=str(request.form['Digits']) print(user_data) print("set otp done") print(verify_otp()) if verify_otp(): _AD_pass_reset() print("Password reset request submitted") response.say("Your new Active Directory password has been sent to your mobile number.") else: response.say("You have entered the wrong OTP. Please try again!") user_data[request.form['Caller']]['count']= 0 get_User_OTP(response) return twiml(response)
def voice_question(question): twiml_response = VoiceResponse() twiml_response.say(question.body) twiml_response.say(VOICE_INSTRUCTIONS[question.kind]) action = save_response_url(question) if question.kind == Question.TEXT: twiml_response.record(action=action, method='POST', max_length=6, transcribe=True, transcribe_callback=action) else: twiml_response.gather(action=action, method='POST') return twiml_response
def _handle_exception(self): response = VoiceResponse() self.request.response.status_int = 200 message = ( "My apologies. We seem to be experiencing technical difficulties. " "You will now be redirected to our call center for assistance.") response.say( message, voice="woman", language="en", ) response.dial(self.request.registry.settings["support_number"]) return response
def agent_call(request): if request.POST['CallStatus'] == 'completed': return HttpResponse('') twiml = VoiceResponse() twiml.say( 'It appears that no agent is available. Please leave a message after the beep', voice='alice', language='en-GB', ) twiml.record( max_length=20, action=reverse('ivr:hangup'), transcribe_callback= f"{reverse('ivr:recordings')}?agentId={request.GET.get('agentId')}", # noqa ) return TwiMLResponse(twiml)
def say(request, text, voice=None, language=None, loop=None): """ See: http://www.twilio.com/docs/api/twiml/say. Usage:: # urls.py urlpatterns = patterns('', # ... url(r'^say/$', 'django_twilio.views.say', {'text': 'hello, world!'}) # ... ) """ r = VoiceResponse() r.say(text, voice=voice, language=language, loop=loop) return r
def return_instructions(): twiml_response = VoiceResponse() twiml_response.say( 'To get to your extraction point, get on your bike and go down ' 'the street. Then Left down an alley. Avoid the police cars.' ' Turn left into an unfinished housing development. Fly over ' 'the roadblock. Go passed the moon. Soon after you will see ' 'your mother ship.', voice='alice', language='en-GB', ) twiml_response.say( 'Thank you for calling the ET Phone Home Service - the ' 'adventurous alien\'s first choice in intergalactic travel') twiml_response.hangup() return twiml_response
def answer_call(): """Respond to incoming phone calls with a menu of options""" # Start our TwiML response resp = VoiceResponse() resp.say("Welcome to the Twilio story teller application.") # Start our <Gather> verb gather = Gather(num_digits=1, action='/read-story') message = get_stories_message() gather.say(message) resp.append(gather) # If the user doesn't select an option, redirect them into a loop resp.redirect('/voice') return str(resp)
def enqueue_call(): if 'Digits' in request.values: digit_pressed = request.values['Digits'] workflow_d = return_work_space( digit_pressed) #array of workspace and product resp = VoiceResponse() select_lang = request.values['lang'] with resp.enqueue(None, workflow_Sid=workflow_d[0]) as e: e.task('{"selected_language" : "' + select_lang + '", "selected_product" : "' + workflow_d[1] + '"}') return Response(str(resp), mimetype='text/xml') else: resp = VoiceResponse() resp.say("no digits detected") #tell user something is amiss resp.redirect("/incoming_call") #redirect back to initial step return Response(str(resp), mimetype='text/xml')
def wrong_number(): from_number = request.values.get('From', None) resp = VoiceResponse() if from_number in callers: resp.say("Hello, " + callers[from_number]) #resp.say("Enter the number you want to call, followed by pound.") #g = Gather(numDigits=11,finishOnKey='#', action="/handle-key", method="POST") g = Gather(finishOnKey='#', action="/handle-key", method="POST") g.say("Enter the number you want to call, followed by pound.") resp.append(g) else: resp.say("Wrong number. You suck!") return str(resp)
def handle_input(): if 'Digits' in request.values: choice = int(request.values['Digits']) dept = {1: "sales", 2: "support", 3: "billing"} resp = VoiceResponse() with resp.enqueue(workflow_sid=workflow_sid) as e: e.task('{"selected_product" : "' + dept[choice] + '"}') else: resp = VoiceResponse() resp.say("No digits detected") resp.redirect('/incoming_call') return Response(str(resp), mimetype='text/xml')
def call(): caller = normalize_phone(request.values.get("From")) callee = normalize_phone(request.values.get("To")) response = VoiceResponse() # if the caller is calling himself if caller and callee and (caller == callee): # login to voicemail login(response, callee, passcode, None) else: # caller is not calling himself, prompt for a message response = VoiceResponse() response.say( "Hello, the number you have called is not available to take your call. Please leave a message after the tone." ) response.record(maxLength="30", action="/leave-message") return str(response)
def _redirect_welcome(): global language response = VoiceResponse() if language == 'h': response.say("main menyoo par vaapas laut rahe hai", voice="Polly.Aditi", language="hi-IN") else: response.say("Returning to the main menu", voice="alice", language="en-GB") response.redirect(url_for('welcome')) return twiml(response)
def hello_monkey(): """Say a caller's name, and play an MP3 for them.""" from_number = request.values.get('From', None) if from_number in callers: caller = callers[from_number] else: caller = "Monkey" resp = VoiceResponse() # Greet the caller by name resp.say("Hello " + caller) # Play an MP3 resp.play("http://demo.twilio.com/hellomonkey/monkey.mp3") return str(resp)
def voice(): resp = VoiceResponse() # Greet the caller by name resp.say("Hello. It's me. ") # Play an mp3 resp.play("http://howtodocs.s3.amazonaws.com/ahoyhoy.mp3") # Gather digits. with resp.gather(numDigits=1, action="/handle-gather", method="POST") as g: g.say( """To speak to a real person, press 1. Press 2 to record a message for a Twilio educator. Press any other key to start over.""" ) return str(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 gather(): """Processes results from the <Gather> prompt in /voice""" # 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.") # If the user didn't choose 1 or 2 (or anything), send them back to /voice resp.redirect('/voice') return str(resp)
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 handle_gather(): """Handle key press from a user.""" digit_pressed = request.values.get('Digits', None) if digit_pressed == "1": resp = VoiceResponse() # Dial (310) 555-1212 - connect that number to the incoming caller. resp.dial("+13105551212") # If the dial fails: resp.say("The call failed, or the remote party hung up. Goodbye.") return str(resp) elif digit_pressed == "2": resp = VoiceResponse() resp.say("Record your message after the tone.") resp.record(maxLength="30", action="/handle-recording") return str(resp) # If the caller pressed anything but 1, redirect them to the homepage. else: return redirect("/")
from twilio.twiml.voice_response import Pause, VoiceResponse, Say response = VoiceResponse() response.pause(length=5) response.say('Hi there.') print(response)
def post(self, request, *args, **kwargs): from twilio.request_validator import RequestValidator from temba.flows.models import FlowSession signature = request.META.get("HTTP_X_TWILIO_SIGNATURE", "") url = "https://" + request.get_host() + "%s" % request.get_full_path() channel_uuid = kwargs.get("uuid") call_sid = self.get_param("CallSid") direction = self.get_param("Direction") status = self.get_param("CallStatus") to_number = self.get_param("To") to_country = self.get_param("ToCountry") from_number = self.get_param("From") # Twilio sometimes sends un-normalized numbers if to_number and not to_number.startswith("+") and to_country: # pragma: no cover to_number, valid = URN.normalize_number(to_number, to_country) # see if it's a twilio call being initiated if to_number and call_sid and direction == "inbound" and status == "ringing": # find a channel that knows how to answer twilio calls channel = self.get_ringing_channel(uuid=channel_uuid) if not channel: response = VoiceResponse() response.say("Sorry, there is no channel configured to take this call. Goodbye.") response.hangup() return HttpResponse(str(response)) org = channel.org if self.get_channel_type() == "T" and not org.is_connected_to_twilio(): return HttpResponse("No Twilio account is connected", status=400) client = self.get_client(channel=channel) validator = RequestValidator(client.auth[1]) signature = request.META.get("HTTP_X_TWILIO_SIGNATURE", "") url = "https://%s%s" % (request.get_host(), request.get_full_path()) if validator.validate(url, request.POST, signature): from temba.ivr.models import IVRCall # find a contact for the one initiating us urn = URN.from_tel(from_number) contact, urn_obj = Contact.get_or_create(channel.org, urn, channel) flow = Trigger.find_flow_for_inbound_call(contact) if flow: call = IVRCall.create_incoming(channel, contact, urn_obj, channel.created_by, call_sid) session = FlowSession.create(contact, connection=call) call.update_status( request.POST.get("CallStatus", None), request.POST.get("CallDuration", None), "T" ) call.save() FlowRun.create(flow, contact, session=session, connection=call) response = Flow.handle_call(call) return HttpResponse(str(response)) else: # we don't have an inbound trigger to deal with this call. response = channel.generate_ivr_response() # say nothing and hangup, this is a little rude, but if we reject the call, then # they'll get a non-working number error. We send 'busy' when our server is down # so we don't want to use that here either. response.say("") response.hangup() # if they have a missed call trigger, fire that off Trigger.catch_triggers(contact, Trigger.TYPE_MISSED_CALL, channel) # either way, we need to hangup now return HttpResponse(str(response)) # check for call progress events, these include post-call hangup notifications if request.POST.get("CallbackSource", None) == "call-progress-events": if call_sid: from temba.ivr.models import IVRCall call = IVRCall.objects.filter(external_id=call_sid).first() if call: call.update_status( request.POST.get("CallStatus", None), request.POST.get("CallDuration", None), "TW" ) call.save() return HttpResponse("Call status updated") return HttpResponse("No call found") return HttpResponse("Not Handled, unknown action", status=400) # pragma: no cover
from twilio.twiml.voice_response import VoiceResponse, Say response = VoiceResponse() response.say('Chapeau!', voice='woman', language='fr') print(response)
from twilio.twiml.voice_response import VoiceResponse, Say response = VoiceResponse() response.say('Hej!', language='sv-SE') print(response)
from twilio.twiml.voice_response import VoiceResponse, Say, Sms response = VoiceResponse() response.say('Our store is located at 123 Easy St.') response.sms( 'Store Location: 123 Easy St.', action='/smsHandler.php', method='POST' ) print(response)
from twilio.twiml.voice_response import Dial, VoiceResponse, Say response = VoiceResponse() response.dial('415-123-4567', action='/handleDialCallStatus.php', method='GET') response.say('I am unreachable') print(response)
from twilio.twiml.voice_response import VoiceResponse, Say response = VoiceResponse() response.say('You will now be connected to an agent.') print(response)
from twilio.twiml.voice_response import Dial, VoiceResponse, Say response = VoiceResponse() response.dial('415-123-4567') response.say('Goodbye') print(response)
def hello_monkey(): """Respond to incoming calls with a simple text message.""" resp = VoiceResponse() resp.say("Hello from your pals at Twilio! Have fun.") return str(resp)
from twilio.twiml.voice_response import Pause, VoiceResponse, Say response = VoiceResponse() response.say('I will pause 10 seconds starting now!') response.pause(length=10) response.say('I just paused 10 seconds') print(response)