예제 #1
0
    def __init__(self, config=None):
        if config is None:
            config = SMPPClientConfig(host='localhost', port=999, username='******', password='******')

            # Uncomment line below to recv SMS via #322223322 only
            # config = SMPPClientConfig(host='localhost', port=999, username='******', password='******', addressTon=AddrTon.UNKNOWN, addressNpi=AddrNpi.ISDN, addressRange='^322223322$')
        self.config = config
예제 #2
0
 def __init__(self, config=None):
     if config is None:
         config = SMPPClientConfig(host='localhost',
                                   port=8007,
                                   username='******',
                                   password='******')
     self.config = config
예제 #3
0
 def getProtocolObject(self):
     smpp = SMPPClientProtocol()
     config = SMPPClientConfig(
         host='localhost',
         port=82,
         username='',
         password='',
     )
     smpp.config = Mock(return_value=config)
     return smpp
예제 #4
0
    def setUp(self):
        self.factory = Factory()
        self.factory.protocol = self.protocol
        self.port = reactor.listenTCP(0, self.factory)
        self.testPort = self.port.getHost().port

        args = self.configArgs.copy()
        args['host'] = self.configArgs.get('host', 'localhost')
        args['port'] = self.configArgs.get('port', self.testPort)
        args['username'] = self.configArgs.get('username', '')
        args['password'] = self.configArgs.get('password', '')

        self.config = SMPPClientConfig(**args)
예제 #5
0
파일: ussd.py 프로젝트: usayplz/Subs
    if pid.check_pid(int(pid.read_pid(PID))):
        print "Already running %s" % (PID, )
        exit(0)
    else:
        pid.write_pid(PID)

    # logger
    log_file = os.path.join(
        os.path.dirname(__file__), 'logs',
        '%s_%s' % (datetime.date.today().strftime('%d%m%Y'), 'ussd.log'))
    logging.basicConfig(level=logging.INFO,
                        format="%(asctime)-15s %(levelname)s %(message)s",
                        filename=log_file)
    logger = logging.getLogger(__name__)
    logger.critical = critical

    # start
    logger.info('[START PROGRAM]')
    db_config = DATABASES['default']
    smpp_config = SMPPClientConfig(
        #        host='212.220.125.230', port=4000, username='******', password='******', responseTimerSecs=300, enquireLinkTimerSecs=60,)
        host='91.232.133.144',
        port=3900,
        username='******',
        password='******',
        responseTimerSecs=300,
        enquireLinkTimerSecs=60,
    )
    SMPP(smpp_config, db_config, logger).run()
    reactor.run()
예제 #6
0
파일: sender.py 프로젝트: usayplz/Subs
    reactor.stop()


if __name__ == '__main__':
    # check pid
    PID = 'sender.pid'
    if pid.check_pid(int(pid.read_pid(PID))):
        print "Already running %s" % (PID,)
        exit(0)
    else:
        pid.write_pid(PID)

    # logger
    log_file = os.path.join(os.path.dirname(__file__), 'logs', '%s_%s' % (datetime.date.today().strftime('%d%m%Y'), 'sender.log'))
    logging.basicConfig(
        level=logging.INFO,
        format="%(asctime)-15s %(levelname)s %(message)s",
        filename=log_file
    )
    logger = logging.getLogger(__name__)
    logger.critical = critical

    # start
    logger.info('[START PROGRAM]')
    db_config = DATABASES['default']
    smpp_config = SMPPClientConfig(
#        host='212.220.125.230', port=4000, username='******', password='******', responseTimerSecs=300, )
        host='91.232.133.144', port=3900, username='******', password='******', responseTimerSecs=300, )
    SMPP(smpp_config, db_config, logger).run()
    reactor.run()