From 5c3c3e6a4c144f77eb832fa9f736967d0bffa220 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Fri, 21 Apr 2023 14:18:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B6=88=E6=81=AF=E5=8F=91?= =?UTF-8?q?=E9=80=81=E5=A4=B1=E8=B4=A5=E5=AF=BC=E8=87=B4=E5=90=8E=E7=BB=AD?= =?UTF-8?q?=E6=AC=A1=E9=80=9A=E9=81=93=E6=97=A0=E6=B3=95=E7=82=B9=E6=92=AD?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java | 7 ++++++- .../com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java | 6 +----- .../java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java | 4 ++-- .../genersoft/iot/vmp/service/impl/PlayServiceImpl.java | 4 +++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java b/src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java index efa4d424..75751ad2 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/event/SipSubscribe.java @@ -76,7 +76,9 @@ public class SipSubscribe { // 会话已结束 dialogTerminated, // 设备未找到 - deviceNotFoundEvent + deviceNotFoundEvent, + // 设备未找到 + cmdSendFailEvent } public static class EventResult{ @@ -86,6 +88,9 @@ public class SipSubscribe { public String callId; public EventObject event; + public EventResult() { + } + public EventResult(EventObject event) { this.event = event; if (event instanceof ResponseEvent) { diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java index 89e6e32f..e8066b75 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java @@ -46,8 +46,7 @@ public class SIPSender { transmitRequest(ip, message, errorEvent, null); } - public void transmitRequest(String ip, Message message, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException, ParseException { - try { + public void transmitRequest(String ip, Message message, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException { ViaHeader viaHeader = (ViaHeader)message.getHeader(ViaHeader.NAME); String transport = "UDP"; if (viaHeader == null) { @@ -104,9 +103,6 @@ public class SIPSender { sipProvider.sendResponse((Response)message); } } - } finally { -// logger.info("[SEND]:SUCCESS:{}", message); - } } public CallIdHeader getNewCallIdHeader(String ip, String transport){ diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java index f9831500..1f4632ea 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java @@ -142,8 +142,8 @@ public class SipUtils { remotePort = request.getTopmostViaHeader().getRPort(); // 解析本地地址替代 if (ObjectUtils.isEmpty(remoteAddress) || remotePort == -1) { - remoteAddress = request.getTopmostViaHeader().getHost(); - remotePort = request.getTopmostViaHeader().getPort(); + remoteAddress = request.getRemoteAddress().getHostAddress(); + remotePort = request.getRemotePort(); } } diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java index a18d8ba1..aead6612 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java @@ -398,7 +398,9 @@ public class PlayServiceImpl implements IPlayService { mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc()); streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); - SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(new CmdSendFailEvent(null)); + SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(); + eventResult.type = SipSubscribe.EventResultType.cmdSendFailEvent; + eventResult.statusCode = -1; eventResult.msg = "命令发送失败"; errorEvent.response(eventResult); }