From 59ef6e67d3a1357c19039527dac47747e2ac20fe Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期四, 17 三月 2022 10:29:49 +0800 Subject: [PATCH] 统一国标设备与级联平台字符集的使用 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 38 +++++++++++++++++++++++--------------- 1 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index 5e20c47..48bffd7 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -670,6 +670,7 @@ try { SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(deviceId, channelId, null, stream); ClientTransaction transaction = streamSession.getTransactionByStream(deviceId, channelId, stream); + if (transaction == null) { logger.warn("[ {} -> {}]鍋滄瑙嗛娴佺殑鏃跺�欏彂鐜颁簨鍔″凡涓㈠け", deviceId, channelId); SipSubscribe.EventResult<Object> eventResult = new SipSubscribe.EventResult<>(); @@ -685,7 +686,12 @@ if (stream == null) return; dialog = streamSession.getDialogByStream(deviceId, channelId, stream); } - + if (ssrcTransaction != null) { + MediaServerItem mediaServerItem = mediaServerService.getOne(ssrcTransaction.getMediaServerId()); + mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcTransaction.getSsrc()); + mediaServerService.closeRTPServer(deviceId, channelId, ssrcTransaction.getStream()); + streamSession.remove(deviceId, channelId, ssrcTransaction.getStream()); + } if (dialog == null) { logger.warn("[ {} -> {}]鍋滄瑙嗛娴佺殑鏃跺�欏彂鐜板璇濆凡涓㈠け", deviceId, channelId); @@ -730,12 +736,6 @@ dialog.sendRequest(clientTransaction); - if (ssrcTransaction != null) { - MediaServerItem mediaServerItem = mediaServerService.getOne(ssrcTransaction.getMediaServerId()); - mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcTransaction.getSsrc()); - mediaServerService.closeRTPServer(deviceId, channelId, ssrcTransaction.getStream()); - streamSession.remove(deviceId, channelId, ssrcTransaction.getStream()); - } } catch (SipException | ParseException e) { e.printStackTrace(); } @@ -1120,8 +1120,9 @@ @Override public boolean deviceStatusQuery(Device device, SipSubscribe.Event errorEvent) { try { + String charset = device.getCharset(); StringBuffer catalogXml = new StringBuffer(200); - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); catalogXml.append("<Query>\r\n"); catalogXml.append("<CmdType>DeviceStatus</CmdType>\r\n"); catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); @@ -1153,7 +1154,8 @@ public boolean deviceInfoQuery(Device device) { try { StringBuffer catalogXml = new StringBuffer(200); - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + String charset = device.getCharset(); + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); catalogXml.append("<Query>\r\n"); catalogXml.append("<CmdType>DeviceInfo</CmdType>\r\n"); catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); @@ -1185,7 +1187,8 @@ public boolean catalogQuery(Device device, SipSubscribe.Event errorEvent) { try { StringBuffer catalogXml = new StringBuffer(200); - catalogXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + String charset = device.getCharset(); + catalogXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); catalogXml.append("<Query>\r\n"); catalogXml.append("<CmdType>Catalog</CmdType>\r\n"); catalogXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); @@ -1224,7 +1227,8 @@ } try { StringBuffer recordInfoXml = new StringBuffer(200); - recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + String charset = device.getCharset(); + recordInfoXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); recordInfoXml.append("<Query>\r\n"); recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n"); recordInfoXml.append("<SN>" + sn + "</SN>\r\n"); @@ -1396,7 +1400,8 @@ public boolean mobilePostitionQuery(Device device, SipSubscribe.Event errorEvent) { try { StringBuffer mobilePostitionXml = new StringBuffer(200); - mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + String charset = device.getCharset(); + mobilePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); mobilePostitionXml.append("<Query>\r\n"); mobilePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); mobilePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); @@ -1431,7 +1436,8 @@ public boolean mobilePositionSubscribe(Device device, int expires, int interval) { try { StringBuffer subscribePostitionXml = new StringBuffer(200); - subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + String charset = device.getCharset(); + subscribePostitionXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); subscribePostitionXml.append("<Query>\r\n"); subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); @@ -1473,7 +1479,8 @@ public boolean alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) { try { StringBuffer cmdXml = new StringBuffer(200); - cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + String charset = device.getCharset(); + cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); cmdXml.append("<Query>\r\n"); cmdXml.append("<CmdType>Alarm</CmdType>\r\n"); cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); @@ -1518,7 +1525,8 @@ public boolean catalogSubscribe(Device device, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) { try { StringBuffer cmdXml = new StringBuffer(200); - cmdXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); + String charset = device.getCharset(); + cmdXml.append("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\r\n"); cmdXml.append("<Query>\r\n"); cmdXml.append("<CmdType>Catalog</CmdType>\r\n"); cmdXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); -- Gitblit v1.8.0