From dab04fcab717350e4955a78324c49a6ca1cf2f1e Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 11 八月 2022 16:37:55 +0800
Subject: [PATCH] 优化使用tcp连接时的超时时间
---
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java | 13 ++++--
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 53 ++++++++++++++++++++++++--
2 files changed, 58 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..c1811bf 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
@@ -53,10 +53,15 @@
* 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");
+ // 鎺ユ敹鎵�鏈塶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
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
index 96acbf6..0c571e9 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
@@ -2,9 +2,7 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
-import java.util.List;
-import java.util.Objects;
-import java.util.UUID;
+import java.util.*;
import javax.sip.ResponseEvent;
@@ -659,6 +657,53 @@
@Override
public void zlmServerOnline(String mediaServerId) {
- // 浼间箮娌″暐闇�瑕佸仛鐨�
+ // TODO 鏌ユ壘涔嬪墠鐨勭偣鎾紝娴佸鏋滀笉瀛樺湪鍒欑粰涓嬬骇鍙戦�乥ye
+// MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
+// zlmresTfulUtils.getMediaList(mediaServerItem, (mediaList ->{
+// Integer code = mediaList.getInteger("code");
+// if (code == 0) {
+// JSONArray data = mediaList.getJSONArray("data");
+// if (data == null || data.size() == 0) {
+// zlmServerOffline(mediaServerId);
+// }else {
+// Map<String, JSONObject> mediaListMap = new HashMap<>();
+// for (int i = 0; i < data.size(); i++) {
+// JSONObject json = data.getJSONObject(i);
+// String app = json.getString("app");
+// if ("rtp".equals(app)) {
+// String stream = json.getString("stream");
+// if (mediaListMap.get(stream) != null) {
+// continue;
+// }
+// mediaListMap.put(stream, json);
+// // 澶勭悊姝e湪瑙傜湅鐨勫浗鏍囪澶�
+// List<SsrcTransaction> ssrcTransactions = streamSession.getSsrcTransactionForAll(null, null, null, stream);
+// if (ssrcTransactions.size() > 0) {
+// for (SsrcTransaction ssrcTransaction : ssrcTransactions) {
+// if(ssrcTransaction.getMediaServerId().equals(mediaServerId)) {
+// cmder.streamByeCmd(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(),
+// ssrcTransaction.getStream(), null);
+// }
+// }
+// }
+// }
+// }
+// if (mediaListMap.size() > 0 ) {
+// // 澶勭悊姝e湪鍚戜笂鎺ㄦ祦鐨勪笂绾у钩鍙�
+// List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServer(null);
+// if (sendRtpItems.size() > 0) {
+// for (SendRtpItem sendRtpItem : sendRtpItems) {
+// if (sendRtpItem.getMediaServerId().equals(mediaServerId)) {
+// if (mediaListMap.get(sendRtpItem.getStreamId()) == null) {
+// ParentPlatform platform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
+// sipCommanderFroPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
+// }
+// }
+// }
+// }
+// }
+// }
+// }
+// }));
}
}
--
Gitblit v1.8.0