public void Stop() { _log.LogInformation("Stopping PBXConnector service"); _pingResponder?.Stop(); _smdrParserThread?.Join(5); _pingResponderThread?.Join(5); _pmsParserThread?.Join(5); _smdrParser = null; _pingResponder = null; _smdrParserThread = _pmsParserThread = _pingResponderThread = null; _log.LogInformation("PBX connector shutdown complete"); }
public void Start() { _log.LogInformation("Attempting Connection to HOLMS Server"); TryLogin(); _log.LogInformation("Successful login to HOLMS Server"); var mcf = _config.BuildMCF(_log); _pingResponder = new PingResponder(_log, mcf); _pingResponderThread = new Thread(_pingResponder.Start); _pingResponderThread.Start(); if (_config.SMDRConnection.SerialEnabled || _config.SMDRConnection.TCPEnabled) { _log.LogInformation("Starting SMDR Listener"); _smdrParser = new SMDRParser(_config.SMDRConnection, _log, mcf, _ac, _c); _smdrParserThread = new Thread(_smdrParser.Start); _smdrParserThread.Start(); } else { _log.LogInformation("Configuration disables SMDR protocol connector; not starting"); } if (_config.PMSConnection.TCPEnabled || _config.PMSConnection.SerialEnabled) { _log.LogInformation($"Starting PMS Listener"); _pmsParser = new PMSParser(_config.PMSConnection, _log, mcf, _ac, _c); _pmsParserThread = new Thread(_pmsParser.Start); _pmsParserThread.Start(); } else { _log.LogInformation("Configuration disables PMS protocol connector; not starting"); } }