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


Python VoiceResponse.dial方法代码示例

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


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

示例1: get_voice_twiml

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [as 别名]
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,代码行数:12,代码来源:response-twiml-dial.6.x.py

示例2: dial

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [as 别名]
def dial(request, number, action=None, method='POST', timeout=None,
         hangup_on_star=None, time_limit=None, caller_id=None):
    """
    See: http://www.twilio.com/docs/api/twiml/dial.

    Usage::

        # urls.py
        urlpatterns = patterns('',
            # ...
            url(r'^dial/?(P<number>\w+)/$', 'django_twilio.views.dial'),
            # ...
        )
    """
    r = VoiceResponse()
    r.dial(number=number, action=action, method=method, timeout=timeout,
           hangup_on_star=hangup_on_star, time_limit=time_limit,
           caller_id=caller_id)
    return r
开发者ID:boardman,项目名称:django-twilio,代码行数:21,代码来源:views.py

示例3: handle_gather

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [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("/")
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:24,代码来源:twiml-record.6.x.py

示例4: conference

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [as 别名]
def conference(request, number, 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()
    r.dial(number=number).conference(name=name, muted=muted, beep=beep,
                                     startConferenceOnEnter=start_conference_on_enter,
                                     endConferenceOnExit=end_conference_on_exit,
                                     waitUrl=wait_url, waitMethod=wait_method,
                                    )
    return r
开发者ID:boardman,项目名称:django-twilio,代码行数:25,代码来源:views.py

示例5: voice

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [as 别名]
def voice():
    dest_number = request.values.get('PhoneNumber', None)
    default_client = request.values.get('PhoneNumber', None)
    resp = VoiceResponse()
    # item = request.values.get('item', None)
    # name = request.values.get('name', None)
 
    with resp.dial(callerId=caller_id, record='true') as r:

    # If we have a number, and it looks like a phone number:
        if dest_number and re.search('^[\d\(\)\- \+]+$', dest_number): 
            r.number(dest_number)
        else:
            r.client(default_client)
    return str(resp)
开发者ID:SeekTom,项目名称:Twilio-Client-Python-dialer,代码行数:17,代码来源:run.py

示例6: VoiceResponse

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [as 别名]
from twilio.twiml.voice_response import Dial, VoiceResponse, Say

response = VoiceResponse()
response.dial('415-123-4567')
response.say('Goodbye')

print(response)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:9,代码来源:dial-2.6.x.py

示例7: VoiceResponse

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [as 别名]
from twilio.twiml.voice_response import Dial, VoiceResponse, Say

response = VoiceResponse()
response.dial('415-123-4567', action='/handleDialCallStatus.php', method='GET')
response.say('I am unreachable')

print(response)
开发者ID:GilbertoBotaro,项目名称:api-snippets,代码行数:9,代码来源:dial-3.6.x.py

示例8: call

# 需要导入模块: from twilio.twiml.voice_response import VoiceResponse [as 别名]
# 或者: from twilio.twiml.voice_response.VoiceResponse import dial [as 别名]
def call():
    resp = VoiceResponse()
    with resp.dial(callerId=caller_id, record='true') as r:
      r.client('TomPY')
    return str(resp)   
开发者ID:SeekTom,项目名称:Twilio-Client-Python-dialer,代码行数:7,代码来源:run.py


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