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
def notify_call(request, notification_uuid): r = Response() try: notification = Notification.objects.get(uuid=notification_uuid) except Notification.DoesNotExist: return r r.say("This is an oncaller notification.") message = notification.message if message: r.say(message, loop=2) #duke! r.play('http://dev.oncallr.com/static/audio/b2w.mp3') r.pause(length=1) r.say("Hit 1 to acknowledge, 2 to reject.", voice="woman") r.gather(action="http://www.oncallr.com/notification/call/response/{0}/".format(notification_uuid), method="POST", numDigits=1, timeout=2, finishOnKey=None) r.redirect(url="http://www.oncallr.com/notification/call/response/{0}/".format(notification_uuid), method="POST") return r