public LcInfo(string dst, LcRxState rx, LcTxState tx, int group) { Dst = dst; Rx = rx; Tx = tx; Group = group; }
/// <summary> /// /// </summary> /// <param name="rxSt"></param> /// <param name="txSt"></param> private void SetState(LcRxState rxSt, LcTxState txSt) { bool changed = false; _OldRxState = _RxState; _OldTxState = _TxState; if (_RxState != rxSt) { _RxState = rxSt; changed = true; if (_TxState == txSt) { if ((rxSt != LcRxState.Unavailable) && (_TxState == LcTxState.Unavailable)) { txSt = LcTxState.Idle; } else if ((rxSt == LcRxState.Unavailable) && (_TxState == LcTxState.Idle)) { txSt = LcTxState.Unavailable; } } } if (_TxState != txSt) { if (_Tone >= 0) { Top.Mixer.Unlink(_Tone); SipAgent.DestroyWavPlayer(_Tone); _Tone = -1; } switch (txSt) { case LcTxState.Congestion: _Tone = SipAgent.CreateWavPlayer("Resources/Tones/Congestion.wav", true); Top.Mixer.Link(_Tone, MixerDev.SpkLc, MixerDir.Send, Mixer.LC_PRIORITY, FuentesGlp.RxLc); break; case LcTxState.Busy: _Tone = SipAgent.CreateWavPlayer("Resources/Tones/Busy.wav", true); Top.Mixer.Link(_Tone, MixerDev.SpkLc, MixerDir.Send, Mixer.LC_PRIORITY, FuentesGlp.RxLc); break; } _TxState = txSt; changed = true; } if (changed) { General.SafeLaunchEvent(StateChanged, this); } }
public void Reset() { _RxNotifTimer.Enabled = false; if (_MemNotifTimer != null) { _MemNotifTimer.Enabled = false; } _Dst = ""; _Rx = LcRxState.Idle; _Tx = LcTxState.Idle; _Group = 0; //17_01_13 }
/// <summary> /// /// </summary> /// <param name="rx"></param> /// <param name="tx"></param> private void GetState(out LcRxState rx, out LcTxState tx) { rx = LcRxState.Unavailable; tx = LcTxState.Unavailable; foreach (SipChannel ch in _Channels) { if (ch.DestinationReachableState() == SipChannel.DestinationState.Idle) { rx = LcRxState.Idle; tx = LcTxState.Idle; return; } } }
private void ChangeTxState(LcTxState st) { if (_Tx != st) { if (_RxNotifTimer.Enabled && (_Rx == LcRxState.RxNotif)) { _RxNotifTimer.Enabled = false; _Rx = LcRxState.Idle; } if ((_MemNotifTimer != null) && _MemNotifTimer.Enabled && (_Rx == LcRxState.Mem)) { _MemNotifTimer.Enabled = false; _Rx = LcRxState.Idle; } _Tx = st; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> private void OnRsChanged(object sender) { Resource rs = (Resource)sender; if (rs.Content is GwTlfRs) { //Este tipo de recurso son los creados por la 19+1 de telefonía, //no vienen del Tifx y no deben afectar a las LC if (((GwTlfRs)rs.Content).Type == (uint)RsChangeInfo.RsTypeInfo.NoType) { return; } } if (!rs.IsValid) { LcRxState rxSt; LcTxState txSt; GetState(out rxSt, out txSt); if (rxSt == LcRxState.Unavailable) { Debug.Assert(txSt == LcTxState.Unavailable); MakeHangUpRx(); MakeHangUpTx(); } else { if (_SipCallRx != null) { if (_SipCallRx.IsActive && (_SipCallRx.Line.RsLine == rs)) { MakeHangUpRx(); } else { rxSt = _RxState; } } if (_SipCallTx != null) { if (_TxState == LcTxState.Out) { if (_SipCallTx.Line.RsLine == rs) { _SipCallTx.Ch.ResetCallResults(rs); } else { foreach (SipChannel ch in _Channels) { if (ch.ResetCallResults(rs)) { break; } } } } if (_SipCallTx.IsActive && (_SipCallTx.Line.RsLine == rs)) { if (_TxState == LcTxState.Out) { SipAgent.HangupCall(_SipCallTx.Id); _SipCallTx.Id = -1; txSt = (_CallTout.Enabled ? TryCall() : LcTxState.Congestion); } else { MakeHangUpTx(); } } else { txSt = _TxState; } } } SetState(rxSt, txSt); } else { //Esto es para cambiar la IP del proxy vivo (es de tipo GwTflRs y no de GwLcRs) if (rs.Content is GwTlfRs) { ResetIpLinesOfChannels(rs.Id, ((GwTlfRs)rs.Content).GwIp); } else if (rs.Content is GwLcRs) { ResetIpLinesOfChannels(rs.Id, ((GwLcRs)rs.Content).GwIp); } if (_SipCallTx != null) { if ((_TxState == LcTxState.Out) && (_SipCallTx.Line.RsLine != rs)) { foreach (SipChannel ch in _Channels) { if (ch.ResetCallResults(rs)) { break; } } } } else { if (_RxState == LcRxState.Unavailable) { Debug.Assert(_TxState == LcTxState.Unavailable); //Pone a idle la tecla sin tener en cuenta todos sus canales y recursos //No funciona LC con recurso IP sólo //SetState(LcRxState.Idle, LcTxState.Idle); LcRxState rxSt = _RxState; LcTxState txSt = _TxState; GetState(out rxSt, out txSt); SetState(rxSt, txSt); } } } }
/// <summary> /// /// </summary> /// <param name="cfg"></param> public void Reset(CfgEnlaceInterno cfg) { _Literal = cfg.Literal; _LastChannel = 0; _Channels.Clear(); foreach (CfgRecursoEnlaceInterno dst in cfg.ListaRecursos) { switch (dst.Prefijo) { case Cd40Cfg.INT_DST: string hostId = Top.Cfg.GetUserHost(dst.NombreRecurso); if (_Channels.Find(delegate(SipChannel channel) { return((channel.Prefix == dst.Prefijo) && (channel.Id == hostId)); }) == null) { SipChannel ch = new IntChannel(cfg.OrigenR2, hostId, dst.NombreRecurso, dst.Prefijo); ch.RsChanged += OnRsChanged; _Channels.Insert(0, ch); } break; case Cd40Cfg.PP_DST: if (_Channels.Find(delegate(SipChannel channel) { return((channel.Prefix == dst.Prefijo) && (channel.Id == dst.NombreRecurso)); }) == null) { SipChannel ch = dst.Interface == TipoInterface.TI_LCEN ? (SipChannel) new LcChannel(cfg.OrigenR2, dst.NombreRecurso, dst.Prefijo) : (SipChannel) new TlfPPChannel(cfg.OrigenR2, dst.NumeroAbonado, dst.NombreRecurso, dst.Prefijo, dst.Interface); ch.RsChanged += OnRsChanged; _Channels.Add(ch); } if (cfg.Dependencia != string.Empty) { _Dependencia = cfg.Dependencia; _Groups.Add(_Dependencia); } break; case Cd40Cfg.ATS_DST: string[] userId = Top.Cfg.GetUserFromAddress(dst.Prefijo, dst.NumeroAbonado); if (userId != null) { dst.NombreRecurso = userId[1]; dst.Prefijo = Cd40Cfg.INT_DST; goto case Cd40Cfg.INT_DST; } TlfNet net = Top.Cfg.GetIPNet(dst.Prefijo, dst.NumeroAbonado); if (net != null) { SipChannel ch = _Channels.Find(delegate(SipChannel channel) { return((channel.Prefix == dst.Prefijo) && (channel.Id == net.Id)); }); if (ch == null) { // Para Linea caliente en destinos ATS_DST, // solo se utilizan las lineas que vienen de un encaminamiento IP List <SipLine> listLines = net.Lines.FindAll(line => line.centralIP == false); foreach (SipLine line in listLines) { int index = net.Lines.IndexOf(line); net.Lines.RemoveAt(index); net.Routes.RemoveAt(index); net.RsTypes.RemoveAt(index); } //Caso de destino ATS de central no IP: no tiene canal ATS (no lo añado), solo canal LC if (net.Lines.Count > 0) { ch = new TlfNetChannel(net, cfg.OrigenR2, dst.NumeroAbonado, null, dst.Prefijo); ch.RsChanged += OnRsChanged; _Channels.Add(ch); } } else { ch.AddRemoteDestination(dst.NumeroAbonado, null); } } break; } } if ((_SipCallRx != null) && !_SipCallRx.IsValid(_Channels)) { MakeHangUpRx(); } if ((_SipCallTx != null) && !_SipCallTx.IsValid(_Channels)) { MakeHangUpTx(); } LcRxState rxSt = _RxState; LcTxState txSt = _TxState; if ((_SipCallRx == null) || (_SipCallTx == null)) { GetState(out rxSt, out txSt); } if (_SipCallRx != null) { rxSt = _RxState; } if (_SipCallTx != null) { txSt = _TxState; } SetState(rxSt, txSt); }
public LcState(LcRxState rx, LcTxState tx) { Rx = rx; Tx = tx; }