示例#1
0
        public CStateMachine(CCallManager manager)
        {
            // store manager reference...
            _manager = manager;

            // create call proxy
            _sigProxy = _manager.Factory.createCallProxy();

            // initialize call states
            _stateIdle     = new CIdleState(this);
            _stateAlerting = new CAlertingState(this);
            _stateActive   = new CActiveState(this);
            _stateCalling  = new CConnectingState(this);
            _stateReleased = new CReleasedState(this);
            _stateIncoming = new CIncomingState(this);
            _stateHolding  = new CHoldingState(this);
            // change state
            _state = _stateIdle;

            // initialize data
            Time     = System.DateTime.Now;
            Duration = System.TimeSpan.Zero;

            // Initialize timers
            if (null != _manager)
            {
                _noreplyTimer          = _manager.Factory.createTimer();
                _noreplyTimer.Interval = 15000; // hardcoded to 15s
                _noreplyTimer.Elapsed  = new TimerExpiredCallback(_noreplyTimer_Elapsed);

                _releasedTimer          = _manager.Factory.createTimer();
                _releasedTimer.Interval = 5000; // hardcoded to 15s
                _releasedTimer.Elapsed  = new TimerExpiredCallback(_releasedTimer_Elapsed);
            }
        }
示例#2
0
        public CStateMachine(CCallManager manager)
        {
            // store manager reference...
              _manager = manager;

              // create call proxy
              _sigProxy = _manager.Factory.createCallProxy();

              // initialize call states
              _stateIdle = new CIdleState(this);
              _stateAlerting = new CAlertingState(this);
              _stateActive = new CActiveState(this);
              _stateCalling = new CConnectingState(this);
              _stateReleased = new CReleasedState(this);
              _stateIncoming = new CIncomingState(this);
              _stateHolding = new CHoldingState(this);
              // change state
              _state = _stateIdle;

              // initialize data
              Time = System.DateTime.Now;
              Duration = System.TimeSpan.Zero;

              // Initialize timers
              if (null != _manager)
              {
            _noreplyTimer = _manager.Factory.createTimer();
            _noreplyTimer.Interval = 15000; // hardcoded to 15s
            _noreplyTimer.Elapsed = new TimerExpiredCallback(_noreplyTimer_Elapsed);

            _releasedTimer = _manager.Factory.createTimer();
            _releasedTimer.Interval = 5000; // hardcoded to 15s
            _releasedTimer.Elapsed = new TimerExpiredCallback(_releasedTimer_Elapsed);
              }
        }