Exemple #1
0
        /// <summary>
        /// Call/Session constructor. Initializes call states, creates signaling proxy, initialize time,
        /// initialize timers.
        /// </summary>
        public CStateMachine()
        {
            // store manager reference...
            _manager = CCallManager.Instance;

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

            // create media proxy for this call
            _mediaProxy = new Sipek.Sip.pjsipMediaPlayerProxy();

            // 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);
            _stateTerminated = new CTerminatedState(this);
            // change state
            _state = _stateIdle;

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

            // Initialize timers
            if (null != _manager)
            {
                _noreplyTimer          = _manager.Factory.CreateTimer();
                _noreplyTimer.Interval = 60000; // hardcoded to 60s
                _noreplyTimer.Elapsed  = new TimerExpiredCallback(_noreplyTimer_Elapsed);

                //_releasedTimer = _manager.Factory.createTimer();
                //_releasedTimer.Interval = 1000; // hardcoded to 1s
                //_releasedTimer.Elapsed = new TimerExpiredCallback(_releasedTimer_Elapsed);

                _noresponseTimer          = _manager.Factory.CreateTimer();
                _noresponseTimer.Interval = 60000; // hardcoded to 60s
                _noresponseTimer.Elapsed  = new TimerExpiredCallback(_noresponseTimer_Elapsed);
            }
        }
    /// <summary>
    /// Call/Session constructor. Initializes call states, creates signaling proxy, initialize time,
    /// initialize timers.
    /// </summary>
    /// <param name="manager">reference to call manager</param>
    public CStateMachine()
    {
      // store manager reference...
      _manager = CCallManager.Instance;

      // create call proxy
      _sigProxy = _manager.StackProxy.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);
      _stateTerminated = new CTerminatedState(this);
      // change state
      _state = _stateIdle;
      
      // initialize data
      Time = DateTime.Now;
      Duration = 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 5s
        _releasedTimer.Elapsed = new TimerExpiredCallback(_releasedTimer_Elapsed);

        _noresponseTimer = _manager.Factory.createTimer();
        _noresponseTimer.Interval = 60000; // hardcoded to 60s
        _noresponseTimer.Elapsed = new TimerExpiredCallback(_noresponseTimer_Elapsed);

      }
    }