Ejemplo n.º 1
0
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='cidmodem')

        # Configuration
        self._config = Query(self.myxpl, self.log)
        device = self._config.query('cidmodem', 'device')

        cid_command = self._config.query('cidmodem', 'cid-command')

        # Init Modem
        cid  = CallerIdModem(self.log, self.send_xpl)
        
        # Open Modem
        try:
            cid.open(device, cid_command)
        except CallerIdModemException as e:
            self.log.error(e.value)
            print(e.value)
            self.force_leave()
            return
            
        # Start reading Modem
        cid_process = threading.Thread(None,
                                   cid.listen,
                                   "listen_cid",
                                   (),
                                   {})                                  
        cid_process.start()                              
        self.enable_hbeat()
Ejemplo n.º 2
0
    def __init__(self):
        """ Init plugin
        """
        XplPlugin.__init__(self, name='cidmodem')

        # Configuration
        self._config = Query(self.myxpl, self.log)
        device = self._config.query('cidmodem', 'device')

        cid_command = self._config.query('cidmodem', 'cid-command')

        # Init Modem
        cid = CallerIdModem(self.log, self.send_xpl)

        # Open Modem
        try:
            cid.open(device, cid_command)
        except CallerIdModemException as e:
            self.log.error(e.value)
            print(e.value)
            self.force_leave()
            return

        # Start reading Modem
        cid_process = threading.Thread(None, cid.listen, "listen_cid", (), {})
        cid_process.start()
        self.enable_hbeat()
Ejemplo n.º 3
0
    def read(self, args=None):
        """ Read Modem until an inbound call
        """

        # Init Mir:ror
        cid = CallerIdModem(self._log, None)

        # Open Modem
        try:
            cid.open(args[0])
        except CallerIdModemException as err:
            return [err.value]

        # read Modem
        while True:
            num = cid.read()
            if num != None:
                break

        # Close Modem
        try:
            cid.close()
        except CallerIdModemException as err:
            return [err.value]

        return ["Phone number : %s" % num]
Ejemplo n.º 4
0
    def read(self, args = None):
        """ Read Modem until an inbound call
        """

        # Init Mir:ror
        cid  = CallerIdModem(self._log, None)
        
        # Open Modem
        try:
            cid.open(args[0])
        except CallerIdModemException as err:
            return [err.value]
            
        # read Modem
        while True:
            num = cid.read()
            if num != None:
                break

        # Close Modem
        try:
            cid.close()
        except CallerIdModemException as err:
            return [err.value]

        return ["Phone number : %s" % num]