本文整理汇总了Python中twilio.twiml.voice_response.VoiceResponse.gather方法的典型用法代码示例。如果您正苦于以下问题:Python VoiceResponse.gather方法的具体用法?Python VoiceResponse.gather怎么用?Python VoiceResponse.gather使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twilio.twiml.voice_response.VoiceResponse
的用法示例。
在下文中一共展示了VoiceResponse.gather方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: incoming_call
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import gather [as 别名]
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)
示例2: voice_twiml
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import gather [as 别名]
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)
示例3: gather
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse 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 = VoiceResponse()
r.gather(action=action, method=method, num_digits=num_digits,
timeout=timeout, finish_on_key=finish_on_key)
return r
示例4: voice
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import gather [as 别名]
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)
示例5: VoiceResponse
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import gather [as 别名]
from twilio.twiml.voice_response import Gather, VoiceResponse
response = VoiceResponse()
response.gather()
print(response)