def connect(number): """Add @number to the set of waiting callers.""" r.sadd('waiting', number) ok = linkup() if not ok: return build_sms("Please wait, you will be connected to a random person...") return ""
def call(number): """@number wishes to share the number with the other person.""" if not r.exists(number): return build_sms("Error: You haven't connected to anyone yet.") peer_number = r.get(number) send_sms(peer_number, "The other person has shared their number: %s" % (number)) return ""
def connect(number): """Add @number to the set of waiting callers.""" r.sadd('waiting', number) ok = linkup() if not ok: return build_sms( "Please wait, you will be connected to a random person...") return ""
def disconnect(number): """Remove @number from the set of waiting callers.""" r.srem('waiting', number) peer = r.get(number) r.delete(number) if peer: r.delete(peer) send_sms(peer, "Your peer disconnected.") return build_sms("You've been disconnected and will no longer receive messages.")
def disconnect(number): """Remove @number from the set of waiting callers.""" r.srem('waiting', number) peer = r.get(number) r.delete(number) if peer: r.delete(peer) send_sms(peer, "Your peer disconnected.") return build_sms( "You've been disconnected and will no longer receive messages.")
def make_sms_response(text): response = make_response(build_sms(text)) response.headers['Content-Type'] = 'text/xml' return response