Ejemplo n.º 1
0
        public void TlfClick(int id)
        {
            switch (_StateManager.Tlf[id].State)
            {
            case TlfState.Idle:
            case TlfState.PaPBusy:
                if (id < Tlf.NumDestinations)
                {
                    if (_StateManager.Tlf.Listen.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.ListenTo(id);
                    }
                    else if (_StateManager.Tlf.Transfer.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.TransferTo(id, true);
                    }
                    else if (_StateManager.Tlf.PickUp.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.PreparePickUp(id);
                    }
                    else if (_StateManager.Tlf.PickUp.State == FunctionState.Executing)
                    {
                        _EngineCmdManager.CancelPickUp();
                        _EngineCmdManager.PreparePickUp(id);
                    }
                    else if (_StateManager.Tlf.Forward.State == FunctionState.Ready)
                    {
                        _EngineCmdManager.PrepareForward(id);
                    }
                    else
                    {
                        if (_StateManager.Tlf.PickUp.State == FunctionState.Error)
                        {
                            _EngineCmdManager.CancelPickUp();
                        }
                        _EngineCmdManager.BeginTlfCall(id, _StateManager.Tlf.Priority.NewCall(id));
                    }
                }
                else
                {
                    TlfClick(_StateManager.Tlf[id].Number, false, null, id);
                }
                break;

            case TlfState.In:
            case TlfState.InPrio:
            case TlfState.RemoteIn:
                if (_StateManager.Tlf.PickUp.State == FunctionState.Ready)
                {
                    _StateManager.Tlf.PickUp.Reset();
                }
                _EngineCmdManager.AnswerTlfCall(id);
                break;

            case TlfState.Out:
            case TlfState.Set:
            case TlfState.RemoteHold:
            case TlfState.Busy:
            case TlfState.Congestion:
            case TlfState.OutOfService:
            case TlfState.NotAllowed:
                _EngineCmdManager.EndTlfCall(id);
                if (_StateManager.Tlf.Priority.AssociatePosition == id)
                {
                    _StateManager.Tlf.Priority.Reset();
                }
                break;

            case TlfState.Conf:
                _EngineCmdManager.EndTlfConfCall(id);
                break;

            case TlfState.Mem:
            case TlfState.RemoteMem:
                _StateManager.Tlf.ResetMem(id);
                break;

            case TlfState.Hold:
                if (_StateManager.Tlf.Transfer.State == FunctionState.Ready)
                {
                    _EngineCmdManager.TransferTo(id, false);
                }
                else if (_EngineCmdManager.HayConferencia())
                {
                    _EngineCmdManager.SetHold(false);
                }
                else
                {
                    _EngineCmdManager.SetHold(id, false);
                }
                break;

            case TlfState.InProcess:
                //Do nothing
                break;
            }
        }