Commit c33bf822cce59667be80ba0bb45499498501d161

Authored by 648540858
1 parent 810dceea

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

src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
... ... @@ -74,5 +74,8 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> {
74 74 device.setOnline(1);
75 75 // 处理上线监听
76 76 storager.updateDevice(device);
  77 +
  78 + // TODO 上线添加订阅
  79 +
77 80 }
78 81 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java
... ... @@ -100,6 +100,6 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
100 100 logger.info("再次向平台注册,平台国标ID:" + event.getPlatformGbID());
101 101 sipCommanderFroPlatform.register(parentPlatform, null, okEvent);
102 102 }
103   - }, config.getRegisterTimeInterval(), config.getRegisterTimeInterval());//十五秒后再次发起注册
  103 + }, config.getRegisterTimeInterval()* 1000, config.getRegisterTimeInterval()* 1000);//十五秒后再次发起注册
104 104 }
105 105 }
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
... ... @@ -35,7 +35,7 @@ import java.util.Vector;
35 35 @SuppressWarnings("rawtypes")
36 36 public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
37 37  
38   - private final static Logger logger = LoggerFactory.getLogger(MessageRequestProcessor.class);
  38 + private final static Logger logger = LoggerFactory.getLogger(InviteRequestProcessor.class);
39 39  
40 40 private SIPCommanderFroPlatform cmderFroPlatform;
41 41  
... ...
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
... ... @@ -492,11 +492,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
492 492 String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest());
493 493 // 查询设备是否存在
494 494 Device device = storager.queryVideoDevice(deviceId);
495   - if (device == null) {
496   - logger.warn("处理DeviceInfo设备信息Message时未找到设备信息");
497   - response404Ack(evt);
498   - return;
499   - }
  495 + ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(deviceId);
  496 +
500 497 Element rootElement = getRootElement(evt);
501 498 String requestName = rootElement.getName();
502 499 Element deviceIdElement = rootElement.element("DeviceID");
... ... @@ -508,20 +505,20 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
508 505 if (requestName.equals("Query")) {
509 506 logger.info("接收到DeviceInfo查询消息");
510 507 FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
511   - String platformId = ((SipUri) fromHeader.getAddress().getURI()).getUser();
512   - if (platformId == null) {
  508 + if (parentPlatform == null) {
513 509 response404Ack(evt);
514 510 return;
515 511 } else {
516 512 // 回复200 OK
517 513 responseAck(evt);
518 514 String sn = rootElement.element("SN").getText();
519   - ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
520 515 cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag());
521 516 }
522 517 } else {
523 518 logger.debug("接收到DeviceInfo应答消息");
524 519 if (device == null) {
  520 + logger.warn("处理DeviceInfo设备信息Message时未找到设备信息");
  521 + response404Ack(evt);
525 522 return;
526 523 }
527 524  
... ... @@ -561,11 +558,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
561 558 String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest());
562 559 // 查询设备是否存在
563 560 Device device = storager.queryVideoDevice(deviceId);
564   - if (device == null) {
565   - logger.warn("处理DeviceInfo设备信息Message时未找到设备信息");
566   - response404Ack(evt);
567   - return;
568   - }
  561 + ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(deviceId);
  562 +
569 563  
570 564 Element rootElement = getRootElement(evt);
571 565 String name = rootElement.getName();
... ... @@ -574,13 +568,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
574 568 Element deviceListElement = rootElement.element("DeviceList");
575 569 String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId;
576 570 FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME);
577   - AddressImpl address = (AddressImpl) fromHeader.getAddress();
578   - SipUri uri = (SipUri) address.getURI();
579   - String platformId = uri.getUser();
580   - // if (deviceListElement == null) { // 存在DeviceList则为响应 catalog, 不存在DeviceList则为查询请求
581 571 if (name.equalsIgnoreCase("Query")) { // 区分是Response——查询响应,还是Query——查询请求
582 572 // TODO 后续将代码拆分
583   - ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId);
584 573 if (parentPlatform == null) {
585 574 response404Ack(evt);
586 575 return;
... ... @@ -634,6 +623,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
634 623  
635 624  
636 625 } else {
  626 + if (device == null) {
  627 + logger.warn("收到catalog设备目录列表请求时未找到设备信息");
  628 + response404Ack(evt);
  629 + return;
  630 + }
637 631 deviceListElement = getRootElement(evt, device.getCharset()).element("DeviceList");
638 632 Iterator<Element> deviceListIterator = deviceListElement.elementIterator();
639 633 if (deviceListIterator != null) {
... ...
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
... ... @@ -326,6 +326,7 @@ public class ZLMHttpHookListener {
326 326 String streamId = json.getString("stream");
327 327 String app = json.getString("app");
328 328  
  329 + // TODO 如果在给上级推流,也不停止。
329 330 if ("rtp".equals(app)){
330 331 JSONObject ret = new JSONObject();
331 332 ret.put("code", 0);
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
... ... @@ -26,7 +26,9 @@ public interface PlatformChannelMapper {
26 26  
27 27 @Insert("<script> "+
28 28 "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" +
29   - "<foreach collection='channelReducesToAdd' item='item' separator=','> ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )</foreach>" +
  29 + "<foreach collection='channelReducesToAdd' item='item' separator=','>" +
  30 + " ('${item.channelId}','${item.deviceId}', '${platformId}', '${item.deviceId}_${item.channelId}' )" +
  31 + "</foreach>" +
30 32 "</script>")
31 33 int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd);
32 34  
... ...
src/main/resources/application.yml
1 1 spring:
2 2 profiles:
3   - active: dev
4 3 \ No newline at end of file
  4 + active: local
5 5 \ No newline at end of file
... ...
src/main/resources/wvp.sqlite
No preview for this file type