调试日志

This commit is contained in:
zxb 2024-01-25 08:45:51 +08:00
parent 01622884a9
commit d39b68b071
3 changed files with 16 additions and 6 deletions

View File

@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd.CatalogQueryMessageHandler;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Element;
import org.springframework.beans.factory.annotation.Autowired;
@ -14,6 +15,7 @@ import java.util.concurrent.ConcurrentHashMap;
import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText;
@Slf4j
public abstract class MessageHandlerAbstract extends SIPRequestProcessorParent implements IMessageHandler{
public Map<String, IMessageHandler> messageHandlerMap = new ConcurrentHashMap<>();
@ -29,7 +31,7 @@ public abstract class MessageHandlerAbstract extends SIPRequestProcessorParent i
public void handForDevice(RequestEvent evt, Device device, Element element) {
String cmd = getText(element, "CmdType");
IMessageHandler messageHandler = messageHandlerMap.get(cmd);
log.info("查找 并 调用 CmeType => {} handForDevice 处理器", cmd);
if (messageHandler != null) {
//两个国标平台互相级联时由于上一步判断导致本该在平台处理的消息 放到了设备的处理逻辑
//所以对目录查询单独做了校验
@ -46,6 +48,7 @@ public abstract class MessageHandlerAbstract extends SIPRequestProcessorParent i
public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element element) {
String cmd = getText(element, "CmdType");
IMessageHandler messageHandler = messageHandlerMap.get(cmd);
log.info("查找 并 调用 CmeType => {} handForPlatform 处理器", cmd);
if (messageHandler != null) {
messageHandler.handForPlatform(evt, parentPlatform, element);
}

View File

@ -69,7 +69,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
@Override
public void process(RequestEvent evt) {
SIPRequest sipRequest = (SIPRequest)evt.getRequest();
// logger.info("接收到消息:" + evt.getRequest());
logger.info("接收到消息:" + evt.getRequest());
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest());
CallIdHeader callIdHeader = sipRequest.getCallIdHeader();
// 先从会话内查找
@ -96,8 +96,10 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
SIPRequest request = (SIPRequest) evt.getRequest();
// 查询设备是否存在
device = redisCatchStorage.getDevice(deviceId);
logger.info("device => {}", device);
// 查询上级平台是否存在
ParentPlatform parentPlatform = storage.queryParentPlatByServerGBId(deviceId);
logger.info("parentPlatform => {}", parentPlatform);
try {
if (device != null && parentPlatform != null) {
String hostAddress = request.getRemoteAddress().getHostAddress();
@ -133,6 +135,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement
responseAck(request, Response.BAD_REQUEST, e.getMessage());
}
String name = rootElement.getName();
logger.info("查找 并 调用处理器 {}", name);
IMessageHandler messageHandler = messageHandlerMap.get(name);
if (messageHandler != null) {
if (device != null) {

View File

@ -1,7 +1,10 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.bean.*;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.bean.RecordItem;
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
@ -9,9 +12,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler;
import com.genersoft.iot.vmp.utils.DateUtil;
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo;
import com.genersoft.iot.vmp.utils.DateUtil;
import gov.nist.javax.sip.message.SIPRequest;
import org.dom4j.Element;
import org.slf4j.Logger;
@ -25,9 +28,7 @@ import javax.sip.RequestEvent;
import javax.sip.SipException;
import javax.sip.message.Response;
import java.text.ParseException;
import java.util.HashSet;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CopyOnWriteArraySet;
@Component
@ -98,6 +99,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
// 确认是直播还是国标 国标直接请求下级直播请求录像管理服务
List<ChannelSourceInfo> channelSources = storager.getChannelSource(parentPlatform.getServerGBId(), channelId);
logger.info("channelSources {}", channelSources);
if (channelSources.get(0).getCount() > 0) { // 国标
// 向国标设备请求录像数据
Device device = storager.queryVideoDeviceByPlatformIdAndChannelId(parentPlatform.getServerGBId(), channelId);
@ -116,6 +118,8 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp
return;
}
set.add(key);
logger.info("[国标级联] 录像查询收到数据, 通道: {}, {}, 准备转发", channelId, sn);
cmderFroPlatform.recordInfo(deviceChannel, parentPlatform, request.getFromTag(), recordInfo);
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[命令发送失败] 国标级联 回复录像数据: {}", e.getMessage());