From 2b1f7a47394363e95deb4dfa0f1c67d41e747f7f Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期三, 01 二月 2023 10:56:40 +0800 Subject: [PATCH] Merge branch 'wvp-28181-2.0' into fix-269 --- src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java | 78 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 78 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java new file mode 100644 index 0000000..3cdf48d --- /dev/null +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/conf/DefaultProperties.java @@ -0,0 +1,78 @@ +package com.genersoft.iot.vmp.gb28181.conf; + +import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd.AlarmNotifyMessageHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Properties; + +/** + * 鑾峰彇sip榛樿閰嶇疆 + * @author lin + */ +public class DefaultProperties { + + public static Properties getProperties(String ip, boolean isDebug, boolean sipLog) { + Properties properties = new Properties(); + properties.setProperty("javax.sip.STACK_NAME", "GB28181_SIP"); + properties.setProperty("javax.sip.IP_ADDRESS", ip); + // 鍏抽棴鑷姩浼氳瘽 + properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off"); + /** + * 瀹屾暣閰嶇疆鍙傝�� gov.nist.javax.sip.SipStackImpl锛岄渶瑕佷笅杞芥簮鐮� + * gov/nist/javax/sip/SipStackImpl.class + * sip娑堟伅鐨勮В鏋愬湪 gov.nist.javax.sip.stack.UDPMessageChannel鐨刾rocessIncomingDataPacket鏂规硶 + */ + +// * gov/nist/javax/sip/SipStackImpl.class + if (isDebug) { + properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "false"); + } + // 鎺ユ敹鎵�鏈塶otify璇锋眰锛屽嵆浣挎病鏈夎闃� + properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true"); + properties.setProperty("gov.nist.javax.sip.AUTOMATIC_DIALOG_ERROR_HANDLING", "false"); + properties.setProperty("gov.nist.javax.sip.CANCEL_CLIENT_TRANSACTION_CHECKED", "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"); + // 鑾峰彇瀹為檯鍐呭闀垮害锛屼笉浣跨敤header涓殑闀垮害淇℃伅 + properties.setProperty("gov.nist.javax.sip.COMPUTE_CONTENT_LENGTH_FROM_MESSAGE_BODY", "true"); + // 绾跨▼鍙噸鍏� + properties.setProperty("gov.nist.javax.sip.REENTRANT_LISTENER", "true"); + // 瀹氫箟搴旂敤绋嬪簭鎵撶畻澶氫箙瀹¤涓�娆� SIP 鍫嗘爤锛屼簡瑙e叾鍐呴儴绾跨▼鐨勫仴搴风姸鍐碉紙璇ュ睘鎬ф寚瀹氳繛缁璁′箣闂寸殑鏃堕棿锛堜互姣涓哄崟浣嶏級锛� + properties.setProperty("gov.nist.javax.sip.THREAD_AUDIT_INTERVAL_IN_MILLISECS", "30000"); + + /** + * sip_server_log.log 鍜� sip_debug_log.log ERROR, INFO, WARNING, OFF, DEBUG, TRACE + */ + Logger logger = LoggerFactory.getLogger(AlarmNotifyMessageHandler.class); + if (sipLog) { + if (logger.isDebugEnabled()) { + System.out.println("DEBUG"); + properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "DEBUG"); + }else if (logger.isInfoEnabled()) { + System.out.println("INFO1"); + properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "INFO"); + }else if (logger.isWarnEnabled()) { + System.out.println("WARNING"); + properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "WARNING"); + }else if (logger.isErrorEnabled()) { + System.out.println("ERROR"); + properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "ERROR"); + }else { + System.out.println("INFO2"); + properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "INFO"); + } + logger.info("[SIP鏃ュ織]绾у埆涓�: {}", properties.getProperty("gov.nist.javax.sip.TRACE_LEVEL")); + }else { + logger.info("[SIP鏃ュ織]宸插叧闂�"); + } + + + + return properties; + } +} -- Gitblit v1.8.0