From becea82736dcfc833d1d68021fc3baf1e23acc36 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期二, 04 七月 2023 10:10:48 +0800
Subject: [PATCH] Merge branch 'wvp-28181-2.0' into main-dev

---
 src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherRtpSendInfo.java                             |  135 +++++++++++++++
 src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java               |    4 
 src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java                           |    5 
 src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java                               |   13 +
 web_src/src/components/dialog/catalogEdit.vue                                                       |   59 +++---
 src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java                                 |  160 ++++++++++++++++-
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java    |    4 
 src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java                               |    1 
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java |   15 
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java                              |   48 ++--
 src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java                        |   15 
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java    |    8 
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java          |    3 
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java                              |    4 
 src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java                        |    8 
 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java      |    4 
 src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java                                 |    2 
 src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java                    |   10 
 18 files changed, 392 insertions(+), 106 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
index 9f4ec91..e82140f 100644
--- a/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
+++ b/src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
@@ -158,6 +158,7 @@
 
 	public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_";
 	public static final String WVP_STREAM_GPS_MSG_PREFIX = "WVP_STREAM_GPS_MSG_";
+	public static final String WVP_OTHER_SEND_RTP_INFO = "VMP_OTHER_SEND_RTP_INFO_";
 
 	/**
 	 * Redis Const
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
index 47097a4..2e960b5 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
@@ -18,6 +18,7 @@
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.media.zlm.dto.hook.HookParam;
 import com.genersoft.iot.vmp.service.IMediaServerService;
@@ -68,7 +69,7 @@
     private SipSubscribe sipSubscribe;
 
     @Autowired
-    private ZLMRTPServerFactory zlmrtpServerFactory;
+    private ZLMServerFactory ZLMServerFactory;
 
     @Autowired
     private SipLayer sipLayer;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
index 7ca52ef..0e09046 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
@@ -9,7 +9,7 @@
 import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver;
 import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
-import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.service.IDeviceService;
@@ -66,7 +66,7 @@
 	private IDeviceService deviceService;
 
 	@Autowired
-	private ZLMRTPServerFactory zlmrtpServerFactory;
+	private ZLMServerFactory ZLMServerFactory;
 
 	@Autowired
 	private ZlmHttpHookSubscribe hookSubscribe;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
index c2a50e4..75fbea3 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
@@ -13,7 +13,7 @@
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
 import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor;
 import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
-import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.service.*;
 import com.genersoft.iot.vmp.service.bean.MessageForPushChannel;
@@ -72,7 +72,7 @@
 	private IVideoManagerStorage storager;
 
 	@Autowired
-	private ZLMRTPServerFactory zlmrtpServerFactory;
+	private ZLMServerFactory ZLMServerFactory;
 
 	@Autowired
 	private SSRCFactory ssrcFactory;
@@ -125,7 +125,7 @@
 			MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
 			redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(),
 					callIdHeader.getCallId(), null);
-			zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
+			ZLMServerFactory.stopSendRtpStream(mediaInfo, param);
 			if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) {
 				ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
 				if (platform != null) {
@@ -139,7 +139,7 @@
 				}
 			}
 
-			int totalReaderCount = zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId);
+			int totalReaderCount = ZLMServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId);
 			if (totalReaderCount <= 0) {
 				logger.info("[鏀跺埌bye] {} 鏃犲叾瀹冭鐪嬭�咃紝閫氱煡璁惧鍋滄鎺ㄦ祦", streamId);
 				if (sendRtpItem.getPlayType().equals(InviteStreamType.PLAY)) {
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
index 7594b48..f1f7efc 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -20,6 +20,7 @@
 import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager;
 import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
 import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.*;
 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
@@ -102,7 +103,7 @@
     private AudioBroadcastManager audioBroadcastManager;
 
     @Autowired
-    private ZLMRTPServerFactory zlmrtpServerFactory;
+    private ZLMServerFactory ZLMServerFactory;
 
     @Autowired
     private IMediaServerService mediaServerService;
@@ -374,7 +375,7 @@
                         streamTypeStr = "UDP";
                     }
                     logger.info("[涓婄骇Invite] {}, 骞冲彴锛歿}锛� 閫氶亾锛歿}, 鏀舵祦鍦板潃锛歿}:{}锛屾敹娴佹柟寮忥細{}, ssrc锛歿}", sessionName, username, channelId, addressStr, port, streamTypeStr, ssrc);
-                    SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
+                    SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
                             device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp());
 
                     if (tcpActive != null) {
@@ -577,10 +578,10 @@
                             CallIdHeader callIdHeader, MediaServerItem mediaServerItem,
                             int port, Boolean tcpActive, boolean mediaTransmissionTCP,
                             String channelId, String addressStr, String ssrc, String requesterId) {
-            Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
+            Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
             if (streamReady != null && streamReady) {
                 // 鑷钩鍙板唴瀹�
-                SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
+                SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
                         gbStream.getApp(), gbStream.getStream(), channelId, mediaTransmissionTCP, platform.isRtcp());
 
             if (sendRtpItem == null) {
@@ -617,10 +618,10 @@
                             String channelId, String addressStr, String ssrc, String requesterId) {
         // 鎺ㄦ祦
         if (streamPushItem.isSelf()) {
-            Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
+            Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream());
             if (streamReady != null && streamReady) {
                 // 鑷钩鍙板唴瀹�
-                SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
+                SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId,
                         gbStream.getApp(), gbStream.getStream(), channelId, mediaTransmissionTCP, platform.isRtcp());
 
                 if (sendRtpItem == null) {
@@ -735,7 +736,7 @@
             mediaListManager.addChannelOnlineEventLister(gbStream.getApp(), gbStream.getStream(), (app, stream, serverId) -> {
                 dynamicTask.stop(callIdHeader.getCallId());
                 if (serverId.equals(userSetting.getServerId())) {
-                    SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, finalPort, ssrc, requesterId,
+                    SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, addressStr, finalPort, ssrc, requesterId,
                             app, stream, channelId, mediaTransmissionTCP, platform.isRtcp());
 
                     if (sendRtpItem == null) {
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index b4a47c8..845d1e9 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -454,33 +454,35 @@
                                 GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream());
                                 if (gbStream != null) {
 //									eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF);
-                                }
-                                zlmMediaListManager.removeMedia(param.getApp(), param.getStream());
                             }
-                            GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream());
-                            if (gbStream != null) {
-                                eventPublisher.catalogEventPublishForStream(null, gbStream, param.isRegist() ? CatalogEvent.ON : CatalogEvent.OFF);
-                            }
-                            if (type != null) {
-                                // 鍙戦�佹祦鍙樺寲redis娑堟伅
-                                JSONObject jsonObject = new JSONObject();
-                                jsonObject.put("serverId", userSetting.getServerId());
-                                jsonObject.put("app", param.getApp());
-                                jsonObject.put("stream", param.getStream());
-                                jsonObject.put("register", param.isRegist());
-                                jsonObject.put("mediaServerId", param.getMediaServerId());
-                                redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
+                            zlmMediaListManager.removeMedia(param.getApp(), param.getStream());
+                        }
+                        GbStream gbStream = storager.getGbStream(param.getApp(), param.getStream());
+                        if (gbStream != null) {
+                            if (userSetting.isUsePushingAsStatus()) {
+                                eventPublisher.catalogEventPublishForStream(null, gbStream, param.isRegist()?CatalogEvent.ON:CatalogEvent.OFF);
                             }
                         }
+                        if (type != null) {
+                            // 鍙戦�佹祦鍙樺寲redis娑堟伅
+                            JSONObject jsonObject = new JSONObject();
+                            jsonObject.put("serverId", userSetting.getServerId());
+                            jsonObject.put("app", param.getApp());
+                            jsonObject.put("stream", param.getStream());
+                            jsonObject.put("register", param.isRegist());
+                            jsonObject.put("mediaServerId", param.getMediaServerId());
+                            redisCatchStorage.sendStreamChangeMsg(type, jsonObject);
+                        }
                     }
-                    if (!param.isRegist()) {
-                        List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(param.getStream());
-                        if (sendRtpItems.size() > 0) {
-                            for (SendRtpItem sendRtpItem : sendRtpItems) {
-                                if (sendRtpItem != null && sendRtpItem.getApp().equals(param.getApp())) {
-                                    String platformId = sendRtpItem.getPlatformId();
-                                    ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
-                                    Device device = deviceService.getDevice(platformId);
+                }
+                if (!param.isRegist()) {
+                    List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(param.getStream());
+                    if (sendRtpItems.size() > 0) {
+                        for (SendRtpItem sendRtpItem : sendRtpItems) {
+                            if (sendRtpItem != null && sendRtpItem.getApp().equals(param.getApp())) {
+                                String platformId = sendRtpItem.getPlatformId();
+                                ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
+                                Device device = deviceService.getDevice(platformId);
 
                                     try {
                                         if (platform != null) {
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
index 8e9b3d0..41ef4d0 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
@@ -61,7 +61,7 @@
     private UserSetting userSetting;
 
     @Autowired
-    private ZLMRTPServerFactory zlmrtpServerFactory;
+    private ZLMServerFactory ZLMServerFactory;
 
     @Autowired
     private IMediaServerService mediaServerService;
@@ -97,7 +97,7 @@
     public void sendStreamEvent(String app, String stream, String mediaServerId) {
         MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId);
         // 鏌ョ湅鎺ㄦ祦鐘舵��
-        Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, app, stream);
+        Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, app, stream);
         if (streamReady != null && streamReady) {
             ChannelOnlineEvent channelOnlineEventLister = getChannelOnlineEventLister(app, stream);
             if (channelOnlineEventLister != null)  {
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java
similarity index 99%
rename from src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
rename to src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java
index 48fb00d..c81e00d 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java
@@ -15,7 +15,7 @@
 import java.util.Map;
 
 @Component
-public class ZLMRTPServerFactory {
+public class ZLMServerFactory {
 
     private Logger logger = LoggerFactory.getLogger("ZLMRTPServerFactory");
 
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
index 2fd13ec..0597ea4 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
@@ -87,7 +87,7 @@
 
 
     @Autowired
-    private ZLMRTPServerFactory zlmrtpServerFactory;
+    private ZLMServerFactory ZLMServerFactory;
 
     @Autowired
     private EventPublisher publisher;
@@ -201,7 +201,7 @@
         if (mediaServerItem == null) {
             return;
         }
-        zlmrtpServerFactory.closeRtpServer(mediaServerItem, streamId);
+        ZLMServerFactory.closeRtpServer(mediaServerItem, streamId);
     }
 
     @Override
@@ -210,7 +210,7 @@
             callback.run(false);
             return;
         }
-        zlmrtpServerFactory.closeRtpServer(mediaServerItem, streamId, callback);
+        ZLMServerFactory.closeRtpServer(mediaServerItem, streamId, callback);
     }
 
     @Override
@@ -221,7 +221,7 @@
 
     @Override
     public Boolean updateRtpServerSSRC(MediaServerItem mediaServerItem, String streamId, String ssrc) {
-        return zlmrtpServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc);
+        return ZLMServerFactory.updateRtpServerSSRC(mediaServerItem, streamId, ssrc);
     }
 
     @Override
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
index c43591b..caa72b4 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
@@ -14,6 +14,7 @@
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
 import com.genersoft.iot.vmp.service.IInviteStreamService;
@@ -83,7 +84,7 @@
     private DynamicTask dynamicTask;
 
     @Autowired
-    private ZLMRTPServerFactory zlmrtpServerFactory;
+    private ZLMServerFactory ZLMServerFactory;
 
     @Autowired
     private SubscribeHolder subscribeHolder;
@@ -364,7 +365,7 @@
                 param.put("vhost", "__defaultVhost__");
                 param.put("app", sendRtpItem.getApp());
                 param.put("stream", sendRtpItem.getStream());
-                zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param);
+                ZLMServerFactory.stopSendRtpStream(mediaInfo, param);
             }
         }
     }
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 ea998e9..2cb052e 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
@@ -20,6 +20,11 @@
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
 import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
 import com.genersoft.iot.vmp.media.zlm.*;
+import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform;
+import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils;
+import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
+import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
@@ -96,6 +101,9 @@
     private ZLMRESTfulUtils zlmresTfulUtils;
 
     @Autowired
+    private ZLMServerFactory ZLMServerFactory;
+
+    @Autowired
     private AssistRESTfulUtils assistRESTfulUtils;
 
     @Autowired
@@ -167,7 +175,7 @@
                 String mediaServerId = streamInfo.getMediaServerId();
                 MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
 
-                Boolean ready = zlmrtpServerFactory.isStreamReady(mediaInfo, "rtp", streamId);
+                Boolean ready = ZLMServerFactory.isStreamReady(mediaInfo, "rtp", streamId);
                 if (ready != null && ready) {
                     callback.run(InviteErrorCode.SUCCESS.getCode(), InviteErrorCode.SUCCESS.getMsg(), streamInfo);
                     inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
@@ -183,12 +191,11 @@
                 }
             }
         }
-
         String streamId = null;
         if (mediaServerItem.isRtpEnable()) {
             streamId = String.format("%s_%s", device.getDeviceId(), channelId);
         }
-        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, null, device.isSsrcCheck(),  false, 0,  false, false, device.getStreamModeForParam());
+        SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, streamId, null, device.isSsrcCheck(),  false, 0, false, device.getStreamModeForParam());
         if (ssrcInfo == null) {
             callback.run(InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getCode(), InviteErrorCode.ERROR_FOR_RESOURCE_EXHAUSTION.getMsg(), null);
             inviteStreamService.call(InviteSessionType.PLAY, device.getDeviceId(), channelId, null,
diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java
index d46f909..9b8e312 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisGbPlayMsgListener.java
@@ -6,7 +6,7 @@
 import com.genersoft.iot.vmp.conf.DynamicTask;
 import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
-import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
@@ -72,7 +72,7 @@
     private RedisTemplate<Object, Object> redisTemplate;
 
     @Autowired
-    private ZLMRTPServerFactory zlmrtpServerFactory;
+    private ZLMServerFactory ZLMServerFactory;
 
     @Autowired
     private IMediaServerService mediaServerService;
@@ -230,7 +230,7 @@
         param.put("pt", requestPushStreamMsg.getPt());
         param.put("use_ps", requestPushStreamMsg.isPs() ? "1" : "0");
         param.put("only_audio", requestPushStreamMsg.isOnlyAudio() ? "1" : "0");
-        JSONObject jsonObject = zlmrtpServerFactory.startSendRtpStream(mediaInfo, param);
+        JSONObject jsonObject = ZLMServerFactory.startSendRtpStream(mediaInfo, param);
         // 鍥炲娑堟伅
         responsePushStream(jsonObject, fromId, serial);
     }
@@ -267,7 +267,7 @@
             return;
         }
         // 纭畾娴佹槸鍚﹀湪绾�
-        Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, content.getApp(), content.getStream());
+        Boolean streamReady = ZLMServerFactory.isStreamReady(mediaServerItem, content.getApp(), content.getStream());
         if (streamReady != null && streamReady) {
             logger.info("[鍥炲鎺ㄦ祦淇℃伅]  {}/{}", content.getApp(), content.getStream());
             responseSendItem(mediaServerItem, content, toId, serial);
@@ -311,7 +311,7 @@
      * 灏嗚幏鍙栧埌鐨剆endItem鍙戦�佸嚭鍘�
      */
     private void responseSendItem(MediaServerItem mediaServerItem, RequestSendItemMsg content, String toId, String serial) {
-        SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, content.getIp(),
+        SendRtpItem sendRtpItem = ZLMServerFactory.createSendRtpItem(mediaServerItem, content.getIp(),
                 content.getPort(), content.getSsrc(), content.getPlatformId(),
                 content.getApp(), content.getStream(), content.getChannelId(),
                 content.getTcp(), content.getRtcp());
diff --git a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java
index aa00cae..c0987b5 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamCloseResponseListener.java
@@ -6,7 +6,7 @@
 import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
 import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
-import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
 import com.genersoft.iot.vmp.service.IMediaServerService;
@@ -58,7 +58,7 @@
     private IMediaServerService mediaServerService;
 
     @Autowired
-    private ZLMRTPServerFactory zlmrtpServerFactory;
+    private ZLMServerFactory ZLMServerFactory;
 
 
     private Map<String, PushStreamResponseEvent> responseEvents = new ConcurrentHashMap<>();
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
index 1d69071..eeb0e62 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
@@ -304,7 +304,7 @@
     @Override
     public void sendStreamChangeMsg(String type, JSONObject jsonObject) {
         String key = VideoManagerConstants.WVP_MSG_STREAM_CHANGE_PREFIX + type;
-        logger.info("[redis 娴佸彉鍖栦簨浠禲 {}: {}", key, jsonObject.toString());
+        logger.info("[redis 娴佸彉鍖栦簨浠禲 鍙戦�� {}: {}", key, jsonObject.toString());
         redisTemplate.convertAndSend(key, jsonObject);
     }
 
@@ -540,14 +540,14 @@
     @Override
     public void sendMobilePositionMsg(JSONObject jsonObject) {
         String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION;
-        logger.info("[redis鍙戦�侀�氱煡] 绉诲姩浣嶇疆 {}: {}", key, jsonObject.toString());
+        logger.info("[redis鍙戦�侀�氱煡] 鍙戦�� 绉诲姩浣嶇疆 {}: {}", key, jsonObject.toString());
         redisTemplate.convertAndSend(key, jsonObject);
     }
 
     @Override
     public void sendStreamPushRequestedMsg(MessageForPushChannel msg) {
         String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED;
-        logger.info("[redis鍙戦�侀�氱煡] 鎺ㄦ祦琚姹� {}: {}/{}", key, msg.getApp(), msg.getStream());
+        logger.info("[redis鍙戦�侀�氱煡] 鍙戦�� 鎺ㄦ祦琚姹� {}: {}/{}", key, msg.getApp(), msg.getStream());
         redisTemplate.convertAndSend(key, JSON.toJSON(msg));
     }
 
@@ -555,7 +555,7 @@
     public void sendAlarmMsg(AlarmChannelMessage msg) {
         // 姝ゆ秷鎭敤浜庡鎺ョ涓夋柟鏈嶅姟涓嬬骇鏉ョ殑娑堟伅鍐呭
         String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_ALARM;
-        logger.info("[redis鍙戦�侀�氱煡] 鎶ヨ{}: {}", key, JSON.toJSON(msg));
+        logger.info("[redis鍙戦�侀�氱煡] 鍙戦�� 鎶ヨ{}: {}", key, JSON.toJSON(msg));
         redisTemplate.convertAndSend(key, JSON.toJSON(msg));
     }
 
@@ -568,7 +568,7 @@
     @Override
     public void sendStreamPushRequestedMsgForStatus() {
         String key = VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED;
-        logger.info("[redis閫氱煡]鑾峰彇鎵�鏈夋帹娴佽澶囩殑鐘舵��");
+        logger.info("[redis閫氱煡] 鍙戦�� 鑾峰彇鎵�鏈夋帹娴佽澶囩殑鐘舵��");
         JSONObject jsonObject = new JSONObject();
         jsonObject.put(key, key);
         redisTemplate.convertAndSend(key, jsonObject);
@@ -596,6 +596,7 @@
     @Override
     public void sendDeviceOrChannelStatus(String deviceId, String channelId, boolean online) {
         String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_DEVICE_STATUS;
+        logger.info("[redis閫氱煡] 鍙戦�� 鎺ㄩ�佽澶�/閫氶亾鐘舵�侊紝 {}/{}-{}", deviceId, channelId, online);
         StringBuilder msg = new StringBuilder();
         msg.append(deviceId);
         if (channelId != null) {
@@ -626,14 +627,14 @@
     @Override
     public void sendPlatformStartPlayMsg(MessageForPushChannel msg) {
         String key = VideoManagerConstants.VM_MSG_STREAM_START_PLAY_NOTIFY;
-        logger.info("[redis鍙戦�侀�氱煡] 鎺ㄦ祦琚笂绾у钩鍙拌鐪� {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
+        logger.info("[redis鍙戦�侀�氱煡] 鍙戦�� 鎺ㄦ祦琚笂绾у钩鍙拌鐪� {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
         redisTemplate.convertAndSend(key, JSON.toJSON(msg));
     }
 
     @Override
     public void sendPlatformStopPlayMsg(MessageForPushChannel msg) {
         String key = VideoManagerConstants.VM_MSG_STREAM_STOP_PLAY_NOTIFY;
-        logger.info("[redis鍙戦�侀�氱煡] 涓婄骇骞冲彴鍋滄瑙傜湅 {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
+        logger.info("[redis鍙戦�侀�氱煡] 鍙戦�� 涓婄骇骞冲彴鍋滄瑙傜湅 {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId());
         redisTemplate.convertAndSend(key, JSON.toJSON(msg));
     }
 }
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherRtpSendInfo.java b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherRtpSendInfo.java
new file mode 100644
index 0000000..225e40c
--- /dev/null
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/bean/OtherRtpSendInfo.java
@@ -0,0 +1,135 @@
+package com.genersoft.iot.vmp.vmanager.bean;
+
+public class OtherRtpSendInfo {
+
+    /**
+     * 鍙戞祦IP
+     */
+    private String ip;
+
+    /**
+     * 鍙戞祦绔彛
+     */
+    private int port;
+
+    /**
+     * 鏀舵祦IP
+     */
+    private String receiveIp;
+
+    /**
+     * 鏀舵祦绔彛
+     */
+    private int receivePort;
+
+    /**
+     * 浼氳瘽ID
+     */
+    private String callId;
+
+    /**
+     * 娴両D
+     */
+    private String stream;
+
+    /**
+     * 鎺ㄦ祦搴旂敤鍚�
+     */
+    private String pushApp;
+
+    /**
+     * 鎺ㄦ祦娴両D
+     */
+    private String pushStream;
+
+    /**
+     * 鎺ㄦ祦SSRC
+     */
+    private String pushSSRC;
+
+
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    public int getPort() {
+        return port;
+    }
+
+    public void setPort(int port) {
+        this.port = port;
+    }
+
+    public String getReceiveIp() {
+        return receiveIp;
+    }
+
+    public void setReceiveIp(String receiveIp) {
+        this.receiveIp = receiveIp;
+    }
+
+    public int getReceivePort() {
+        return receivePort;
+    }
+
+    public void setReceivePort(int receivePort) {
+        this.receivePort = receivePort;
+    }
+
+    public String getCallId() {
+        return callId;
+    }
+
+    public void setCallId(String callId) {
+        this.callId = callId;
+    }
+
+    public String getStream() {
+        return stream;
+    }
+
+    public void setStream(String stream) {
+        this.stream = stream;
+    }
+
+    public String getPushApp() {
+        return pushApp;
+    }
+
+    public void setPushApp(String pushApp) {
+        this.pushApp = pushApp;
+    }
+
+    public String getPushStream() {
+        return pushStream;
+    }
+
+    public void setPushStream(String pushStream) {
+        this.pushStream = pushStream;
+    }
+
+    public String getPushSSRC() {
+        return pushSSRC;
+    }
+
+    public void setPushSSRC(String pushSSRC) {
+        this.pushSSRC = pushSSRC;
+    }
+
+    @Override
+    public String toString() {
+        return "OtherRtpSendInfo{" +
+                "ip='" + ip + '\'' +
+                ", port=" + port +
+                ", receiveIp='" + receiveIp + '\'' +
+                ", receivePort=" + receivePort +
+                ", callId='" + callId + '\'' +
+                ", stream='" + stream + '\'' +
+                '}';
+    }
+}
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
index d7ec994..84ccc0b 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
@@ -11,7 +11,7 @@
 import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
 import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
 import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
-import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.service.IInviteStreamService;
 import com.genersoft.iot.vmp.service.IPlayService;
 import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
@@ -54,7 +54,7 @@
 	private SIPCommander cmder;
 
 	@Autowired
-	private ZLMRTPServerFactory zlmrtpServerFactory;
+	private ZLMServerFactory ZLMServerFactory;
 
 	@Autowired
 	private IVideoManagerStorage storager;
diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java
index c8c1625..689231d 100644
--- a/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java
+++ b/src/main/java/com/genersoft/iot/vmp/vmanager/rtp/RtpController.java
@@ -1,24 +1,44 @@
 package com.genersoft.iot.vmp.vmanager.rtp;
 
+import com.alibaba.fastjson2.JSONObject;
+import com.genersoft.iot.vmp.common.VideoManagerConstants;
+import com.genersoft.iot.vmp.conf.DynamicTask;
 import com.genersoft.iot.vmp.conf.SipConfig;
 import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.conf.VersionInfo;
 import com.genersoft.iot.vmp.conf.exception.ControllerException;
-import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
+import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager;
+import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory;
 import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
+import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
+import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForRtpServerTimeout;
 import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
-import com.genersoft.iot.vmp.service.*;
+import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRtpServerTimeoutHookParam;
+import com.genersoft.iot.vmp.service.IDeviceChannelService;
+import com.genersoft.iot.vmp.service.IDeviceService;
+import com.genersoft.iot.vmp.service.IMediaServerService;
 import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
 import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
+import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
+import okhttp3.OkHttpClient;
+import okhttp3.Request;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
 
 @SuppressWarnings("rawtypes")
 @Tag(name = "绗笁鏂规湇鍔″鎺�")
@@ -28,7 +48,15 @@
 public class RtpController {
 
     @Autowired
-    private ZlmHttpHookSubscribe zlmHttpHookSubscribe;
+    private ZLMServerFactory zlmServerFactory;
+
+    @Autowired
+    private SendRtpPortManager sendRtpPortManager;
+
+    private final static Logger logger = LoggerFactory.getLogger(RtpController.class);
+
+    @Autowired
+    private ZlmHttpHookSubscribe hookSubscribe;
 
     @Autowired
     private IMediaServerService mediaServerService;
@@ -49,11 +77,11 @@
     private IDeviceChannelService channelService;
 
     @Autowired
-    private IStreamPushService pushService;
+    private DynamicTask dynamicTask;
 
 
     @Autowired
-    private IStreamProxyService proxyService;
+    private RedisTemplate<Object, Object> redisTemplate;
 
 
     @Value("${server.port}")
@@ -73,12 +101,67 @@
     @Parameter(name = "stream", description = "褰㈡垚鐨勬祦鐨処D", required = true)
     @Parameter(name = "tcpMode", description = "鏀舵祦妯″紡锛� 0涓篣DP锛� 1涓篢CP琚姩", required = true)
     @Parameter(name = "callBack", description = "鍥炶皟鍦板潃锛屽鏋滄敹娴佽秴鏃朵細閫氶亾鍥炶皟閫氱煡锛屽洖璋冧负get璇锋眰锛屽弬鏁颁负callId", required = true)
-    public SendRtpItem openRtpServer(Boolean isSend, String ssrc, String callId, String stream, Integer tcpMode, String callBack) {
-        MediaServerItem mediaServerItem = mediaServerService.getMediaServerForMinimumLoad(null);
+    public OtherRtpSendInfo openRtpServer(Boolean isSend, String ssrc, String callId, String stream, Integer tcpMode, String callBack) {
+
+        logger.info("[绗笁鏂规湇鍔″鎺�->寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] isSend->{}, ssrc->{}, callId->{}, stream->{}, tcpMode->{}, callBack->{}",
+                isSend, ssrc, callId, stream, tcpMode==0?"UDP":"TCP琚姩", callBack);
+
+        MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer();
         if (mediaServerItem == null) {
             throw new ControllerException(ErrorCode.ERROR100.getCode(),"娌℃湁鍙敤鐨凪ediaServer");
         }
-        return null;
+        if (stream == null) {
+            throw new ControllerException(ErrorCode.ERROR100.getCode(),"stream鍙傛暟涓嶅彲涓虹┖");
+        }
+        if (isSend != null && isSend && callId == null) {
+            throw new ControllerException(ErrorCode.ERROR100.getCode(),"isSend涓簍rue鏃讹紝CallID涓嶈兘涓虹┖");
+        }
+        int ssrcInt = 0;
+        if (ssrc != null) {
+            try {
+                ssrcInt = Integer.parseInt(ssrc);
+            }catch (NumberFormatException e) {
+                throw new ControllerException(ErrorCode.ERROR100.getCode(),"ssrc鏍煎紡閿欒");
+            }
+
+        }
+        int localPort = zlmServerFactory.createRTPServer(mediaServerItem, stream, ssrcInt, null, false, tcpMode);
+        // 娉ㄥ唽鍥炶皟濡傛灉rtp鏀舵祦瓒呮椂鍒欓�氳繃鍥炶皟鍙戦�侀�氱煡
+        if (callBack != null) {
+            HookSubscribeForRtpServerTimeout hookSubscribeForRtpServerTimeout = HookSubscribeFactory.on_rtp_server_timeout(ssrc, null, mediaServerItem.getId());
+            // 璁㈤槄 zlm鍚姩浜嬩欢, 鏂扮殑zlm涔熶細浠庤繖閲岃繘鍏ョ郴缁�
+            hookSubscribe.addSubscribe(hookSubscribeForRtpServerTimeout,
+                    (mediaServerItemInUse, hookParam)->{
+                        OnRtpServerTimeoutHookParam serverTimeoutHookParam = (OnRtpServerTimeoutHookParam) hookParam;
+                        if (stream.equals(serverTimeoutHookParam.getStream_id())) {
+                            logger.info("[寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] 绛夊緟鏀舵祦瓒呮椂 callId->{}, 鍙戦�佸洖璋�", callId);
+                            OkHttpClient.Builder httpClientBuilder = new OkHttpClient.Builder();
+                            OkHttpClient client = httpClientBuilder.build();
+                            String url = callBack + "?callId="  + callId;
+                            Request request = new Request.Builder().get().url(url).build();
+                            try {
+                                client.newCall(request).execute();
+                            } catch (IOException e) {
+                                logger.error("[寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] 绛夊緟鏀舵祦瓒呮椂 callId->{}, 鍙戦�佸洖璋冨け璐�", callId, e);
+                            }
+                        }
+                    });
+        }
+        String key = VideoManagerConstants.WVP_OTHER_SEND_RTP_INFO + userSetting.getServerId() + callId;
+        OtherRtpSendInfo otherRtpSendInfo = new OtherRtpSendInfo();
+        otherRtpSendInfo.setReceiveIp(mediaServerItem.getSdpIp());
+        otherRtpSendInfo.setReceivePort(localPort);
+        otherRtpSendInfo.setCallId(callId);
+        otherRtpSendInfo.setStream(stream);
+        if (isSend != null && isSend) {
+            int port = sendRtpPortManager.getNextPort(mediaServerItem.getId());
+            otherRtpSendInfo.setIp(mediaServerItem.getSdpIp());
+            otherRtpSendInfo.setPort(port);
+            logger.info("[寮�鍚敹娴佸拰鑾峰彇鍙戞祦淇℃伅] 缁撴灉锛宑allId->{}锛� {}", callId, otherRtpSendInfo);
+        }
+        // 灏嗕俊鎭啓鍏edis涓紝浠ュ鍚庣敤
+        redisTemplate.opsForValue().set(key, otherRtpSendInfo, 300, TimeUnit.SECONDS);
+        return otherRtpSendInfo;
     }
 
     @GetMapping(value = "/receive/close")
@@ -86,7 +169,9 @@
     @Operation(summary = "鍏抽棴鏀舵祦")
     @Parameter(name = "stream", description = "娴佺殑ID", required = true)
     public void closeRtpServer(String stream) {
-
+        logger.info("[绗笁鏂规湇鍔″鎺�->鍏抽棴鏀舵祦] stream->{}", stream);
+        MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer();
+        zlmServerFactory.closeRtpServer(mediaServerItem,stream);
     }
 
     @GetMapping(value = "/send/start")
@@ -99,9 +184,44 @@
     @Parameter(name = "stream", description = "寰呭彂閫佹祦Id", required = true)
     @Parameter(name = "callId", description = "鏁翠釜杩囩▼鐨勫敮涓�鏍囪瘑锛屼笉浼犲垯浣跨敤闅忔満绔彛鍙戞祦", required = true)
     @Parameter(name = "onlyAudio", description = "鏄惁鍙湁闊抽", required = true)
+    @Parameter(name = "isUdp", description = "鏄惁涓篣DP", required = true)
     @Parameter(name = "streamType", description = "娴佺被鍨嬶紝1涓篹s娴侊紝2涓簆s娴侊紝 榛樿es娴�", required = false)
-    public void sendRTP(String ssrc, String ip, Integer port, String app, String stream, String callId, Boolean onlyAudio, Integer streamType) {
+    public void sendRTP(String ssrc, String ip, Integer port, String app, String stream, String callId, Boolean onlyAudio, Boolean isUdp, Integer streamType) {
+        logger.info("[绗笁鏂规湇鍔″鎺�->鍙戦�佹祦] ssrc->{}, ip->{}, port->{}, app->{}, stream->{}, callId->{}, onlyAudio->{}, streamType->{}",
+                ssrc, ip, port, app, stream, callId, onlyAudio, streamType == 1? "ES":"PS");
+        MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer();
+        String key = VideoManagerConstants.WVP_OTHER_SEND_RTP_INFO + userSetting.getServerId() + callId;
+        OtherRtpSendInfo sendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(key);
+        if (sendInfo == null) {
+            sendInfo = new OtherRtpSendInfo();
+        }
+        sendInfo.setPushApp(app);
+        sendInfo.setPushStream(stream);
+        sendInfo.setPushSSRC(ssrc);
 
+        Map<String, Object> param = new HashMap<>(12);
+        param.put("vhost","__defaultVhost__");
+        param.put("app",app);
+        param.put("stream",stream);
+        param.put("ssrc", ssrc);
+
+        param.put("dst_url",ip);
+        param.put("dst_port", port);
+        String is_Udp = isUdp ? "1" : "0";
+        param.put("is_udp", is_Udp);
+        param.put("src_port", sendInfo.getPort());
+        param.put("use_ps", streamType==2 ? "1" : "0");
+        param.put("only_audio", onlyAudio ? "1" : "0");
+
+        JSONObject jsonObject = zlmServerFactory.startSendRtpStream(mediaServerItem, param);
+        if (jsonObject.getInteger("code") == 0) {
+            logger.info("[绗笁鏂规湇鍔″鎺�->鍙戦�佹祦] 鍙戞祦鎴愬姛锛宑allId->{}", callId);
+            redisTemplate.opsForValue().set(key, sendInfo);
+        }else {
+            redisTemplate.delete(key);
+            logger.info("[绗笁鏂规湇鍔″鎺�->鍙戦�佹祦] 鍙戞祦澶辫触锛宑allId->{}, {}", callId, jsonObject.getString("msg"));
+            throw new ControllerException(ErrorCode.ERROR100.getCode(), "[鍙戞祦澶辫触] " + jsonObject.getString("msg"));
+        }
     }
 
 
@@ -111,7 +231,25 @@
     @Operation(summary = "鍏抽棴鍙戦�佹祦")
     @Parameter(name = "callId", description = "鏁翠釜杩囩▼鐨勫敮涓�鏍囪瘑锛屼笉浼犲垯浣跨敤闅忔満绔彛鍙戞祦", required = true)
     public void closeSendRTP(String callId) {
-
+        logger.info("[绗笁鏂规湇鍔″鎺�->鍏抽棴鍙戦�佹祦] callId->{}", callId);
+        String key = VideoManagerConstants.WVP_OTHER_SEND_RTP_INFO + userSetting.getServerId() + callId;
+        OtherRtpSendInfo sendInfo = (OtherRtpSendInfo)redisTemplate.opsForValue().get(key);
+        if (sendInfo == null){
+            throw new ControllerException(ErrorCode.ERROR100.getCode(), "鏈紑鍚彂娴�");
+        }
+        Map<String, Object> param = new HashMap<>();
+        param.put("vhost","__defaultVhost__");
+        param.put("app",sendInfo.getPushApp());
+        param.put("stream",sendInfo.getPushStream());
+        param.put("ssrc",sendInfo.getPushSSRC());
+        MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer();
+        Boolean result = zlmServerFactory.stopSendRtpStream(mediaServerItem, param);
+        if (!result) {
+            logger.info("[绗笁鏂规湇鍔″鎺�->鍏抽棴鍙戦�佹祦] 澶辫触 callId->{}", callId);
+            throw new ControllerException(ErrorCode.ERROR100.getCode(), "鍋滄鍙戞祦澶辫触");
+        }else {
+            logger.info("[绗笁鏂规湇鍔″鎺�->鍏抽棴鍙戦�佹祦] 鎴愬姛 callId->{}", callId);
+        }
     }
 
 }
diff --git a/web_src/src/components/dialog/catalogEdit.vue b/web_src/src/components/dialog/catalogEdit.vue
index e2fe59b..9a5e3a3 100644
--- a/web_src/src/components/dialog/catalogEdit.vue
+++ b/web_src/src/components/dialog/catalogEdit.vue
@@ -12,15 +12,6 @@
     >
       <div id="shared" style="margin-top: 1rem;margin-right: 100px;">
         <el-form ref="form" :rules="rules" :model="form" label-width="140px" >
-<!--          <el-form-item >-->
-<!--            寤鸿鐨勭被鍨嬶細-->
-<!--            <br/>-->
-<!--            &emsp;&emsp;琛屾斂鍖哄垝锛堝彲閫�2浣�/4浣�/6浣�/8浣�/10浣嶆暟瀛楋紝渚嬪锛�130432锛岃〃绀烘渤鍖楃渷閭兏甯傚箍骞冲幙锛�-->
-<!--            <br/>-->
-<!--            &emsp;&emsp;涓氬姟鍒嗙粍锛堢11銆�12銆�13浣�215锛屼緥濡傦細34020000002150000001锛�-->
-<!--            <br/>-->
-<!--            &emsp;&emsp;铏氭嫙缁勭粐锛堢11銆�12銆�13浣�216锛屼緥濡傦細34020000002160000001锛�-->
-<!--          </el-form-item>-->
           <el-form-item label="鑺傜偣缂栧彿" prop="id" >
             <el-input v-model="form.id" :disabled="isEdit" clearable></el-input>
           </el-form-item>
@@ -63,7 +54,11 @@
           return callback(new Error('琛屾斂鍖哄垝缂栧彿蹇呴』涓�2/4/6/8浣�'));
         }
         if (this.form.parentId !== this.platformDeviceId && this.form.parentId.length >= value.trim().length) {
-          return callback(new Error('琛屾斂鍖哄垝缂栧彿闀垮害搴旇姣忔涓や綅閫掑'));
+          if (this.form.parentId.length === 20) {
+            return callback(new Error('涓氬姟鍒嗙粍/铏氭嫙缁勭粐涓嬩笉鍙垱寤鸿鏀垮尯鍒�'));
+          }else {
+            return callback(new Error('琛屾斂鍖哄垝缂栧彿闀垮害搴旇姣忔涓や綅閫掑'));
+          }
         }
       }else {
         if (value.trim().length !== 20) {
@@ -122,27 +117,31 @@
       this.level = level;
     },
     onSubmit: function () {
-      console.log("onSubmit");
-      console.log(this.form);
-      this.$axios({
-        method:"post",
-        url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
-        data: this.form
-      }).then((res)=> {
-          if (res.data.code === 0) {
-            if (this.submitCallback)this.submitCallback(this.form)
-          }else {
-            this.$message({
-              showClose: true,
-              message: res.data.msg,
-              type: "error",
+      this.$refs["form"].validate((valid) => {
+        if (valid) {
+          this.$axios({
+            method:"post",
+            url:`/api/platform/catalog/${!this.isEdit? "add":"edit"}`,
+            data: this.form
+          }).then((res)=> {
+            if (res.data.code === 0) {
+              if (this.submitCallback)this.submitCallback(this.form)
+            }else {
+              this.$message({
+                showClose: true,
+                message: res.data.msg,
+                type: "error",
+              });
+            }
+            this.close();
+          })
+            .catch((error)=> {
+              console.log(error);
             });
-          }
-          this.close();
-        })
-        .catch((error)=> {
-          console.log(error);
-        });
+        } else {
+          return false;
+        }
+      });
     },
     close: function () {
       this.isEdit = false;

--
Gitblit v1.8.0