From fc7f1b3459d9c65a37cae25bc254a6a3d62cc6db Mon Sep 17 00:00:00 2001
From: xubinbin <1323875150@qq.com>
Date: 星期五, 23 九月 2022 10:55:42 +0800
Subject: [PATCH] 处理上级平台发送的invite请求不携带“y=”sdp信息时,使用默认“y=0000000000”视频无法播放的问题。

---
 src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java
index e004b89..bd4ca65 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java
@@ -23,6 +23,7 @@
 
 import javax.sip.InvalidArgumentException;
 import javax.sip.RequestEvent;
+import javax.sip.ServerTransaction;
 import javax.sip.SipException;
 import javax.sip.address.SipURI;
 import javax.sip.header.CSeqHeader;
@@ -79,6 +80,9 @@
         if (ssrcTransaction != null) {
             deviceId = ssrcTransaction.getDeviceId();
         }
+
+        ServerTransaction serverTransaction = getServerTransaction(evt);
+
         // 鏌ヨ璁惧鏄惁瀛樺湪
         Device device = redisCatchStorage.getDevice(deviceId);
         // 鏌ヨ涓婄骇骞冲彴鏄惁瀛樺湪
@@ -98,7 +102,7 @@
             }
             if (device == null && parentPlatform == null) {
                 // 涓嶅瓨鍦ㄥ垯鍥炲404
-                responseAck(evt, Response.NOT_FOUND, "device "+ deviceId +" not found");
+                responseAck(serverTransaction, Response.NOT_FOUND, "device "+ deviceId +" not found");
                 logger.warn("[璁惧鏈壘鍒� ]锛� {}", deviceId);
                 if (sipSubscribe.getErrorSubscribe(callIdHeader.getCallId()) != null){
                     SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(new DeviceNotFoundEvent(evt.getDialog()));
@@ -108,10 +112,15 @@
                 Element rootElement = null;
                 try {
                     rootElement = getRootElement(evt);
+                    if (rootElement == null) {
+                        logger.error("澶勭悊MESSAGE璇锋眰  鏈幏鍙栧埌娑堟伅浣搟}", evt.getRequest());
+                        responseAck(serverTransaction, Response.BAD_REQUEST, "content is null");
+                        return;
+                    }
                 } catch (DocumentException e) {
                     logger.warn("瑙f瀽XML娑堟伅鍐呭寮傚父", e);
                     // 涓嶅瓨鍦ㄥ垯鍥炲404
-                    responseAck(evt, Response.BAD_REQUEST, e.getMessage());
+                    responseAck(serverTransaction, Response.BAD_REQUEST, e.getMessage());
                 }
                 String name = rootElement.getName();
                 IMessageHandler messageHandler = messageHandlerMap.get(name);
@@ -124,7 +133,7 @@
                 }else {
                     // 涓嶆敮鎸佺殑message
                     // 涓嶅瓨鍦ㄥ垯鍥炲415
-                    responseAck(evt, Response.UNSUPPORTED_MEDIA_TYPE, "Unsupported message type, must Control/Notify/Query/Response");
+                    responseAck(serverTransaction, Response.UNSUPPORTED_MEDIA_TYPE, "Unsupported message type, must Control/Notify/Query/Response");
                 }
             }
         } catch (SipException e) {

--
Gitblit v1.8.0