Commit 782300452cdc5ff9a8d02f0488fbb76d9d3fc92c
1 parent
d3027b06
优化对海康平台的兼容性
Showing
4 changed files
with
25 additions
and
2 deletions
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
| ... | ... | @@ -50,6 +50,8 @@ public class UserSetting { |
| 50 | 50 | private Boolean sipLog = Boolean.FALSE; |
| 51 | 51 | private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE; |
| 52 | 52 | |
| 53 | + private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE; | |
| 54 | + | |
| 53 | 55 | private String serverId = "000000"; |
| 54 | 56 | |
| 55 | 57 | private String thirdPartyGBIdReg = "[\\s\\S]*"; |
| ... | ... | @@ -237,4 +239,14 @@ public class UserSetting { |
| 237 | 239 | public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) { |
| 238 | 240 | this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost; |
| 239 | 241 | } |
| 242 | + | |
| 243 | + public Boolean getRefuseChannelStatusChannelFormNotify() { | |
| 244 | + return refuseChannelStatusChannelFormNotify; | |
| 245 | + } | |
| 246 | + | |
| 247 | + public void setRefuseChannelStatusChannelFormNotify(Boolean refuseChannelStatusChannelFormNotify) { | |
| 248 | + this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify; | |
| 249 | + } | |
| 250 | + | |
| 251 | + | |
| 240 | 252 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
| ... | ... | @@ -393,12 +393,20 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements |
| 393 | 393 | case CatalogEvent.OFF : |
| 394 | 394 | // 离线 |
| 395 | 395 | logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); |
| 396 | - storager.deviceChannelOffline(deviceId, channel.getChannelId()); | |
| 396 | + if (userSetting.getRefuseChannelStatusChannelFormNotify()) { | |
| 397 | + storager.deviceChannelOffline(deviceId, channel.getChannelId()); | |
| 398 | + }else { | |
| 399 | + logger.info("[收到通道离线通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 400 | + } | |
| 397 | 401 | break; |
| 398 | 402 | case CatalogEvent.VLOST: |
| 399 | 403 | // 视频丢失 |
| 400 | 404 | logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); |
| 401 | - storager.deviceChannelOffline(deviceId, channel.getChannelId()); | |
| 405 | + if (userSetting.getRefuseChannelStatusChannelFormNotify()) { | |
| 406 | + storager.deviceChannelOffline(deviceId, channel.getChannelId()); | |
| 407 | + }else { | |
| 408 | + logger.info("[收到通道视频丢失通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); | |
| 409 | + } | |
| 402 | 410 | break; |
| 403 | 411 | case CatalogEvent.DEFECT: |
| 404 | 412 | // 故障 | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| ... | ... | @@ -857,6 +857,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 857 | 857 | |
| 858 | 858 | @Override |
| 859 | 859 | public void sendAlarmMsg(AlarmChannelMessage msg) { |
| 860 | + // 此消息用于对接第三方服务下级来的消息内容 | |
| 860 | 861 | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; |
| 861 | 862 | logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg)); |
| 862 | 863 | RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); | ... | ... |
src/main/resources/all-application.yml
| ... | ... | @@ -201,6 +201,8 @@ user-settings: |
| 201 | 201 | sip-log: true |
| 202 | 202 | # 消息通道功能-缺少国标ID是否给所有上级发送消息 |
| 203 | 203 | send-to-platforms-when-id-lost: true |
| 204 | + # 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息 | |
| 205 | + refuse-channel-status-channel-form-notify: false | |
| 204 | 206 | # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个 |
| 205 | 207 | allowed-origins: |
| 206 | 208 | - http://localhost:8008 | ... | ... |