本文整理汇总了Python中twilio.twiml.Response.gather方法的典型用法代码示例。如果您正苦于以下问题:Python Response.gather方法的具体用法?Python Response.gather怎么用?Python Response.gather使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twilio.twiml.Response
的用法示例。
在下文中一共展示了Response.gather方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_third_response
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def handle_third_response(request):
digits = request.POST.get('Digits', '')
twilio_response_three=Response()
#twilio_response_three.say(digits)
twilio_response_three.play('http://travellingscholar.com/ammi/message6.mp3')
twilio_response_three.gather(action='respond4', numDigits=1)
return twilio_response_three
示例2: handle_call
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def handle_call(request):
r = Response()
if request.GET['key'] == settings.TWILIO_KEY:
kwargs = {'text':settings.GREETINGS, 'voice':None, 'language':None, 'loop':None}
r.say(**kwargs)
kwargs = {'action':settings.BASE_URL+'call_reference/?key='+request.GET['key'], 'method':'POST', 'timeout':settings.TWILIO_TIMEOUT, 'finish_on_key':settings.TWILIO_FINISHKEY}
r.gather(**kwargs)
return r
示例3: voice
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def voice(request):
"""Create a Twilio response object which gathers the callers input"""
r = Response()
with r.gather(action='/respond/') as g:
g.say('Please enter a number to play phone buzz. Press the pound key when finished.', voice='woman')
g.pause(length=10)
return r
示例4: ring
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def ring(request):
twilio_response = Response()
message = 'Welcome to Fizz Buzz! Press up to three digits to start playing.'
with twilio_response.gather(action='/response/', numDigits=3) as g:
g.say(message)
g.pause(length=1.5)
g.say(message)
return twilio_response
示例5: gather
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather(request, action=None, method='POST', num_digits=None, timeout=None,
finish_on_key=None):
"""See: http://www.twilio.com/docs/api/twiml/gather.
Usage::
# urls.py
urlpatterns = patterns('',
# ...
url(r'^gather/$', 'django_twilio.views.gather'),
# ...
)
"""
r = Response()
r.gather(action=action, method=method, numDigits=num_digits,
timeout=timeout, finishOnKey=finish_on_key)
return r
示例6: gather_digits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather_digits(request):
twilio_response=Response()
with twilio_response.gather(action='https://www.twilio.com/blog/respond/', numDigits=1) as g:
g.say('Press one for a song, two to recieve an sms')
g.pause(length=1)
g.say('Press one for a song, two to recieve an sms')
return twilio_response
示例7: receiveDigits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def receiveDigits(request):
"Once the call has been made, this presents the user with an automated greeting"
greeting = "Please press a number that would you like fizzbuzzed. Note, for your own convenience, keep the number 2 digits or less."
returnMessage = Response()
#Use <Gather> to collect digits that a caller enters into his or her telephone keypad. The data is then submitted.
with returnMessage.gather(action='/respond/', numDigits=2) as initialGreeting:
initialGreeting.say(greeting)
initialGreeting.pause(length=3)
return returnMessage
示例8: gather_digits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather_digits(request):
twilio_response = Response()
try:
with twilio_response.gather(action='/phonebuzz/respond/', numDigits=3, finish_on_key='#') as g:
g.say('Enter your FizzBuzz Number followed by a pound')
except:
return HttpResponseBadRequest
return twilio_response
示例9: get
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def get(self, request):
call, _ = ClientCall.objects.get_or_create(sid=request.GET["CallSid"])
call.request_bed_count()
r = Response()
r.say("How many beds do you need tonight?")
with r.gather(finishOnKey="#", method="POST", action=reverse("phone:bed_count"), numdigits=1) as g:
g.say("Press a number, then press pound")
return r
示例10: gather_digits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather_digits(request):
twilio_response = Response()
with twilio_response.gather(action='/respond/', numDigits=1) as g:
g.say('Press one to Notify Yaser, or press two to notify Nazih')
g.pause(length=1)
g.say('Press one to notify Yaser, or press two to notify Nazih')
return twilio_response
示例11: gather_digits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather_digits(request):
twilio_response = Response()
with twilio_response.gather(action='/respond/', numDigits=1) as g:
g.say('Press one to hear a song, two to receive an SMS')
g.pause(length=1)
g.say('Press one to hear a song, two to receive an SMS')
return twilio_response
示例12: gather_digits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather_digits(request):
msg = 'Oye. Press a number to enter the world of Fizz Buzz. You can press maximum two digits'
twilio_response = Response()
with twilio_response.gather(action='/respond/', numDigits=2) as g:
g.say(msg)
g.pause(length=1)
g.say(msg)
return twilio_response
示例13: gather_digits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather_digits(request):
twilio_response = Response()
twilio_response.play('http://travellingscholar.com/ammi/message1.mp3')
twilio_response.play('http://travellingscholar.com/ammi/message2.mp3')
with twilio_response.gather(action='respond', numDigits=1) as g:
#g.say('Assalaam walaikum, Ammi Tips par khush amdeed')
#g.say(request)
g.pause(length=1)
return twilio_response
示例14: gather_digits
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def gather_digits(request):
msg = 'Press one to hear a song, two to receive an SMS, three to record a message.'
twilio_response = Response()
with twilio_response.gather(action='/respond_digits/', numDigits=1) as g:
g.say(msg)
g.pause(length=3)
g.say(msg)
return twilio_response
示例15: login
# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import gather [as 别名]
def login(request):
r = Response()
with r.gather(
numDigits=6,
timeout=10,
finishOnKey='*',
action=reverse('twiliorouter:handle_login'), method='POST'
) as g:
g.say(
'please enter your 6 digit phone number to continue'
)
return r