diff --git a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java index 130d147d..d72d255b 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java @@ -50,6 +50,8 @@ public class UserSetting { private Boolean sipLog = Boolean.FALSE; private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE; + private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE; + private String serverId = "000000"; private String thirdPartyGBIdReg = "[\\s\\S]*"; @@ -237,4 +239,14 @@ public class UserSetting { public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) { this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost; } + + public Boolean getRefuseChannelStatusChannelFormNotify() { + return refuseChannelStatusChannelFormNotify; + } + + public void setRefuseChannelStatusChannelFormNotify(Boolean refuseChannelStatusChannelFormNotify) { + this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify; + } + + } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java index 7366f300..990da3a0 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java @@ -393,12 +393,20 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements case CatalogEvent.OFF : // 离线 logger.info("[收到通道离线通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); - storager.deviceChannelOffline(deviceId, channel.getChannelId()); + if (userSetting.getRefuseChannelStatusChannelFormNotify()) { + storager.deviceChannelOffline(deviceId, channel.getChannelId()); + }else { + logger.info("[收到通道离线通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); + } break; case CatalogEvent.VLOST: // 视频丢失 logger.info("[收到通道视频丢失通知] 来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); - storager.deviceChannelOffline(deviceId, channel.getChannelId()); + if (userSetting.getRefuseChannelStatusChannelFormNotify()) { + storager.deviceChannelOffline(deviceId, channel.getChannelId()); + }else { + logger.info("[收到通道视频丢失通知] 但是平台已配置拒绝此消息,来自设备: {}, 通道 {}", device.getDeviceId(), channel.getChannelId()); + } break; case CatalogEvent.DEFECT: // 故障 diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java index f9e0c068..8902641c 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java @@ -857,6 +857,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { @Override public void sendAlarmMsg(AlarmChannelMessage msg) { + // 此消息用于对接第三方服务下级来的消息内容 String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM; logger.info("[redis发送通知] 报警{}: {}", key, JSON.toJSON(msg)); RedisUtil.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index 8b9b7b03..8bc4d957 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -201,6 +201,8 @@ user-settings: sip-log: true # 消息通道功能-缺少国标ID是否给所有上级发送消息 send-to-platforms-when-id-lost: true + # 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息 + refuse-channel-status-channel-form-notify: false # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个 allowed-origins: - http://localhost:8008