Commit dab04fcab717350e4955a78324c49a6ca1cf2f1e
1 parent
82ab6b17
优化使用tcp连接时的超时时间
Showing
2 changed files
with
58 additions
and
8 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
| @@ -53,10 +53,15 @@ public class SipLayer{ | @@ -53,10 +53,15 @@ public class SipLayer{ | ||
| 53 | * gov/nist/javax/sip/SipStackImpl.class | 53 | * gov/nist/javax/sip/SipStackImpl.class |
| 54 | */ | 54 | */ |
| 55 | properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true"); | 55 | properties.setProperty("gov.nist.javax.sip.LOG_MESSAGE_CONTENT", "true"); |
| 56 | - properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true"); // 接收所有notify请求,即使没有订阅 | ||
| 57 | - properties.setProperty("gov.nist.javax.sip.DELIVER_TERMINATED_EVENT_FOR_NULL_DIALOG", "true"); // 为_NULL _对话框传递_终止的_事件 | ||
| 58 | - properties.setProperty("gov.nist.javax.sip.RELEASE_REFERENCES_STRATEGY", "Normal"); // 会话清理策略 | ||
| 59 | - properties.setProperty("gov.nist.javax.sip.RELIABLE_CONNECTION_KEEP_ALIVE_TIMEOUT", "10"); | 56 | + // 接收所有notify请求,即使没有订阅 |
| 57 | + properties.setProperty("gov.nist.javax.sip.DELIVER_UNSOLICITED_NOTIFY", "true"); | ||
| 58 | + // 为_NULL _对话框传递_终止的_事件 | ||
| 59 | + properties.setProperty("gov.nist.javax.sip.DELIVER_TERMINATED_EVENT_FOR_NULL_DIALOG", "true"); | ||
| 60 | + // 会话清理策略 | ||
| 61 | + properties.setProperty("gov.nist.javax.sip.RELEASE_REFERENCES_STRATEGY", "Normal"); | ||
| 62 | + // 处理由该服务器处理的基于底层TCP的保持生存超时 | ||
| 63 | + properties.setProperty("gov.nist.javax.sip.RELIABLE_CONNECTION_KEEP_ALIVE_TIMEOUT", "60"); | ||
| 64 | + | ||
| 60 | /** | 65 | /** |
| 61 | * sip_server_log.log 和 sip_debug_log.log public static final int TRACE_NONE = | 66 | * sip_server_log.log 和 sip_debug_log.log public static final int TRACE_NONE = |
| 62 | * 0; public static final int TRACE_MESSAGES = 16; public static final int | 67 | * 0; public static final int TRACE_MESSAGES = 16; public static final int |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -2,9 +2,7 @@ package com.genersoft.iot.vmp.service.impl; | @@ -2,9 +2,7 @@ package com.genersoft.iot.vmp.service.impl; | ||
| 2 | 2 | ||
| 3 | import java.math.BigDecimal; | 3 | import java.math.BigDecimal; |
| 4 | import java.math.RoundingMode; | 4 | import java.math.RoundingMode; |
| 5 | -import java.util.List; | ||
| 6 | -import java.util.Objects; | ||
| 7 | -import java.util.UUID; | 5 | +import java.util.*; |
| 8 | 6 | ||
| 9 | import javax.sip.ResponseEvent; | 7 | import javax.sip.ResponseEvent; |
| 10 | 8 | ||
| @@ -659,6 +657,53 @@ public class PlayServiceImpl implements IPlayService { | @@ -659,6 +657,53 @@ public class PlayServiceImpl implements IPlayService { | ||
| 659 | 657 | ||
| 660 | @Override | 658 | @Override |
| 661 | public void zlmServerOnline(String mediaServerId) { | 659 | public void zlmServerOnline(String mediaServerId) { |
| 662 | - // 似乎没啥需要做的 | 660 | + // TODO 查找之前的点播,流如果不存在则给下级发送bye |
| 661 | +// MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); | ||
| 662 | +// zlmresTfulUtils.getMediaList(mediaServerItem, (mediaList ->{ | ||
| 663 | +// Integer code = mediaList.getInteger("code"); | ||
| 664 | +// if (code == 0) { | ||
| 665 | +// JSONArray data = mediaList.getJSONArray("data"); | ||
| 666 | +// if (data == null || data.size() == 0) { | ||
| 667 | +// zlmServerOffline(mediaServerId); | ||
| 668 | +// }else { | ||
| 669 | +// Map<String, JSONObject> mediaListMap = new HashMap<>(); | ||
| 670 | +// for (int i = 0; i < data.size(); i++) { | ||
| 671 | +// JSONObject json = data.getJSONObject(i); | ||
| 672 | +// String app = json.getString("app"); | ||
| 673 | +// if ("rtp".equals(app)) { | ||
| 674 | +// String stream = json.getString("stream"); | ||
| 675 | +// if (mediaListMap.get(stream) != null) { | ||
| 676 | +// continue; | ||
| 677 | +// } | ||
| 678 | +// mediaListMap.put(stream, json); | ||
| 679 | +// // 处理正在观看的国标设备 | ||
| 680 | +// List<SsrcTransaction> ssrcTransactions = streamSession.getSsrcTransactionForAll(null, null, null, stream); | ||
| 681 | +// if (ssrcTransactions.size() > 0) { | ||
| 682 | +// for (SsrcTransaction ssrcTransaction : ssrcTransactions) { | ||
| 683 | +// if(ssrcTransaction.getMediaServerId().equals(mediaServerId)) { | ||
| 684 | +// cmder.streamByeCmd(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), | ||
| 685 | +// ssrcTransaction.getStream(), null); | ||
| 686 | +// } | ||
| 687 | +// } | ||
| 688 | +// } | ||
| 689 | +// } | ||
| 690 | +// } | ||
| 691 | +// if (mediaListMap.size() > 0 ) { | ||
| 692 | +// // 处理正在向上推流的上级平台 | ||
| 693 | +// List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServer(null); | ||
| 694 | +// if (sendRtpItems.size() > 0) { | ||
| 695 | +// for (SendRtpItem sendRtpItem : sendRtpItems) { | ||
| 696 | +// if (sendRtpItem.getMediaServerId().equals(mediaServerId)) { | ||
| 697 | +// if (mediaListMap.get(sendRtpItem.getStreamId()) == null) { | ||
| 698 | +// ParentPlatform platform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId()); | ||
| 699 | +// sipCommanderFroPlatform.streamByeCmd(platform, sendRtpItem.getCallId()); | ||
| 700 | +// } | ||
| 701 | +// } | ||
| 702 | +// } | ||
| 703 | +// } | ||
| 704 | +// } | ||
| 705 | +// } | ||
| 706 | +// } | ||
| 707 | +// })); | ||
| 663 | } | 708 | } |
| 664 | } | 709 | } |