Пример #1
0
        private static void callEvent(object sender, ElapsedEventArgs e)
        {
            _pingTimer.Enabled = false;
            VOIPCall call = new VOIPCall(_config);

            if (call.MakeCall(_pingData) == true)
            {
                _pingData.Clear();
            }
            _pingTimer.Enabled = true;
        }
Пример #2
0
        static void Main(string[] args)
        {
            _log.Info("Starting client");
            if (!ReadAndValidateConfig())
            {
                return;
            }

            /*
             * _pingData.Add("2014-01-05T00:33:29", "29");
             * _pingData.Add("2014-01-05T00:34:29", "29");
             * _pingData.Add("2014-01-05T00:35:29", "29");
             * _pingData.Add("2014-01-05T00:36:29", "29");
             * _pingData.Add("2014-01-05T00:37:29", "29");
             */
            VOIPCall call = new VOIPCall(_config);

            if (call.MakeCall(_pingData) == true)
            {
                _pingData.Clear();
            }
            return;

            // Setup the Ping Timer if defined in the configuration file
            if (_config.GetStringValue("ping.host") != null)
            {
                // Setup the timer for every minute
                _pingTimer          = new System.Timers.Timer(60000);
                _pingTimer.Elapsed += pingEvent;
                _pingTimer.Start();

                // The timer doesn't run at startup. Issue a Ping right away.
                pingEvent(null, null);
            }

            // Setup the call timer every hour
            //_callTimer = new System.Timers.Timer(3600000);
            _callTimer          = new System.Timers.Timer(300000);
            _callTimer.Elapsed += callEvent;
            _callTimer.Start();

            lock (_sync)
            {
                Monitor.Wait(_sync);
            }
        }