/// <summary> /// 目录查询响应消息处理 /// </summary> /// <param name="localEP">本地终结点</param> /// <param name="remoteEP">远程终结点</param> /// <param name="request">sip请求</param> /// <param name="catalog">目录结构体</param> private void CatalogHandle(SIPEndPoint localEP, SIPEndPoint remoteEP, SIPRequest request, Catalog catalog) { try { catalog.DeviceList.Items.FindAll(item => item != null).ForEach(catalogItem => { catalogItem.RemoteEP = remoteEP.ToHost(); var devCata = DevType.GetCataType(catalogItem.DeviceID); //logger.Debug("CatalogHandle: DevCataType=" + devCata); if (devCata == DevCataType.Device) { if (!_nodeMonitorService.ContainsKey(catalogItem.DeviceID)) { //remoteEP.Port = _LocalSipAccount.RemotePort; _nodeMonitorService.TryAdd(catalogItem.DeviceID, new SIPMonitorCore(this, _transport, _sipAccountStorage) { RemoteEndPoint = remoteEP, DeviceId = catalogItem.DeviceID }); logger.Debug("CatalogHandle: nodeMonitorService.Count=" + _nodeMonitorService.Count); logger.Debug("CatalogHandle: nodeMonitorService.TryAdd DeviceId=" + catalogItem.DeviceID); } } // CommandType cmdType = i == 0 ? CommandType.Play : CommandType.Playback; }); OnCatalogReceived?.Invoke(catalog); } catch (Exception ex) { logger.Warn("CatalogHandle Exception: " + ex.Message); } }
/// <summary> /// 目录查询响应消息处理 /// </summary> /// <param name="localEP">本地终结点</param> /// <param name="remoteEP">远程终结点</param> /// <param name="request">sip请求</param> /// <param name="catalog">目录结构体</param> private void CatalogHandle(SIPEndPoint localEP, SIPEndPoint remoteEP, SIPRequest request, Catalog catalog) { catalog.DeviceList.Items.FindAll(item => item != null).ForEach(catalogItem => { catalogItem.RemoteEP = remoteEP.ToHost(); var devCata = DevType.GetCataType(catalogItem.DeviceID); if (devCata != DevCataType.Device) { if (!_nodeMonitorService.ContainsKey(catalogItem.DeviceID)) { remoteEP.Port = _LocalSipAccount.KeepaliveInterval; _nodeMonitorService.TryAdd(catalogItem.DeviceID, new SIPMonitorCoreService(this, _transport, _sipAccountStorage) { RemoteEndPoint = remoteEP, DeviceId = catalogItem.DeviceID }); } } // CommandType cmdType = i == 0 ? CommandType.Play : CommandType.Playback; }); OnCatalogReceived?.Invoke(catalog); }