Beispiel #1
0
        /// <summary>
        /// User put call on hold or retrieve
        /// </summary>
        /// <param name="session">session identification</param>
        public void onUserHoldRetrieve(int session)
        {
            // check Hold or Retrieve
            CAbstractState state = this[session].getState();

            if (state.StateId == EStateId.ACTIVE)
            {
                this.getCall(session).getState().holdCall(session);
            }
            else if (state.StateId == EStateId.HOLDING)
            {
                // execute retrieve
                // check if any ACTIVE calls
                if (this.getNoCallsInState(EStateId.ACTIVE) > 0)
                {
                    // get 1st and put it on hold
                    CStateMachine sm = ((List <CStateMachine>)enumCallsInState(EStateId.ACTIVE))[0];
                    if (null != sm)
                    {
                        sm.getState().holdCall(sm.Session);
                    }

                    // set Retrieve event pending for HoldConfirm
                    _pendingAction = new PendingAction(EPendingActions.EUserHold, session);
                    return;
                }

                this[session].getState().retrieveCall(session);
            }
            else
            {
                // illegal
            }
        }
Beispiel #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);
            }
        }
Beispiel #3
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);
              }
        }
Beispiel #4
0
 public void changeState(CAbstractState state)
 {
     _state.onExit();
       _state = state;
       _state.onEntry();
 }
Beispiel #5
0
 public void changeState(CAbstractState state)
 {
     _state.onExit();
     _state = state;
     _state.onEntry();
 }