本文整理汇总了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
示例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
示例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