增加设备上线判断双逻辑,兼容大华注册后不再发送注册的设备
parent
2cf7178cb7
commit
0ac27b03ff
|
@ -74,6 +74,8 @@ public class UserSetting {
|
||||||
|
|
||||||
private boolean registerKeepIntDialog = false;
|
private boolean registerKeepIntDialog = false;
|
||||||
|
|
||||||
|
private int gbDeviceOnline = 0;
|
||||||
|
|
||||||
public Boolean getSavePositionHistory() {
|
public Boolean getSavePositionHistory() {
|
||||||
return savePositionHistory;
|
return savePositionHistory;
|
||||||
}
|
}
|
||||||
|
@ -325,4 +327,12 @@ public class UserSetting {
|
||||||
public void setDocEnable(Boolean docEnable) {
|
public void setDocEnable(Boolean docEnable) {
|
||||||
this.docEnable = docEnable;
|
this.docEnable = docEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGbDeviceOnline() {
|
||||||
|
return gbDeviceOnline;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGbDeviceOnline(int gbDeviceOnline) {
|
||||||
|
this.gbDeviceOnline = gbDeviceOnline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,10 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
}
|
}
|
||||||
SIPRequest request = (SIPRequest) evt.getRequest();
|
SIPRequest request = (SIPRequest) evt.getRequest();
|
||||||
logger.info("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
logger.info("[收到心跳] device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
||||||
|
if (userSetting.getGbDeviceOnline() == 0 && !device.isOnLine()) {
|
||||||
|
logger.warn("[收到心跳] 设备离线,心跳不进行回复, device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 回复200 OK
|
// 回复200 OK
|
||||||
try {
|
try {
|
||||||
responseAck(request, Response.OK);
|
responseAck(request, Response.OK);
|
||||||
|
@ -101,9 +104,10 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
if (device.isOnLine()) {
|
if (device.isOnLine()) {
|
||||||
deviceService.updateDevice(device);
|
deviceService.updateDevice(device);
|
||||||
}else {
|
}else {
|
||||||
// 对于已经离线的设备判断他的注册是否已经过期
|
if (userSetting.getGbDeviceOnline() == 1) {
|
||||||
if (!deviceService.expire(device)){
|
// 对于已经离线的设备判断他的注册是否已经过期
|
||||||
device.setOnLine(false);
|
device.setOnLine(true);
|
||||||
|
device.setRegisterTime(DateUtil.getNow());
|
||||||
deviceService.online(device, null);
|
deviceService.online(device, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -247,6 +247,10 @@ user-settings:
|
||||||
allowed-origins:
|
allowed-origins:
|
||||||
- http://localhost:8008
|
- http://localhost:8008
|
||||||
- http://192.168.1.3:8008
|
- http://192.168.1.3:8008
|
||||||
|
# 国标设备离线后的上线策略,
|
||||||
|
# 0: 国标标准实现,设备离线后不回复心跳,知道设备重新注册上线,
|
||||||
|
# 1: 对于离线设备,收到心跳就把设备设置为上线,并更新注册时间为上次这次心跳的时间。防止过期时间判断u异常
|
||||||
|
gb-device-online: 0
|
||||||
|
|
||||||
# 关闭在线文档(生产环境建议关闭)
|
# 关闭在线文档(生产环境建议关闭)
|
||||||
springdoc:
|
springdoc:
|
||||||
|
|
Loading…
Reference in New Issue