当前位置: 首页>>代码示例>>Python>>正文


Python Response.record方法代码示例

本文整理汇总了Python中twilio.twiml.Response.record方法的典型用法代码示例。如果您正苦于以下问题:Python Response.record方法的具体用法?Python Response.record怎么用?Python Response.record使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twilio.twiml.Response的用法示例。


在下文中一共展示了Response.record方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle_connect

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
def handle_connect(request):
    recipient_number = request.POST.get('Digits', '')
    r = Response()
    if 'visitor' in request.session:
        try:
            recipient = Visitor.objects.get(access_code=recipient_number)
            request.session['recipient'] = {
                'id': recipient.id,
                'name': recipient.user.first_name,
                'number': recipient.access_code
            }
            # record a message
            r.say(
                'The person you tried to call is unavailable. Please leave a message')
            r.record(maxLength=30, action=reverse(
                'twiliorouter:handle_record')
            )
        except Visitor.DoesNotExist:
            request.session['welcome_message'] = 'Number not recognised'
            r.redirect(reverse('twiliorouter:connect'))
    else:
        request.session[
            'welcome_message'] = 'You need to enter your phone number'
        r.redirect(reverse('twiliorouter:welcome'))
    return r
开发者ID:jamieingram,项目名称:twilio_switchboard,代码行数:27,代码来源:views.py

示例2: handle_response_digits

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
def handle_response_digits(request):
 
    twilio_request = decompose(request)
    digits = twilio_request.digits

    twilio_response = Response()
 
    if digits == '2':
        # twilio_response.play('http://bit.ly/phaltsw')
        number = request.POST.get('From', '')
        twilio_response.say('A text message is on its way. Daaaaaaaaaaaaaaamn Daniel! Peace out yo')
        twilio_response.sms('Daaaaaaaaaaaaaaamn Daniel!', to=number)
 
    elif digits == '1':
        # twilio_response.play('http://bit.ly/phaltsw')
        # twilio_response.play('https://p.scdn.co/mp3-preview/934da7155ec15deb326635d69d050543ecbee2b4')
        # twilio_response.play('https://p.scdn.co/mp3-preview/934da7155ec15deb326635d69d050543ecbee2b4')
        twilio_response.play('https://demo.twilio.com/hellomonkey/monkey.mp3')
        
        # number = request.POST.get('From', '')
        # twilio_response.say('I got you bruh, sending you a text in a bit. PEACE!')
        # twilio_response.sms('You looking lovely today!', to=number)

    elif digits == "3":
        twilio_response.say("Record your monkey howl after the tone.")
        twilio_response.record(maxLength="5", action="/handle_recording")

    # If the caller pressed invalid input
    else:
        # twilio_response.say('Incorrect Number Pressed')
        return redirect("/gather")
 
    return twilio_response
开发者ID:kishan,项目名称:Django_Twilio_Project,代码行数:35,代码来源:views.py

示例3: handle_selection

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
def handle_selection(request, slug):

    voicemailbox = get_object_or_404(VoicemailBox, slug=slug)

    chunk = voicemailbox.work.chunk_set.filter(number=request.POST.get('Digits'))

    if chunk.chunksubmission:


    r = Response()
    r.say(
        "Thank you. "
        "Please start reading, "
        "when you are done, you can hang up. "
    )
    
    action = reverse('handle-recording', kwargs={'slug': slug})

    r.record(action=action, timeout=20, maxLength=360, playBeep=True)


@csrf_exempt
def handle_recording(request, slug=None):

    voicemailbox = get_object_or_404(VoicemailBox, slug=slug)

    voicemailbox.collection.add_voicemail(
        audio_url=request.POST.get('RecordingUrl'),
        title='recorded in %s for %s' % (location, voicemailbox.target_location),
        location=voicemailbox.target_location,
    )
    return HttpResponse()
开发者ID:orzubalsky,项目名称:invisible,代码行数:34,代码来源:views.py

示例4: gather

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
def gather(request):

    logger.debug("Calling gather")
    d = request.GET.get("Digits")
    logger.debug("Digit Pressed= %s" % d)
    try:
        r = Response()
        if d == "1":
            r.say("You pressed 1")
            try:
                api = twitter.Api()
                statuses = api.GetUserTimeline("diarmuid")

                r.say(statuses[0].text)
            except Exception, ex:
                logger.debug(ex)
                r.say("Error getting twitter results")
            r.redirect(reverse("calls_hello"))
            return r
        elif d == "2":
            r.say("You pressed 2")
            r.say("Record your message after the tone.")

            r.record(maxLength="10", action=reverse("calls_record"))
            return r
开发者ID:diarmuidw,项目名称:laterview,代码行数:27,代码来源:views.py

示例5: echo

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
def echo(request):
    response = Response()
    if request.method == 'POST':
        response.play(request.POST['RecordingUrl'])
    else:
        response.say("Echo test", voice='woman')
        response.record()
    return response
开发者ID:gnublade,项目名称:echoic,代码行数:10,代码来源:views.py

示例6: get

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
    def get(self, request):
        call, _ = ClientCall.objects.get_or_create(sid=request.GET["CallSid"])
        call.request_name()

        r = Response()

        r.say("""Please speak your name. This will help identify you when you arrive.""")
        r.record(action=reverse("phone:collect_name"), method="POST", maxLength=10, timeout=15)

        return r
开发者ID:pombredanne,项目名称:continuum,代码行数:12,代码来源:views.py

示例7: record

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
def record(request):
    response = Response()
    if request.method == 'POST':
        from_number = request.POST['From']
        try:
            user = User.objects.get(userprofile__phone_number=from_number)
        except User.DoesNotExist:
            user = User.objects.create(username=from_number)
            UserProfile.objects.create(user=user, phone_number=from_number)
        record = Recording.objects.create(
            url=request.POST['RecordingUrl'],
            duration=request.POST['RecordingDuration'],
            recorded_by=user,
        )
        response.say("Thankyou and goodbye", voice='female')
    else:
        response.record()
    return response
开发者ID:gnublade,项目名称:echoic,代码行数:20,代码来源:views.py

示例8: record

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response 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 = Response()
    r.record(action=action, method=method, timeout=timeout,
             finishOnKey=finish_on_key, maxLength=max_length,
             transcribe=transcribe, transcribeCallback=transcribe_callback,
             playBeep=play_beep)
    return r
开发者ID:EagleInformationMapping,项目名称:Hackathon2014,代码行数:22,代码来源:views.py

示例9: answer

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import record [as 别名]
def answer(request, slug=None, location=None):

    r = Response()
    r.say(
        "Thanks for calling Fantastic Futures, "
        "You are about to record a wonderful sound, "
        "Once you are done, please hang up so your recording "
        "can start its journey to the website."
    )

    action = reverse(
        'handle-recording',
        kwargs={
            'slug': slug,
            'location': location
        }
    )

    r.record(action=action, timeout=240, maxLength=360, playBeep=True)

    return r
开发者ID:orzubalsky,项目名称:fantastic-futures,代码行数:23,代码来源:views.py


注:本文中的twilio.twiml.Response.record方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。