コード例 #1
0
        public PMSParser(PBXConfiguration config, ILogger log, IMessageConnectionFactory cf,
                         IApplicationClient ac, IClock c) :
            base(config, log, cf, ac, c)
        {
            var lexer = new PMSByteStreamLexer();

            lexer.EnquireRecieved += EnquireReceived;
            RegisterLexer(lexer);
        }
コード例 #2
0
 protected PBXParser(PBXConfiguration config, ILogger log, IMessageConnectionFactory cf,
                     IApplicationClient ac, IClock c)
 {
     Log                    = log;
     CF                     = cf;
     AC                     = ac;
     C                      = c;
     Transport              = GetConfiguredTransport(log, config);
     Transport.DataArrived += TransportDataArrived;
 }
コード例 #3
0
 private ITransport GetConfiguredTransport(ILogger log, PBXConfiguration config)
 {
     if (config.TCPEnabled)
     {
         // This part reads via a tcp connection and pumps decoded bytes into a line lexer
         // This part takes whole lines from the lexer, parses them, and publishes
         // messages describing the call traffic to RabbitMQ
         Log.LogInformation($"{ProtocolName} configured for TCP at {config.TCPHost}:{config.TCPPort}");
         return(new TCPTransport(config.TCPHost, config.TCPPort, Log));
     }
     else if (config.SerialEnabled)
     {
         // This part reads the serial port and pumps decoded bytes into a line lexer
         // This part takes whole lines from the lexer, parses them, and publishes
         // messages describing the call traffic to RabbitMQ
         Log.LogInformation($"{ProtocolName} configured for Serial on port {config.SerialPort}");
         return(new SerialTransport(Log, config));
     }
     log.LogError("Configuration with no protocols enabled was used to start a PBX parser");
     throw new ArgumentException();
 }
コード例 #4
0
 public SerialTransport(ILogger log, PBXConfiguration config)
 {
     _log    = log;
     _config = config;
 }
コード例 #5
0
 public SMDRParser(PBXConfiguration config, ILogger log, IMessageConnectionFactory cf,
                   IApplicationClient ac, IClock c) :
     base(config, log, cf, ac, c)
 {
     RegisterLexer(new CRLFByteSreamLineLexer());
 }