|
@@ -13,6 +13,9 @@ import com.genersoft.iot.vmp.service.IMediaServerService;
|
|
|
import com.genersoft.iot.vmp.service.IPlatformService;
|
|
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
|
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
|
|
+import com.genersoft.iot.vmp.vmanager.gb28181.device.DeviceQuery;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.CommandLineRunner;
|
|
|
import org.springframework.core.annotation.Order;
|
|
@@ -30,6 +33,7 @@ import java.util.Map;
|
|
|
@Component
|
|
|
@Order(value=14)
|
|
|
public class SipRunner implements CommandLineRunner {
|
|
|
+ private final static Logger logger = LoggerFactory.getLogger(SipRunner.class);
|
|
|
|
|
|
@Autowired
|
|
|
private IVideoManagerStorage storager;
|
|
@@ -57,8 +61,9 @@ public class SipRunner implements CommandLineRunner {
|
|
|
|
|
|
@Override
|
|
|
public void run(String... args) throws Exception {
|
|
|
- List<Device> deviceList = deviceService.getAllOnlineDevice();
|
|
|
|
|
|
+ // 设备状态检查
|
|
|
+ List<Device> deviceList = deviceService.getAllOnlineDevice();
|
|
|
for (Device device : deviceList) {
|
|
|
if (deviceService.expire(device)){
|
|
|
deviceService.offline(device.getDeviceId(), "注册已过期");
|
|
@@ -66,6 +71,10 @@ public class SipRunner implements CommandLineRunner {
|
|
|
deviceService.online(device);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
// 重置cseq计数
|
|
|
redisCatchStorage.resetAllCSEQ();
|
|
|
// 清理redis
|
|
@@ -111,5 +120,25 @@ public class SipRunner implements CommandLineRunner {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ // 每隔10分钟检查一次设备是否过期
|
|
|
+ new Thread(()->{
|
|
|
+ while (true) {
|
|
|
+ try {
|
|
|
+ Thread.sleep(1000 * 60 * 10);
|
|
|
+ } catch (InterruptedException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ logger.info("[定时任务] 检查设备是否过期");
|
|
|
+ List<Device> deviceList1 = deviceService.getAllOnlineDevice();
|
|
|
+ for (Device device : deviceList1) {
|
|
|
+ if (deviceService.expire(device)){
|
|
|
+ deviceService.offline(device.getDeviceId(), "注册已过期");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // todo 检查是否有异常推流
|
|
|
+ // logger.info("[定时任务] 检查是否有异常推流");
|
|
|
+ }
|
|
|
+ }).start();
|
|
|
}
|
|
|
}
|