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


Python Response.hangup方法代码示例

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


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

示例1: confirm_call

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import hangup [as 别名]
def confirm_call(request, notification_uuid):
    r = Response()

    try:
        notification = Notification.objects.get(uuid=notification_uuid)
    except Notification.DoesNotExist:
        return r

    digits = request.POST.get("Digits", None)
    call_sid = request.POST.get("CallSid", None)

    notification.recipient_status = REJECTED

    if digits is None:
        r.say("No response detected. Assuming rejection. Good bye.", voice="woman")
    elif '1' in digits:
        r.say("You have acknowledged this notification. Thank You.", voice="woman")
        notification.recipient_status = ACK
    elif '2' in digits:
        r.say("You have rejected this notification. Good bye.", voice="woman")
    else:
        r.say("Invalid Selection. Rejecting Response. Good bye.", voice="woman")

    r.hangup()

    notification.save()
    return r
开发者ID:kylestoneman,项目名称:killitwithfire,代码行数:29,代码来源:views.py

示例2: get_phone_score

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import hangup [as 别名]
def get_phone_score(request):
    r = Response()
    team_id = request.POST['Digits']
    try:
        team = Team.objects.get(pk=team_id)
        scores = Score.objects.filter(team=team)
        r.say("Scores for team, "+team.name,voice='woman',language='en-gb')
        r.pause(length=2)
       
        for score in scores:
            r.say('For Event "'+score.event.name + '", You have ' + str(score.score) + ' points. ',voice='woman',language='en-gb')
            r.pause(length=1)
        
        r.say("Thank you for calling. Goodbye!",voice='woman',language='en-gb')
        r.hangup()
        
    except Team.DoesNotExist:    
        r.say("We're sorry, The team number entered does not exist.")
    return r
开发者ID:hgrimberg01,项目名称:esc,代码行数:21,代码来源:views.py

示例3: twilio_call_input

# 需要导入模块: from twilio.twiml import Response [as 别名]
# 或者: from twilio.twiml.Response import hangup [as 别名]
def twilio_call_input(request, call_id):
	report = get_object_or_404(WhipReport, id=int(call_id))
	digit = request.POST["Digits"]

	report.call_log["input"] = dict(request.POST)
	report.call_log["input"]["_request"] = get_request_log_info(request)

	resp = TwilioResponse()

	if digit != "1":
		# basically an abuse report
		report.call_log["input"]["response"] = "did-not-request-call"
		resp.say("We apologize for the inconvenience. Call 202-558-7227 or visit w w w dot gov track dot u s to report abuse. Good bye.")
		resp.hangup()

	elif settings.DEBUG:
		resp.say("Site is in debug mode. Call cancelled.")
		resp.hangup()

	else:
		phone = "+1" + "".join(c for c in report.target.phone if unicode.isdigit(c))

		report.call_log["input"]["response"] = "continue"
		report.call_log["input"]["transfer_to"] = phone

		resp.say("Okay. Hold on.")
		resp.dial(
			phone,
            action=build_twilio_callback_url(request, report, "call-transfer-end"),
            timeout=30,
            callerId=request.POST["To"],
            record=True,
			)

	report.call_status = "connecting"
	report.save()

	return resp
开发者ID:SPRIME01,项目名称:govtrack.us-web,代码行数:40,代码来源:views.py


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