From 6e90050db47ca1d9ecec3de6bd95ea1bd1ca4060 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期一, 29 八月 2022 11:50:36 +0800
Subject: [PATCH] 去除zlm使用redis过期作为心跳超时的方式

---
 src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java |   27 +++++++++++++++++++--------
 1 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
index a3428b1..29253e7 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
@@ -2,8 +2,10 @@
 
 import com.genersoft.iot.vmp.conf.SipConfig;
 import com.genersoft.iot.vmp.gb28181.transmit.ISIPProcessorObserver;
+import com.genersoft.iot.vmp.utils.DateUtil;
 import gov.nist.javax.sip.SipProviderImpl;
 import gov.nist.javax.sip.SipStackImpl;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +15,7 @@
 import org.springframework.stereotype.Component;
 
 import javax.sip.*;
+import java.text.DateFormat;
 import java.util.Properties;
 import java.util.TooManyListenersException;
 import java.util.concurrent.LinkedBlockingQueue;
@@ -52,19 +55,27 @@
 		 * 瀹屾暣閰嶇疆鍙傝�� gov.nist.javax.sip.SipStackImpl锛岄渶瑕佷笅杞芥簮鐮�
 		 * gov/nist/javax/sip/SipStackImpl.class
 		 */
-		properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true");
-		properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true"); // 鎺ユ敹鎵�鏈塶otify璇锋眰锛屽嵆浣挎病鏈夎闃�
-		properties.setProperty("gov.nist.javax.sip.DELIVER_TERMINATED_EVENT_FOR_NULL_DIALOG", "true"); // 涓篲NULL _瀵硅瘽妗嗕紶閫抇缁堟鐨刜浜嬩欢
-		properties.setProperty("gov.nist.javax.sip.RELEASE_REFERENCES_STRATEGY", "Normal"); // 浼氳瘽娓呯悊绛栫暐
-		properties.setProperty("gov.nist.javax.sip.RELIABLE_CONNECTION_KEEP_ALIVE_TIMEOUT", "10");
+		if (logger.isDebugEnabled()) {
+			properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true");
+		}
+		// 鎺ユ敹鎵�鏈塶otify璇锋眰锛屽嵆浣挎病鏈夎闃�
+		properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true");
+		// 涓篲NULL _瀵硅瘽妗嗕紶閫抇缁堟鐨刜浜嬩欢
+		properties.setProperty("gov.nist.javax.sip.DELIVER_TERMINATED_EVENT_FOR_NULL_DIALOG", "true");
+		// 浼氳瘽娓呯悊绛栫暐
+		properties.setProperty("gov.nist.javax.sip.RELEASE_REFERENCES_STRATEGY", "Normal");
+		// 澶勭悊鐢辫鏈嶅姟鍣ㄥ鐞嗙殑鍩轰簬搴曞眰TCP鐨勪繚鎸佺敓瀛樿秴鏃�
+		properties.setProperty("gov.nist.javax.sip.RELIABLE_CONNECTION_KEEP_ALIVE_TIMEOUT", "60");
+
 		/**
 		 * sip_server_log.log 鍜� sip_debug_log.log public static final int TRACE_NONE =
 		 * 0; public static final int TRACE_MESSAGES = 16; public static final int
 		 * TRACE_EXCEPTION = 17; public static final int TRACE_DEBUG = 32;
 		 */
-		properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "0");
-		properties.setProperty("gov.nist.javax.sip.SERVER_LOG", "sip_server_log");
-		properties.setProperty("gov.nist.javax.sip.DEBUG_LOG", "sip_debug_log");
+		if (logger.isDebugEnabled()) {
+			properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG");
+		}
+		properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "INFO");
 		sipStack = (SipStackImpl) sipFactory.createSipStack(properties);
 
 		return sipStack;

--
Gitblit v1.8.0