Ejemplo n.º 1
0
    def post(self):
        sender = self.get_argument("sender", None)
        recipient = self.get_argument("recipient")
        text = self.get_argument("text")
        imsi = self.get_argument("imsi", None)
        key = self.get_argument("key", None)

        if not ((sender is None) ^ (imsi is None)):
            err_msg = 'Use either "sender" or "imsi" params'
            raise HTTPError(400, err_msg)

        sim_manager.send(TxSmsReq(sender, recipient, text, imsi, key, callback=self.reply_callback))
Ejemplo n.º 2
0
 def register(self):
     assert self.sim_config is None
     sim_manager.send(ImsiRegister(self))
     registration = self.receive(typ=ImsiRegistration)
     if registration.success:
         self.sim_config = registration.config
         if self.sim_config.is_startable:
             return self.work
         else:
             return self.stop
     else:
         return self.deactivate
Ejemplo n.º 3
0
 def _unregister(self):
     if self.sim_config is not None:
         sim_manager.send(ImsiUnregister(self))
         self.sim_config = None