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


Python voice_response.VoiceResponse类代码示例

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


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

示例1: voice

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)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:7,代码来源:example-1.6.x.py

示例2: generate_wait

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)
开发者ID:TwilioDevEd,项目名称:warm-transfer-flask,代码行数:7,代码来源:twiml_generator.py

示例3: verb_view

def verb_view(request):
    """
    A simple test view that returns a ``twilio.Verb`` object.
    """
    r = VoiceResponse()
    r.reject()
    return r
开发者ID:rdegges,项目名称:django-twilio,代码行数:7,代码来源:views.py

示例4: incoming_call

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)
开发者ID:TwilioDevEd,项目名称:task-router-django,代码行数:7,代码来源:views.py

示例5: conference

def conference(request, name, muted=None, beep=None,
               start_conference_on_enter=None, end_conference_on_exit=None,
               wait_url=None, wait_method='POST', max_participants=None):
    """
See: http://www.twilio.com/docs/api/twiml/conference.

Usage::

    # urls.py
    urlpatterns = patterns('',
        # ...
        url(r'^conference/(?P<name>\w+)/$', 'django_twilio.views.conference',
                {'max_participants': 10}),
        # ...
    )
    """
    r = VoiceResponse()
    dial = Dial()
    dial.conference(name=name, muted=muted, beep=beep,
                    startConferenceOnEnter=start_conference_on_enter,
                    endConferenceOnExit=end_conference_on_exit,
                    waitUrl=wait_url, waitMethod=wait_method,
                    )
    r.append(dial)
    return r
开发者ID:rdegges,项目名称:django-twilio,代码行数:25,代码来源:views.py

示例6: call_status_update_callback

def call_status_update_callback(request):
    call_data = request.GET
    logger.debug(call_data['employee'])
    try:
        user = User.objects.get(pk=call_data['employee'])
    except Exception as e:
        user = User.objects.get(pk=1)
        logger.warn(e)
        Log.objects.create(type="Call Summary Error (Getting User)", 
                           message=e,
                           user=user)

    try:
        call_log = Call.objects.get(twilio_id=call_data.get('ParentCallSid', 0))
    except Exception as e:
        logger.debug(e)
        logger.debug("New Call Created")
        call_log = Call()

    call_log.twilio_id = request.GET.get(u'ParentCallSid', call_log.twilio_id)
    call_log.type = call_log.type or call_data.get('Direction', call_log.type) 
    call_log.incoming_number = call_log.incoming_number or call_data.get('From', call_log.incoming_number)
    call_log.employee = user
    call_log.save()

    resp = VoiceResponse()
    resp.hangup()
    return HttpResponse(resp)
开发者ID:charliephairoj,项目名称:backend,代码行数:28,代码来源:views.py

示例7: get_voice_twiml

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')
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:7,代码来源:response-twiml.6.x.py

示例8: generate_connect_conference

def generate_connect_conference(call_sid, wait_url, start_on_enter, end_on_exit):
    twiml_response = VoiceResponse()
    dial = Dial()
    dial.conference(call_sid,
                    start_conference_on_enter=start_on_enter,
                    end_conference_on_exit=end_on_exit,
                    wait_url=wait_url)
    return str(twiml_response.append(dial))
开发者ID:TwilioDevEd,项目名称:warm-transfer-flask,代码行数:8,代码来源:twiml_generator.py

示例9: voice

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)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:9,代码来源:example.6.x.py

示例10: get_voice_twiml

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')
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:10,代码来源:response-twiml-dial.6.x.py

示例11: gather

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)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:26,代码来源:example.6.x.py

示例12: test

def test(request):
    resp = VoiceResponse()

    gather = Gather(action="/api/v1/ivr/test/route_call/", method="POST", num_digits=1, timeout=10)
    gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-welcome.mp3")
    gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-sales.mp3")
    gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-customer-service.mp3")
    gather.play(url="https://s3-ap-southeast-1.amazonaws.com/media.dellarobbiathailand.com/ivr/audio-accounting.mp3")
    resp.append(gather)

    return HttpResponse(resp)
开发者ID:charliephairoj,项目名称:backend,代码行数:11,代码来源:views.py

示例13: voice

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)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:12,代码来源:example-1.6.x.py

示例14: enqueue

def enqueue(request):
    """ Parses a selected product, creating a Task on Task Router Workflow """
    resp = VoiceResponse()
    digits = request.POST['Digits']
    selected_product = 'ProgrammableSMS' if digits == '1' else 'ProgrammableVoice'
    task = '{"selected_product": "%s"}' % selected_product

    resp.enqueue(None,
                 workflowSid=WORKSPACE_INFO.workflow_sid,
                 task=task)

    return HttpResponse(resp)
开发者ID:TwilioDevEd,项目名称:task-router-django,代码行数:12,代码来源:views.py

示例15: gatekeeper

    def gatekeeper():
        logger.info("Call started: %s", request.values)

        response = VoiceResponse()

        if 'notFirstCall' not in request.values:
            # Accept Google voice call
            response.play(digits='1')

        add_gandalf_to_response(response)

        return str(response)
开发者ID:jfly,项目名称:gatekeeper,代码行数:12,代码来源:routes.py


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