Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private void MakeHangUpTx()
        {
            if (_SipCallTx != null)
            {
                if (_SipCallTx.IsActive)
                {
                    Debug.Assert(_ActiveTx == this);

                    switch (_TxState)
                    {
                    case LcTxState.Out:
                        _CallTout.Enabled = false;
                        break;

                    case LcTxState.Tx:
                        Top.Mixer.Unlink(_SipCallTx.Id);
                        break;
                    }

                    SipAgent.HangupCall(_SipCallTx.Id);
                }
                else
                {
                    Debug.Assert((_TxState == LcTxState.Congestion) || (_TxState == LcTxState.Busy));
                }

                // Top.Recorder.Rec(CORESIP_CallType.CORESIP_CALL_IA, false);

                _SipCallTx       = null;
                _ActiveTx        = null;
                Top.Lc.HoldedTlf = false;
            }
        }
Exemplo n.º 2
0
        public void Init()
        {
            Top.Cfg.ConfigChanged      += OnConfigChanged;
            Top.Sip.LcCallStateChanged += OnCallStateChanged;
            Top.Sip.IncomingLcCall     += OnIncomingCall;
            Top.Hw.JacksChangedHw      += OnJacksChanged;


            for (int i = 0, to = _LcPositions.Length; i < to; i++)
            {
                _LcPositions[i] = new LcPosition(i);
                _LcPositions[i].StateChanged += OnLcStateChanged;
            }
        }
