From a43a98e1855c4e29ee9991c0dd608dbae273fb6f Mon Sep 17 00:00:00 2001
From: Li Keqing <auroracloud4096@gmail.com>
Date: Thu, 19 Dec 2024 09:24:09 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E6=AD=A3=E7=A1=AE=E7=9A=84?=
 =?UTF-8?q?=20MediaStatus=20=E5=86=85=E5=AE=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../transmit/cmd/impl/SIPCommanderForPlatform.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java
index c0c15d0be..0050d4466 100755
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderForPlatform.java
@@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
 import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
 import com.genersoft.iot.vmp.gb28181.SipLayer;
 import com.genersoft.iot.vmp.gb28181.bean.*;
+import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
 import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
 import com.genersoft.iot.vmp.gb28181.session.SipInviteSessionManager;
 import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
@@ -84,6 +85,9 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
     @Autowired
     private GitUtil gitUtil;
 
+    @Autowired
+    private CommonGBChannelMapper commonGBChannelMapper;
+
     @Override
     public void register(Platform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws InvalidArgumentException, ParseException, SipException {
         register(parentPlatform, null, null, errorEvent, okEvent, true);
@@ -604,6 +608,11 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
             return;
         }
 
+        CommonGBChannel channel = commonGBChannelMapper.queryById(sendRtpItem.getChannelId());
+
+        if (channel == null) {
+            return;
+        }
 
         String characterSet = parentPlatform.getCharacterSet();
         StringBuffer mediaStatusXml = new StringBuffer(200);
@@ -611,7 +620,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
                 .append("<Notify>\r\n")
                 .append("<CmdType>MediaStatus</CmdType>\r\n")
                 .append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n")
-                .append("<DeviceID>" + sendRtpItem.getChannelId() + "</DeviceID>\r\n")
+                .append("<DeviceID>" + channel.getGbDeviceId() + "</DeviceID>\r\n")
                 .append("<NotifyType>121</NotifyType>\r\n")
                 .append("</Notify>\r\n");