From 6484f52e4624f9c2dbd03443080adf6db6b800b4 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期二, 07 二月 2023 20:59:33 +0800 Subject: [PATCH] 同时支持打包为Jar和War --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPSender.java | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-) 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 f723a6f..0aff21d 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 @@ -106,11 +106,27 @@ } public CallIdHeader getNewCallIdHeader(String ip, String transport){ - if (ObjectUtils.isEmpty(ip) || ObjectUtils.isEmpty(transport)) { - return transport.equalsIgnoreCase("TCP") ? sipLayer.getTcpSipProvider().getNewCallId() - : sipLayer.getUdpSipProvider().getNewCallId(); + if (ObjectUtils.isEmpty(transport)) { + return sipLayer.getUdpSipProvider().getNewCallId(); } - return transport.equalsIgnoreCase("TCP") ? sipLayer.getTcpSipProvider(ip).getNewCallId() - : sipLayer.getUdpSipProvider(ip).getNewCallId(); + SipProviderImpl sipProvider; + if (ObjectUtils.isEmpty(ip)) { + sipProvider = transport.equalsIgnoreCase("TCP") ? sipLayer.getTcpSipProvider() + : sipLayer.getUdpSipProvider(); + }else { + sipProvider = transport.equalsIgnoreCase("TCP") ? sipLayer.getTcpSipProvider(ip) + : sipLayer.getUdpSipProvider(ip); + } + + if (sipProvider == null) { + sipProvider = sipLayer.getUdpSipProvider(); + } + + if (sipProvider != null) { + return sipProvider.getNewCallId(); + }else { + logger.warn("[鏂板缓CallIdHeader澶辫触]锛� ip={}, transport={}", ip, transport); + return null; + } } } -- Gitblit v1.8.0