Kaynağa Gözat

支持设置级联注册失败时再次注册的时间

64850858 4 yıl önce
ebeveyn
işleme
4c4b62cb3a

+ 6 - 1
src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java

@@ -34,6 +34,9 @@ public class SipConfig {
 	@Value("${sip.keepaliveTimeOut:180}")
 	Integer keepaliveTimeOut;
 
+	@Value("${sip.registerTimeInterval:60}")
+	Integer registerTimeInterval;
+
 	public String getMonitorIp() {
 		return monitorIp;
 	}
@@ -70,5 +73,7 @@ public class SipConfig {
 		return keepaliveTimeOut;
 	}
 
-
+	public Integer getRegisterTimeInterval() {
+		return registerTimeInterval;
+	}
 }

+ 5 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java

@@ -1,5 +1,6 @@
 package com.genersoft.iot.vmp.gb28181.event.platformNotRegister;
 
+import com.genersoft.iot.vmp.conf.SipConfig;
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
@@ -38,6 +39,9 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
     @Autowired
     private ZLMRTPServerFactory zlmrtpServerFactory;
 
+    @Autowired
+    private SipConfig config;
+
     // @Autowired
     // private RedisUtil redis;
 
@@ -90,6 +94,6 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf
                 logger.info("再次向平台注册,平台国标ID:" + event.getPlatformGbID());
                 sipCommanderFroPlatform.register(parentPlatform, null, okEvent);
             }
-        }, 15000, 15000);//十五秒后再次发起注册
+        }, config.getRegisterTimeInterval(), config.getRegisterTimeInterval());//十五秒后再次发起注册
     }
 }

+ 2 - 0
src/main/resources/all-application.yml

@@ -67,6 +67,8 @@ sip:
     password: admin123
     # [可选] 心跳超时时间, 建议设置为心跳周期的三倍
     keepaliveTimeOut: 180
+    # [可选] 国标级联注册失败,再次发起注册的时间间隔。 默认60秒
+    registerTimeInterval: 60
 
 #zlm 默认服务器配置
 media: