Exemplo n.º 1
0
 def GET(self):
     web.header('Content-Type', 'text/xml')
     callerid = web.input().Caller
     logging.info('phone number %s making call' % callerid)
     
     #check to see if we should reject this person
     rejectee = RejectList.gql('WHERE rejectee = :number', number=callerid).get()
     if rejectee is not None:
         user_info = UserInfo.gql('WHERE user = :u', u=rejectee.user).get()
         if user_info is None:
             logging.error('rejectee should have a reject message')
             return util.twilio_default_reject()
         else:
             logging.info('rejecting %s' % rejectee.rejectee)
             return util.twilio_reject(user_info.reject_message)
     
     #gather information to make a 'anonymous' phone call to the rejectee
     #if the phone number is a registered user
     user_info = UserInfo.gql('WHERE phone = :p', p=callerid).get()
     if user_info is not None:
         logging.info('phone number %s is about to add a rejectee' % callerid)
         return util.twilio_gather_reject()
   
     #person is not registered give them web address to sign up
     return util.twilio_say_visit_site()
Exemplo n.º 2
0
 def GET(self):
     web.header('Content-Type', 'text/xml')
     callerid = web.input().Caller
     digits = web.input().Digits
     user_info = UserInfo.gql('WHERE phone = :p', p=callerid).get()
     if user_info is not None:
         #record rejectee number
         reject = RejectList(user=user_info.user, rejectee=digits)
         reject.put()
         #make the call to the rejectee
         return util.twilio_make_call(digits)
     else:
         return util.twilio_say_visit_site()