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); }
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; }
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(); }
public SerialTransport(ILogger log, PBXConfiguration config) { _log = log; _config = config; }
public SMDRParser(PBXConfiguration config, ILogger log, IMessageConnectionFactory cf, IApplicationClient ac, IClock c) : base(config, log, cf, ac, c) { RegisterLexer(new CRLFByteSreamLineLexer()); }