Browse Source

解决级联通道名称中文乱码

pull/80/head
panlinlin 4 years ago
parent
commit
344994c7f0
  1. 7
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
  2. 7
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
  3. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
  4. 2
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

7
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);

7
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("<CmdType>DeviceInfo</CmdType>\r\n");
deviceInfoXml.append("<SN>" +sn + "</SN>\r\n");
deviceInfoXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n");
deviceInfoXml.append("<DeviceName>GB28181 Video Platform</DeviceName>\r\n");
deviceInfoXml.append("<Manufacturer>Manufacturer</Manufacturer>\r\n");
deviceInfoXml.append("<Model>wvp-28181</Model>\r\n");
deviceInfoXml.append("<DeviceName>WVP-GB28181</DeviceName>\r\n");
deviceInfoXml.append("<Manufacturer>WVP</Manufacturer>\r\n");
deviceInfoXml.append("<Model>wvp-28181-2.0</Model>\r\n");
deviceInfoXml.append("<Firmware>2.0.202103</Firmware>\r\n");
deviceInfoXml.append("<Result>OK</Result>\r\n");
deviceInfoXml.append("</Response>\r\n");

2
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 {

2
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();

Loading…
Cancel
Save