Commit 344994c7f0fcbaca7fd2ee70494a60cd9c7ba6a3
1 parent
4010ed6c
解决级联通道名称中文乱码
Showing
4 changed files
with
11 additions
and
7 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
| @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd; | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 5 | +import gov.nist.javax.sip.message.MessageFactoryImpl; | ||
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | // import org.springframework.beans.factory.annotation.Qualifier; | 7 | // import org.springframework.beans.factory.annotation.Qualifier; |
| 7 | import org.springframework.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| @@ -205,8 +206,10 @@ public class SIPRequestHeaderPlarformProvider { | @@ -205,8 +206,10 @@ public class SIPRequestHeaderPlarformProvider { | ||
| 205 | MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); | 206 | MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); |
| 206 | // ceq | 207 | // ceq |
| 207 | CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.MESSAGE); | 208 | CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.MESSAGE); |
| 208 | - | ||
| 209 | - request = sipFactory.createMessageFactory().createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, | 209 | + MessageFactoryImpl messageFactory = (MessageFactoryImpl) sipFactory.createMessageFactory(); |
| 210 | + // 设置编码, 防止中文乱码 | ||
| 211 | + messageFactory.setDefaultContentEncodingCharset("gb2312"); | ||
| 212 | + request = messageFactory.createRequest(requestURI, Request.MESSAGE, callIdHeader, cSeqHeader, fromHeader, | ||
| 210 | toHeader, viaHeaders, maxForwards); | 213 | toHeader, viaHeaders, maxForwards); |
| 211 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml"); | 214 | ContentTypeHeader contentTypeHeader = sipFactory.createHeaderFactory().createContentTypeHeader("APPLICATION", "MANSCDP+xml"); |
| 212 | request.setContent(content, contentTypeHeader); | 215 | request.setContent(content, contentTypeHeader); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| @@ -172,6 +172,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -172,6 +172,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 172 | private void transmitRequest(ParentPlatform parentPlatform, Request request, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException { | 172 | private void transmitRequest(ParentPlatform parentPlatform, Request request, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) throws SipException { |
| 173 | if("TCP".equals(parentPlatform.getTransport())) { | 173 | if("TCP".equals(parentPlatform.getTransport())) { |
| 174 | tcpSipProvider.sendRequest(request); | 174 | tcpSipProvider.sendRequest(request); |
| 175 | + | ||
| 175 | } else if("UDP".equals(parentPlatform.getTransport())) { | 176 | } else if("UDP".equals(parentPlatform.getTransport())) { |
| 176 | udpSipProvider.sendRequest(request); | 177 | udpSipProvider.sendRequest(request); |
| 177 | } | 178 | } |
| @@ -264,9 +265,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -264,9 +265,9 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 264 | deviceInfoXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); | 265 | deviceInfoXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); |
| 265 | deviceInfoXml.append("<SN>" +sn + "</SN>\r\n"); | 266 | deviceInfoXml.append("<SN>" +sn + "</SN>\r\n"); |
| 266 | deviceInfoXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n"); | 267 | deviceInfoXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n"); |
| 267 | - deviceInfoXml.append("<DeviceName>GB28181 Video Platform</DeviceName>\r\n"); | ||
| 268 | - deviceInfoXml.append("<Manufacturer>Manufacturer</Manufacturer>\r\n"); | ||
| 269 | - deviceInfoXml.append("<Model>wvp-28181</Model>\r\n"); | 268 | + deviceInfoXml.append("<DeviceName>WVP-GB28181</DeviceName>\r\n"); |
| 269 | + deviceInfoXml.append("<Manufacturer>WVP</Manufacturer>\r\n"); | ||
| 270 | + deviceInfoXml.append("<Model>wvp-28181-2.0</Model>\r\n"); | ||
| 270 | deviceInfoXml.append("<Firmware>2.0.202103</Firmware>\r\n"); | 271 | deviceInfoXml.append("<Firmware>2.0.202103</Firmware>\r\n"); |
| 271 | deviceInfoXml.append("<Result>OK</Result>\r\n"); | 272 | deviceInfoXml.append("<Result>OK</Result>\r\n"); |
| 272 | deviceInfoXml.append("</Response>\r\n"); | 273 | deviceInfoXml.append("</Response>\r\n"); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
| @@ -78,7 +78,7 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | @@ -78,7 +78,7 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor { | ||
| 78 | zlmrtpServerFactory.startSendRtpStream(param); | 78 | zlmrtpServerFactory.startSendRtpStream(param); |
| 79 | } else { | 79 | } else { |
| 80 | System.out.println("等待设备推流......."); | 80 | System.out.println("等待设备推流......."); |
| 81 | - Thread.sleep(2000); | 81 | + Thread.sleep(1000); |
| 82 | continue; | 82 | continue; |
| 83 | } | 83 | } |
| 84 | } else { | 84 | } else { |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -220,7 +220,7 @@ public class ZLMHttpHookListener { | @@ -220,7 +220,7 @@ public class ZLMHttpHookListener { | ||
| 220 | // String app = json.getString("app"); | 220 | // String app = json.getString("app"); |
| 221 | // String stream = json.getString("stream"); | 221 | // String stream = json.getString("stream"); |
| 222 | 222 | ||
| 223 | - ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json); | 223 | + ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_shell_login, json); |
| 224 | if (subscribe != null) subscribe.response(json); | 224 | if (subscribe != null) subscribe.response(json); |
| 225 | 225 | ||
| 226 | JSONObject ret = new JSONObject(); | 226 | JSONObject ret = new JSONObject(); |