Browse Source

修复级联的通道查询以及设备信息查询

pull/212/head
648540858 3 years ago
parent
commit
c33bf822cc
  1. 3
      src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
  2. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java
  3. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
  4. 30
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
  5. 1
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
  6. 4
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
  7. 2
      src/main/resources/application.yml
  8. BIN
      src/main/resources/wvp.sqlite

3
src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java

@ -74,5 +74,8 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> {
device.setOnline(1);
// 处理上线监听
storager.updateDevice(device);
// TODO 上线添加订阅
}
}

2
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java

@ -100,6 +100,6 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
logger.info("再次向平台注册,平台国标ID:" + event.getPlatformGbID());
sipCommanderFroPlatform.register(parentPlatform, null, okEvent);
}
}, config.getRegisterTimeInterval(), config.getRegisterTimeInterval());//十五秒后再次发起注册
}, config.getRegisterTimeInterval()* 1000, config.getRegisterTimeInterval()* 1000);//十五秒后再次发起注册
}
}

2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java

@ -35,7 +35,7 @@ import java.util.Vector;
@SuppressWarnings("rawtypes")
public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
private final static Logger logger = LoggerFactory.getLogger(MessageRequestProcessor.class);
private final static Logger logger = LoggerFactory.getLogger(InviteRequestProcessor.class);
private SIPCommanderFroPlatform cmderFroPlatform;

30
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java

@ -492,11 +492,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest());
// 查询设备是否存在
Device device = storager.queryVideoDevice(deviceId);
if (device == null) {
logger.warn("处理DeviceInfo设备信息Message时未找到设备信息");
response404Ack(evt);
return;
}
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(deviceId);
Element rootElement = getRootElement(evt);
String requestName = rootElement.getName();
Element deviceIdElement = rootElement.element("DeviceID");
@ -508,20 +505,20 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
if (requestName.equals("Query")) {
logger.info("接收到DeviceInfo查询消息");
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
String platformId = ((SipUri) fromHeader.getAddress().getURI()).getUser();
if (platformId == null) {
if (parentPlatform == null) {
response404Ack(evt);
return;
} else {
// 回复200 OK
responseAck(evt);
String sn = rootElement.element("SN").getText();
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag());
}
} else {
logger.debug("接收到DeviceInfo应答消息");
if (device == null) {
logger.warn("处理DeviceInfo设备信息Message时未找到设备信息");
response404Ack(evt);
return;
}
@ -561,11 +558,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest());
// 查询设备是否存在
Device device = storager.queryVideoDevice(deviceId);
if (device == null) {
logger.warn("处理DeviceInfo设备信息Message时未找到设备信息");
response404Ack(evt);
return;
}
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(deviceId);
Element rootElement = getRootElement(evt);
String name = rootElement.getName();
@ -574,13 +568,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
Element deviceListElement = rootElement.element("DeviceList");
String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId;
FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
AddressImpl address = (AddressImpl) fromHeader.getAddress();
SipUri uri = (SipUri) address.getURI();
String platformId = uri.getUser();
// if (deviceListElement == null) { // 存在DeviceList则为响应 catalog, 不存在DeviceList则为查询请求
if (name.equalsIgnoreCase("Query")) { // 区分是Response——查询响应,还是Query——查询请求
// TODO 后续将代码拆分
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
if (parentPlatform == null) {
response404Ack(evt);
return;
@ -634,6 +623,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
} else {
if (device == null) {
logger.warn("收到catalog设备目录列表请求时未找到设备信息");
response404Ack(evt);
return;
}
deviceListElement = getRootElement(evt, device.getCharset()).element("DeviceList");
Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
if (deviceListIterator != null) {

1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@ -326,6 +326,7 @@ public class ZLMHttpHookListener {
String streamId = json.getString("stream");
String app = json.getString("app");
// TODO 如果在给上级推流,也不停止。
if ("rtp".equals(app)){
JSONObject ret = new JSONObject();
ret.put("code", 0);

4
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java

@ -26,7 +26,9 @@ public interface PlatformChannelMapper {
@Insert("<script> "+
"INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" +
"<foreach collection='channelReducesToAdd' item='item' separator=','> ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )</foreach>" +
"<foreach collection='channelReducesToAdd' item='item' separator=','>" +
" ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )" +
"</foreach>" +
"</script>")
int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);

2
src/main/resources/application.yml

@ -1,3 +1,3 @@
spring:
profiles:
active: dev
active: local

BIN
src/main/resources/wvp.sqlite

Binary file not shown.
Loading…
Cancel
Save