本文整理汇总了Python中twilio.twiml.voice_response.VoiceResponse.record方法的典型用法代码示例。如果您正苦于以下问题:Python VoiceResponse.record方法的具体用法?Python VoiceResponse.record怎么用?Python VoiceResponse.record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twilio.twiml.voice_response.VoiceResponse
的用法示例。
在下文中一共展示了VoiceResponse.record方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_valid
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
def post_valid(self, request):
"""Expects a POST request from Twilio, and return a response directing
Twilio to play the greeting mp3 and post the recorded response to
the handle voicemail URL
"""
response = VoiceResponse()
self.static_greeting_path = static(self.voicemail_static_path)
self.record_voicemail_url = request.build_absolute_uri(
reverse('phone-handle_new_message')).replace('http:', 'https:')
response.play(self.static_greeting_path)
response.record(action=self.record_voicemail_url, method='POST')
return HttpResponse(response)
示例2: voice_twiml
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [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: record
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
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)
示例4: record
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
def record(request, action=None, method='POST', timeout=None,
finish_on_key=None, max_length=None, transcribe=None,
transcribe_callback=None, play_beep=None):
"""
See: http://www.twilio.com/docs/api/twiml/record.
Usage::
# urls.py
urlpatterns = patterns('',
# ...
url(r'^record/$', 'django_twilio.views.record'),
# ...
)
"""
r = VoiceResponse()
r.record(action=action, method=method, timeout=timeout,
finish_on_key=finish_on_key, max_length=max_length,
transcribe=transcribe, transcribe_callback=transcribe_callback,
play_beep=play_beep)
return r
示例5: handle_gather
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
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("/")
示例6: VoiceResponse
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
from twilio.twiml.voice_response import Record, VoiceResponse
response = VoiceResponse()
response.record(transcribe=True, transcribe_callback='/handle_transcribe.php')
print(response)
示例7: VoiceResponse
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
from twilio.twiml.voice_response import Record, VoiceResponse
response = VoiceResponse()
response.record(timeout=10, transcribe=True)
print(response)
示例8: VoiceResponse
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
from twilio.twiml.voice_response import Record, VoiceResponse
response = VoiceResponse()
response.record()
print(response)
示例9: VoiceResponse
# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import record [as 别名]
from twilio.twiml.voice_response import Record, VoiceResponse, Say
response = VoiceResponse()
response.say(
'Please leave a message at the beep.\nPress the star key when finished.'
)
response.record(
action='http://foo.edu/handleRecording.php',
method='GET',
max_length=20,
finish_on_key='*'
)
response.say('I did not receive a recording')
print(response)