From 344994c7f0fcbaca7fd2ee70494a60cd9c7ba6a3 Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: Mon, 12 Apr 2021 18:33:58 +0800
Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BA=A7=E8=81=94=E9=80=9A?=
=?UTF-8?q?=E9=81=93=E5=90=8D=E7=A7=B0=E4=B8=AD=E6=96=87=E4=B9=B1=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../transmit/cmd/SIPRequestHeaderPlarformProvider.java | 7 +++++--
.../gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 7 ++++---
.../gb28181/transmit/request/impl/AckRequestProcessor.java | 2 +-
.../genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 2 +-
4 files changed, 11 insertions(+), 7 deletions(-)
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 5bf9236a..7767a78b 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
@@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd;
import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
+import gov.nist.javax.sip.message.MessageFactoryImpl;
import org.springframework.beans.factory.annotation.Autowired;
// import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@@ -205,8 +206,10 @@ public class SIPRequestHeaderPlarformProvider {
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
// ceq
CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.MESSAGE);
-
- request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
+ MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory();
+ // 设置编码, 防止中文乱码
+ messageFactory.setDefaultContentEncodingCharset("gb2312");
+ request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader,
toHeader, viaHeaders, maxForwards);
ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml");
request.setContent(content, contentTypeHeader);
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 7945dcd0..3789771c 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
@@ -172,6 +172,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
private void transmitRequest(ParentPlatform parentPlatform, Request request, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException {
if("TCP".equals(parentPlatform.getTransport())) {
tcpSipProvider.sendRequest(request);
+
} else if("UDP".equals(parentPlatform.getTransport())) {
udpSipProvider.sendRequest(request);
}
@@ -264,9 +265,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
deviceInfoXml.append("DeviceInfo\r\n");
deviceInfoXml.append("" +sn + "\r\n");
deviceInfoXml.append("" + parentPlatform.getDeviceGBId() + "\r\n");
- deviceInfoXml.append("GB28181 Video Platform\r\n");
- deviceInfoXml.append("Manufacturer\r\n");
- deviceInfoXml.append("wvp-28181\r\n");
+ deviceInfoXml.append("WVP-GB28181\r\n");
+ deviceInfoXml.append("WVP\r\n");
+ deviceInfoXml.append("wvp-28181-2.0\r\n");
deviceInfoXml.append("2.0.202103\r\n");
deviceInfoXml.append("OK\r\n");
deviceInfoXml.append("\r\n");
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
index 00f1f7da..c1e43e89 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
@@ -78,7 +78,7 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor {
zlmrtpServerFactory.startSendRtpStream(param);
} else {
System.out.println("等待设备推流.......");
- Thread.sleep(2000);
+ Thread.sleep(1000);
continue;
}
} else {
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 49d06adc..940a4550 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
@@ -220,7 +220,7 @@ public class ZLMHttpHookListener {
// String app = json.getString("app");
// String stream = json.getString("stream");
- ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
+ ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json);
if (subscribe != null) subscribe.response(json);
JSONObject ret = new JSONObject();