From 408df377b760766a2b140f5c70f2f44f854b39af Mon Sep 17 00:00:00 2001 From: 64850858 <648540858@qq.com> Date: Mon, 26 Jul 2021 17:51:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0user-agent=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8DdeviceINfo=E6=9F=A5=E8=AF=A2=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cmd/SIPRequestHeaderPlarformProvider.java | 17 +++++++++++++++++ .../cmd/impl/SIPCommanderFroPlatform.java | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java index 18f341b6..de63fa9b 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java @@ -15,6 +15,7 @@ import javax.sip.message.Request; import javax.validation.constraints.NotNull; import java.text.ParseException; import java.util.ArrayList; +import java.util.List; import java.util.UUID; /** @@ -60,6 +61,12 @@ public class SIPRequestHeaderPlarformProvider { request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, toHeader, viaHeaders, maxForwards); + + List agentParam = new ArrayList<>(); + agentParam.add("wvp-pro"); + UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); + request.addHeader(userAgentHeader); + ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("Application", "MANSCDP+xml"); request.setContent(content, contentTypeHeader); return request; @@ -103,6 +110,11 @@ public class SIPRequestHeaderPlarformProvider { ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(Integer.parseInt(platform.getExpires())); request.addHeader(expires); + List agentParam = new ArrayList<>(); + agentParam.add("wvp-pro"); + UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); + request.addHeader(userAgentHeader); + return request; } @@ -202,6 +214,11 @@ public class SIPRequestHeaderPlarformProvider { messageFactory.setDefaultContentEncodingCharset("gb2312"); request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, toHeader, viaHeaders, maxForwards); + List agentParam = new ArrayList<>(); + agentParam.add("wvp-pro"); + UserAgentHeader userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); + request.addHeader(userAgentHeader); + ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml"); request.setContent(content, contentTypeHeader); return request; 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 182799cb..fcf2dcfe 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 @@ -263,7 +263,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { deviceInfoXml.append("DeviceInfo\r\n"); deviceInfoXml.append("" +sn + "\r\n"); deviceInfoXml.append("" + parentPlatform.getDeviceGBId() + "\r\n"); - deviceInfoXml.append("WVP-GB28181\r\n"); + deviceInfoXml.append("" + parentPlatform.getName() + "\r\n"); deviceInfoXml.append("WVP\r\n"); deviceInfoXml.append("wvp-28181-2.0\r\n"); deviceInfoXml.append("2.0.202103\r\n");