Exemplo n.º 3
0
        private void OnConfigChanged(object sender)
        {
            _ChangingCfg = true;
            try
            {
                RangeMsg <LcInfo> lcPositions = new RangeMsg <LcInfo>(0, _LcPositions.Length);

                foreach (CfgEnlaceInterno link in Top.Cfg.LcLinks)
                {
                    try
                    {
                        int pos = (int)link.PosicionHMI - 1;

                        if (pos < _LcPositions.Length)
                        {
                            LcPosition lc = _LcPositions[pos];
                            lc.Reset(link);

                            LcInfo posInfo = new LcInfo(lc.Literal, lc.RxState, lc.TxState, lc.Group);
                            lcPositions.Info[pos] = posInfo;
                        }
                    }
                    catch (Exception excep)
                    {
                        _Logger.Error("Excepcion OnConfigChanged. Mensaje: {0}", excep.Message);
                    }
                }

                for (int i = 0, to = _LcPositions.Length; i < to; i++)
                {
                    if (lcPositions.Info[i] == null)
                    {
                        LcPosition lc = _LcPositions[i];
                        lc.Reset();

                        LcInfo posInfo = new LcInfo(lc.Literal, lc.RxState, lc.TxState, lc.Group);
                        lcPositions.Info[i] = posInfo;
                    }
                }
                General.SafeLaunchEvent(NewPositions, this, lcPositions);
            }
            catch (Exception exc)
            {
                _Logger.Error(String.Format("LcManager:OnConfigChanged exception {0}, {1}", exc.Message, exc.StackTrace));
            }
            finally
            {
                _ChangingCfg = false;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        private void MakeHangUpRx()
        {
            if (_SipCallRx != null)
            {
                Debug.Assert(_SipCallRx.IsActive);
                Debug.Assert(_ActiveRx == this);

                if (_RxState == LcRxState.Rx)
                {
                    Top.Mixer.Unlink(_SipCallRx.Id);
                }

                SipAgent.HangupCall(_SipCallRx.Id);

                _ActiveRx        = null;
                _SipCallRx       = null;
                Top.Lc.HoldedTlf = false;
            }
        }
Exemplo n.º 5
0
        private void OnLcStateChanged(object sender)
        {
            LcPosition lc = (LcPosition)sender;

            _AnyActiveLcRx = DetectedAnyLC();// Miguel

            switch (lc.TxState)
            {
            case LcTxState.Out:
            case LcTxState.Busy:
            case LcTxState.Congestion:
            case LcTxState.Tx:
                Debug.Assert((_ActiveCall == null) || (_ActiveCall == lc));
                _ActiveCall = lc;
                Activity    = true;

                if (lc.TxState == LcTxState.Tx && lc.OldTxState != LcTxState.Tx)
                {
                    Top.Recorder.SessionGlp(FuentesGlp.TxLc, true);

                    Top.WorkingThread.Enqueue("SetSnmp", delegate()
                    {
                        string snmpString = Top.Cfg.PositionId + "_" + "LC" + "_" + lc.Literal + "_" + lc.TxState.ToString();
                        General.SafeLaunchEvent(SetSnmpString, this, new SnmpStringMsg <string, string>(Settings.Default.OutgoingTfCallOid, snmpString));
                    });
                }

                break;

            default:
                if (_ActiveCall == lc)
                {
                    _ActiveCall = null;
                    Activity    = false;

                    if (lc.OldTxState != LcTxState.Unavailable && lc.TxState == LcTxState.Idle)
                    {
                        // Tratamiento para cuando mientras se está transmitiendo,
                        // el colateral se cae.
                        if (lc.OldTxState == LcTxState.Tx && _TonoFalsaManiobra)
                        {
                            _TonoFalsaManiobra = false;
                            int _BadOperationTone = SipAgent.CreateWavPlayer("Resources/Tones/Falsa_Maniobra.wav", true);
                            Top.Mixer.Link(_BadOperationTone, MixerDev.SpkLc, MixerDir.Send, Mixer.RD_PRIORITY, FuentesGlp.RxLc);

                            Top.WorkingThread.Enqueue("Wait", delegate()
                            {
                                System.Threading.Thread.Sleep(500);
                            });

                            Top.Mixer.Unlink(_BadOperationTone);
                            SipAgent.DestroyWavPlayer(_BadOperationTone);
                        }

                        Top.Recorder.SessionGlp(FuentesGlp.TxLc, false);
                        Top.WorkingThread.Enqueue("SetSnmp", delegate()
                        {
                            string snmpString = Top.Cfg.PositionId + "_" + "LC" + "_" + lc.Literal + "_" + lc.TxState.ToString();
                            General.SafeLaunchEvent(SetSnmpString, this, new SnmpStringMsg <string, string>(Settings.Default.OutgoingTfCallOid, snmpString));
                        });
                    }
                }
                break;
            }

            // Sólo para gestión SNMP
            if (lc.OldRxState != LcRxState.Unavailable)
            {
                switch (lc.RxState)
                {
                case LcRxState.Rx:
                    if (lc.OldRxState != LcRxState.Rx)
                    {
                        Top.WorkingThread.Enqueue("SetSnmp", delegate()
                        {
                            string snmpString = Top.Cfg.PositionId + "_" + "LC" + "_" + lc.Literal + "_" + lc.RxState.ToString();
                            General.SafeLaunchEvent(SetSnmpString, this, new SnmpStringMsg <string, string>(Settings.Default.IncommingTfCallOid, snmpString));
                        });
                    }
                    break;

                case LcRxState.Idle:
                    if (lc.OldRxState == LcRxState.Rx)
                    {
                        Top.WorkingThread.Enqueue("SetSnmp", delegate()
                        {
                            string snmpString = Top.Cfg.PositionId + "_" + "LC" + "_" + lc.Literal + "_" + lc.RxState.ToString();
                            General.SafeLaunchEvent(SetSnmpString, this, new SnmpStringMsg <string, string>(Settings.Default.IncommingTfCallOid, snmpString));
                        });
                    }
                    break;

                default:
                    break;
                }
            }

            if (!_ChangingCfg)
            {
                RangeMsg <LcState> state = new RangeMsg <LcState>(lc.Pos, new LcState(lc.RxState, lc.TxState));
                General.SafeLaunchEvent(PositionsChanged, this, state);
            }
        }