Commit c33bf822cce59667be80ba0bb45499498501d161
1 parent
810dceea
修复级联的通道查询以及设备信息查询
Showing
8 changed files
with
22 additions
and
22 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
| @@ -74,5 +74,8 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | @@ -74,5 +74,8 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | ||
| 74 | device.setOnline(1); | 74 | device.setOnline(1); |
| 75 | // 处理上线监听 | 75 | // 处理上线监听 |
| 76 | storager.updateDevice(device); | 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,6 +100,6 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf | ||
| 100 | logger.info("再次向平台注册,平台国标ID:" + event.getPlatformGbID()); | 100 | logger.info("再次向平台注册,平台国标ID:" + event.getPlatformGbID()); |
| 101 | sipCommanderFroPlatform.register(parentPlatform, null, okEvent); | 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,7 +35,7 @@ import java.util.Vector; | ||
| 35 | @SuppressWarnings("rawtypes") | 35 | @SuppressWarnings("rawtypes") |
| 36 | public class InviteRequestProcessor extends SIPRequestAbstractProcessor { | 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 | private SIPCommanderFroPlatform cmderFroPlatform; | 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,11 +492,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 492 | String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); | 492 | String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
| 493 | // 查询设备是否存在 | 493 | // 查询设备是否存在 |
| 494 | Device device = storager.queryVideoDevice(deviceId); | 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 | Element rootElement = getRootElement(evt); | 497 | Element rootElement = getRootElement(evt); |
| 501 | String requestName = rootElement.getName(); | 498 | String requestName = rootElement.getName(); |
| 502 | Element deviceIdElement = rootElement.element("DeviceID"); | 499 | Element deviceIdElement = rootElement.element("DeviceID"); |
| @@ -508,20 +505,20 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | @@ -508,20 +505,20 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 508 | if (requestName.equals("Query")) { | 505 | if (requestName.equals("Query")) { |
| 509 | logger.info("接收到DeviceInfo查询消息"); | 506 | logger.info("接收到DeviceInfo查询消息"); |
| 510 | FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); | 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 | response404Ack(evt); | 509 | response404Ack(evt); |
| 514 | return; | 510 | return; |
| 515 | } else { | 511 | } else { |
| 516 | // 回复200 OK | 512 | // 回复200 OK |
| 517 | responseAck(evt); | 513 | responseAck(evt); |
| 518 | String sn = rootElement.element("SN").getText(); | 514 | String sn = rootElement.element("SN").getText(); |
| 519 | - ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); | ||
| 520 | cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag()); | 515 | cmderFroPlatform.deviceInfoResponse(parentPlatform, sn, fromHeader.getTag()); |
| 521 | } | 516 | } |
| 522 | } else { | 517 | } else { |
| 523 | logger.debug("接收到DeviceInfo应答消息"); | 518 | logger.debug("接收到DeviceInfo应答消息"); |
| 524 | if (device == null) { | 519 | if (device == null) { |
| 520 | + logger.warn("处理DeviceInfo设备信息Message时未找到设备信息"); | ||
| 521 | + response404Ack(evt); | ||
| 525 | return; | 522 | return; |
| 526 | } | 523 | } |
| 527 | 524 | ||
| @@ -561,11 +558,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | @@ -561,11 +558,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 561 | String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); | 558 | String deviceId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
| 562 | // 查询设备是否存在 | 559 | // 查询设备是否存在 |
| 563 | Device device = storager.queryVideoDevice(deviceId); | 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 | Element rootElement = getRootElement(evt); | 564 | Element rootElement = getRootElement(evt); |
| 571 | String name = rootElement.getName(); | 565 | String name = rootElement.getName(); |
| @@ -574,13 +568,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | @@ -574,13 +568,8 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 574 | Element deviceListElement = rootElement.element("DeviceList"); | 568 | Element deviceListElement = rootElement.element("DeviceList"); |
| 575 | String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; | 569 | String key = DeferredResultHolder.CALLBACK_CMD_CATALOG + deviceId; |
| 576 | FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); | 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 | if (name.equalsIgnoreCase("Query")) { // 区分是Response——查询响应,还是Query——查询请求 | 571 | if (name.equalsIgnoreCase("Query")) { // 区分是Response——查询响应,还是Query——查询请求 |
| 582 | // TODO 后续将代码拆分 | 572 | // TODO 后续将代码拆分 |
| 583 | - ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); | ||
| 584 | if (parentPlatform == null) { | 573 | if (parentPlatform == null) { |
| 585 | response404Ack(evt); | 574 | response404Ack(evt); |
| 586 | return; | 575 | return; |
| @@ -634,6 +623,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | @@ -634,6 +623,11 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 634 | 623 | ||
| 635 | 624 | ||
| 636 | } else { | 625 | } else { |
| 626 | + if (device == null) { | ||
| 627 | + logger.warn("收到catalog设备目录列表请求时未找到设备信息"); | ||
| 628 | + response404Ack(evt); | ||
| 629 | + return; | ||
| 630 | + } | ||
| 637 | deviceListElement = getRootElement(evt, device.getCharset()).element("DeviceList"); | 631 | deviceListElement = getRootElement(evt, device.getCharset()).element("DeviceList"); |
| 638 | Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); | 632 | Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); |
| 639 | if (deviceListIterator != null) { | 633 | if (deviceListIterator != null) { |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -326,6 +326,7 @@ public class ZLMHttpHookListener { | @@ -326,6 +326,7 @@ public class ZLMHttpHookListener { | ||
| 326 | String streamId = json.getString("stream"); | 326 | String streamId = json.getString("stream"); |
| 327 | String app = json.getString("app"); | 327 | String app = json.getString("app"); |
| 328 | 328 | ||
| 329 | + // TODO 如果在给上级推流,也不停止。 | ||
| 329 | if ("rtp".equals(app)){ | 330 | if ("rtp".equals(app)){ |
| 330 | JSONObject ret = new JSONObject(); | 331 | JSONObject ret = new JSONObject(); |
| 331 | ret.put("code", 0); | 332 | ret.put("code", 0); |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
| @@ -26,7 +26,9 @@ public interface PlatformChannelMapper { | @@ -26,7 +26,9 @@ public interface PlatformChannelMapper { | ||
| 26 | 26 | ||
| 27 | @Insert("<script> "+ | 27 | @Insert("<script> "+ |
| 28 | "INSERT INTO platform_gb_channel (channelId, deviceId, platformId, deviceAndChannelId) VALUES" + | 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 | "</script>") | 32 | "</script>") |
| 31 | int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); | 33 | int addChannels(String platformId, List<ChannelReduce> channelReducesToAdd); |
| 32 | 34 |
src/main/resources/application.yml
src/main/resources/wvp.sqlite
No preview for this file type