From b37a77f23f995758178b6af38b89a860107d218d Mon Sep 17 00:00:00 2001
From: panlinlin <648540858@qq.com>
Date: 星期四, 25 三月 2021 16:45:29 +0800
Subject: [PATCH] 解决循环依赖导致的打包失败
---
src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java | 1
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java | 42 +------
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 160 +++++++++++++++++++++-----
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java | 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 51 +++++++-
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java | 2
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java | 1
src/main/resources/application-dev.yml | 2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java | 46 +++----
web_src/package-lock.json | 1
10 files changed, 198 insertions(+), 110 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java b/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
index 075b30f..dd7c7a0 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
@@ -36,7 +36,6 @@
List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true);
for (ParentPlatform parentPlatform : parentPlatforms) {
-
redisCatchStorage.updatePlatformRegister(parentPlatform);
redisCatchStorage.updatePlatformKeepalive(parentPlatform);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
index 7c767ba..257a589 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java
@@ -16,6 +16,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Component;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
index 2e2ec43..8fe4cbc 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
@@ -31,16 +31,16 @@
@Autowired
private SipFactory sipFactory;
- @Autowired
- @Qualifier(value="tcpSipProvider")
- private SipProvider tcpSipProvider;
-
- @Autowired
- @Qualifier(value="udpSipProvider")
- private SipProvider udpSipProvider;
+// @Autowired
+// @Qualifier(value="tcpSipProvider")
+// private SipProvider tcpSipProvider;
+//
+// @Autowired
+// @Qualifier(value="udpSipProvider")
+// private SipProvider udpSipProvider;
- public Request createKeetpaliveMessageRequest(ParentPlatform parentPlatform, String content, String viaTag, String fromTag, String toTag) throws ParseException, InvalidArgumentException, PeerUnavailableException {
+ public Request createKeetpaliveMessageRequest(ParentPlatform parentPlatform, String content, String viaTag, String fromTag, String toTag, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
Request request = null;
// sipuri
SipURI requestURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP() + ":" + parentPlatform.getServerPort());
@@ -59,9 +59,8 @@
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP() + ":" + parentPlatform.getServerPort() );
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, toTag);
- // callid
- CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
- : udpSipProvider.getNewCallId();
+
+
// Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
// ceq
@@ -75,7 +74,7 @@
}
- public Request createRegisterRequest(@NotNull ParentPlatform platform, long CSeq, String fromTag, String viaTag) throws ParseException, InvalidArgumentException, PeerUnavailableException {
+ public Request createRegisterRequest(@NotNull ParentPlatform platform, long CSeq, String fromTag, String viaTag, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
Request request = null;
String sipAddress = sipConfig.getSipIp() + ":" + sipConfig.getSipPort();
//璇锋眰琛�
@@ -95,14 +94,7 @@
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress,null);
- //callid
- CallIdHeader callIdHeader = null;
- if(platform.getTransport().equals("TCP")) {
- callIdHeader = tcpSipProvider.getNewCallId();
- }
- if(platform.getTransport().equals("UDP")) {
- callIdHeader = udpSipProvider.getNewCallId();
- }
+
//Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
@@ -123,8 +115,10 @@
}
public Request createRegisterRequest(@NotNull ParentPlatform parentPlatform, String fromTag, String viaTag,
- String callId, WWWAuthenticateHeader www ) throws ParseException, PeerUnavailableException, InvalidArgumentException {
- Request registerRequest = createRegisterRequest(parentPlatform, 2L, fromTag, viaTag);
+ String callId, WWWAuthenticateHeader www , CallIdHeader callIdHeader) throws ParseException, PeerUnavailableException, InvalidArgumentException {
+
+
+ Request registerRequest = createRegisterRequest(parentPlatform, 2L, fromTag, viaTag, callIdHeader);
String realm = www.getRealm();
String nonce = www.getNonce();
@@ -134,9 +128,7 @@
// qop 淇濇姢璐ㄩ噺 鍖呭惈auth锛堥粯璁ょ殑锛夊拰auth-int锛堝鍔犱簡鎶ユ枃瀹屾暣鎬ф娴嬶級涓ょ绛栫暐
String qop = www.getQop();
- CallIdHeader callIdHeader = (CallIdHeader)registerRequest.getHeader(CallIdHeader.NAME);
callIdHeader.setCallId(callId);
-
SipURI requestURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP() + ":" + parentPlatform.getServerPort());
String cNonce = null;
@@ -189,7 +181,7 @@
}
- public Request createMessageRequest(ParentPlatform parentPlatform, String content, String fromTag) throws PeerUnavailableException, ParseException, InvalidArgumentException {
+ public Request createMessageRequest(ParentPlatform parentPlatform, String content, String fromTag, CallIdHeader callIdHeader) throws PeerUnavailableException, ParseException, InvalidArgumentException {
Request request = null;
// sipuri
SipURI requestURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getServerGBId(), parentPlatform.getServerIP()+ ":" + parentPlatform.getServerPort());
@@ -208,9 +200,7 @@
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(), parentPlatform.getServerGBDomain());
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, null);
- // callid
- CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
- : udpSipProvider.getNewCallId();
+
// Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
// ceq
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
index b5e6192..c764d5e 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java
@@ -33,15 +33,7 @@
@Autowired
private SipFactory sipFactory;
- @Autowired
- @Qualifier(value="tcpSipProvider")
- private SipProvider tcpSipProvider;
-
- @Autowired
- @Qualifier(value="udpSipProvider")
- private SipProvider udpSipProvider;
-
- public Request createMessageRequest(Device device, String content, String viaTag, String fromTag, String toTag) throws ParseException, InvalidArgumentException, PeerUnavailableException {
+ public Request createMessageRequest(Device device, String content, String viaTag, String fromTag, String toTag, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
Request request = null;
// sipuri
SipURI requestURI = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(), device.getHostAddress());
@@ -60,9 +52,7 @@
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(), sipConfig.getSipDomain());
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, toTag);
- // callid
- CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
- : udpSipProvider.getNewCallId();
+
// Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
// ceq
@@ -75,7 +65,7 @@
return request;
}
- public Request createInviteRequest(Device device, String channelId, String content, String viaTag, String fromTag, String toTag, String ssrc) throws ParseException, InvalidArgumentException, PeerUnavailableException {
+ public Request createInviteRequest(Device device, String channelId, String content, String viaTag, String fromTag, String toTag, String ssrc, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
Request request = null;
//璇锋眰琛�
SipURI requestLine = sipFactory.createAddressFactory().createSipURI(channelId, device.getHostAddress());
@@ -93,15 +83,6 @@
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(channelId,sipConfig.getSipDomain());
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress,null);
-
- //callid
- CallIdHeader callIdHeader = null;
- if(device.getTransport().equals("TCP")) {
- callIdHeader = tcpSipProvider.getNewCallId();
- }
- if(device.getTransport().equals("UDP")) {
- callIdHeader = udpSipProvider.getNewCallId();
- }
//Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
@@ -121,7 +102,7 @@
return request;
}
- public Request createPlaybackInviteRequest(Device device, String channelId, String content, String viaTag, String fromTag, String toTag) throws ParseException, InvalidArgumentException, PeerUnavailableException {
+ public Request createPlaybackInviteRequest(Device device, String channelId, String content, String viaTag, String fromTag, String toTag, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
Request request = null;
//璇锋眰琛�
SipURI requestLine = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(), device.getHostAddress());
@@ -138,15 +119,6 @@
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(channelId,sipConfig.getSipDomain());
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress,null);
-
- //callid
- CallIdHeader callIdHeader = null;
- if(device.getTransport().equals("TCP")) {
- callIdHeader = tcpSipProvider.getNewCallId();
- }
- if(device.getTransport().equals("UDP")) {
- callIdHeader = udpSipProvider.getNewCallId();
- }
//Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
@@ -164,7 +136,7 @@
return request;
}
- public Request createSubscribeRequest(Device device, String content, String viaTag, String fromTag, String toTag, Integer expires, String event) throws ParseException, InvalidArgumentException, PeerUnavailableException {
+ public Request createSubscribeRequest(Device device, String content, String viaTag, String fromTag, String toTag, Integer expires, String event, CallIdHeader callIdHeader) throws ParseException, InvalidArgumentException, PeerUnavailableException {
Request request = null;
// sipuri
SipURI requestURI = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(), device.getHostAddress());
@@ -183,9 +155,7 @@
SipURI toSipURI = sipFactory.createAddressFactory().createSipURI(device.getDeviceId(), sipConfig.getSipDomain());
Address toAddress = sipFactory.createAddressFactory().createAddress(toSipURI);
ToHeader toHeader = sipFactory.createHeaderFactory().createToHeader(toAddress, toTag);
- // callid
- CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
- : udpSipProvider.getNewCallId();
+
// Forwards
MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70);
// ceq
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 e941a8b..abf9cf7 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
@@ -23,6 +23,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
import com.genersoft.iot.vmp.conf.SipConfig;
@@ -40,13 +43,25 @@
* @date: 2020骞�5鏈�3鏃� 涓嬪崍9:22:48
*/
@Component
+@DependsOn("sipLayer")
public class SIPCommander implements ISIPCommander {
private final Logger logger = LoggerFactory.getLogger(SIPCommander.class);
-
+
+
@Autowired
private SipConfig sipConfig;
-
+
+ @Lazy
+ @Autowired
+ @Qualifier(value="tcpSipProvider")
+ private SipProvider tcpSipProvider;
+
+ @Lazy
+ @Autowired
+ @Qualifier(value="udpSipProvider")
+ private SipProvider udpSipProvider;
+
@Autowired
private SIPRequestHeaderProvider headerProvider;
@@ -58,14 +73,6 @@
@Autowired
private IRedisCatchStorage redisCatchStorage;
-
- @Autowired
- @Qualifier(value="tcpSipProvider")
- private SipProvider tcpSipProvider;
-
- @Autowired
- @Qualifier(value="udpSipProvider")
- private SipProvider udpSipProvider;
@Autowired
private ZLMRTPServerFactory zlmrtpServerFactory;
@@ -235,7 +242,11 @@
ptzXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader);
transmitRequest(device, request);
return true;
@@ -272,7 +283,11 @@
ptzXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader);
transmitRequest(device, request);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -302,7 +317,11 @@
ptzXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, ptzXml.toString(), "z9hG4bK-ViaPtz-" + tm, "FromPtz" + tm, null, callIdHeader);
transmitRequest(device, request);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -414,7 +433,11 @@
content.append("y="+ssrc+"\r\n");//ssrc
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrc);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createInviteRequest(device, channelId, content.toString(), null, "FromInvt" + tm, null, ssrc, callIdHeader);
ClientTransaction transaction = transmitRequest(device, request, errorEvent);
streamSession.put(streamId,ssrc, transaction);
@@ -512,7 +535,11 @@
content.append("y="+ssrc+"\r\n");//ssrc
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createPlaybackInviteRequest(device, channelId, content.toString(), null, "fromplybck" + tm, null, callIdHeader);
ClientTransaction transaction = transmitRequest(device, request, errorEvent);
streamSession.put(streamId, ssrc, transaction);
@@ -624,7 +651,11 @@
cmdXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromRecord" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromRecord" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -651,7 +682,11 @@
cmdXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromBoot" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromBoot" + tm, null, callIdHeader);
transmitRequest(device, request);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -679,7 +714,11 @@
cmdXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromGuard" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromGuard" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -718,7 +757,11 @@
cmdXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromAlarm" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromAlarm" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -750,7 +793,11 @@
cmdXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromBoot" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromBoot" + tm, null, callIdHeader);
transmitRequest(device, request);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -800,7 +847,11 @@
cmdXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromGuard" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromGuard" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -867,7 +918,11 @@
cmdXml.append("</Control>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromConfig" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromConfig" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -893,7 +948,11 @@
catalogXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), null, "FromStatus" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), null, "FromStatus" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
@@ -921,7 +980,11 @@
catalogXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaDeviceInfo-" + tm, "FromDev" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaDeviceInfo-" + tm, "FromDev" + tm, null, callIdHeader);
transmitRequest(device, request);
@@ -951,7 +1014,11 @@
catalogXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaCatalog-" + tm, "FromCat" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, catalogXml.toString(), "z9hG4bK-ViaCatalog-" + tm, "FromCat" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -986,7 +1053,12 @@
recordInfoXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), "z9hG4bK-ViaRecordInfo-" + tm, "fromRec" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(),
+ "z9hG4bK-ViaRecordInfo-" + tm, "fromRec" + tm, null, callIdHeader);
transmitRequest(device, request);
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -1039,7 +1111,11 @@
cmdXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromAlarm" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromAlarm" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -1072,7 +1148,11 @@
cmdXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromConfig" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromConfig" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -1102,7 +1182,11 @@
cmdXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromConfig" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, cmdXml.toString(), null, "FromConfig" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
return true;
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -1129,7 +1213,11 @@
mobilePostitionXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createMessageRequest(device, mobilePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null);
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createMessageRequest(device, mobilePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, callIdHeader);
transmitRequest(device, request, errorEvent);
@@ -1162,7 +1250,11 @@
subscribePostitionXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" ); //Position;id=" + tm.substring(tm.length() - 4));
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" ,callIdHeader); //Position;id=" + tm.substring(tm.length() - 4));
transmitRequest(device, request);
return true;
@@ -1215,7 +1307,11 @@
cmdXml.append("</Query>\r\n");
String tm = Long.toString(System.currentTimeMillis());
- Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" );
+
+ CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProvider.createSubscribeRequest(device, cmdXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" , callIdHeader);
transmitRequest(device, request);
return true;
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
index d5e380b..eac13ef 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
@@ -15,6 +15,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.context.annotation.Lazy;
import org.springframework.lang.Nullable;
import org.springframework.stereotype.Component;
@@ -26,6 +29,7 @@
import java.util.UUID;
@Component
+@DependsOn("sipLayer")
public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
// @Autowired
@@ -49,10 +53,12 @@
@Autowired
private SipSubscribe sipSubscribe;
+ @Lazy
@Autowired
@Qualifier(value="tcpSipProvider")
private SipProvider tcpSipProvider;
+ @Lazy
@Autowired
@Qualifier(value="udpSipProvider")
private SipProvider udpSipProvider;
@@ -83,19 +89,30 @@
Request request = null;
if (www == null ) {
- request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, 1L, null, null);
+ // //callid
+ CallIdHeader callIdHeader = null;
+ if(parentPlatform.getTransport().equals("TCP")) {
+ callIdHeader = tcpSipProvider.getNewCallId();
+ }
+ if(parentPlatform.getTransport().equals("UDP")) {
+ callIdHeader = udpSipProvider.getNewCallId();
+ }
+ request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, 1L, null, null, callIdHeader);
// 灏� callid 鍐欏叆缂撳瓨锛� 绛夋敞鍐屾垚鍔熷彲浠ユ洿鏂扮姸鎬�
- CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME);
redisCatchStorage.updatePlatformRegisterInfo(callIdHeader.getCallId(), parentPlatform.getServerGBId());
+ CallIdHeader finalCallIdHeader = callIdHeader;
sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (event)->{
- redisCatchStorage.delPlatformRegisterInfo(callIdHeader.getCallId());
+ redisCatchStorage.delPlatformRegisterInfo(finalCallIdHeader.getCallId());
if (errorEvent != null) {
errorEvent.response(event);
}
});
}else {
- request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, null, null, callId, www);
+ CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, null, null, callId, www, callIdHeader);
}
transmitRequest(parentPlatform, request, null, okEvent);
@@ -126,14 +143,17 @@
keepaliveXml.append("<Status>OK</Status>\r\n");
keepaliveXml.append("</Notify>\r\n");
+ CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
Request request = headerProviderPlarformProvider.createKeetpaliveMessageRequest(
parentPlatform,
keepaliveXml.toString(),
"z9hG4bK-" + UUID.randomUUID().toString().replace("-", ""),
UUID.randomUUID().toString().replace("-", ""),
- null);
+ null,
+ callIdHeader);
transmitRequest(parentPlatform, request);
- CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME);
callId = callIdHeader.getCallId();
} catch (ParseException | InvalidArgumentException | SipException e) {
e.printStackTrace();
@@ -208,7 +228,12 @@
catalogXml.append("</Item>\r\n");
catalogXml.append("</DeviceList>\r\n");
catalogXml.append("</Response>\r\n");
- Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, catalogXml.toString(), fromTag);
+
+ // callid
+ CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, catalogXml.toString(), fromTag, callIdHeader);
transmitRequest(parentPlatform, request);
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -243,7 +268,11 @@
deviceInfoXml.append("<Firmware>2.0.202103</Firmware>\r\n");
deviceInfoXml.append("<Result>OK</Result>\r\n");
deviceInfoXml.append("</Response>\r\n");
- Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceInfoXml.toString(), fromTag);
+
+ CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceInfoXml.toString(), fromTag, callIdHeader);
transmitRequest(parentPlatform, request);
} catch (SipException | ParseException | InvalidArgumentException e) {
@@ -276,7 +305,11 @@
deviceStatusXml.append("<Online>ONLINE</Online>\r\n");
deviceStatusXml.append("<Status>OK</Status>\r\n");
deviceStatusXml.append("</Response>\r\n");
- Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceStatusXml.toString(), fromTag);
+
+ CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
+ : udpSipProvider.getNewCallId();
+
+ Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, deviceStatusXml.toString(), fromTag, callIdHeader);
transmitRequest(parentPlatform, request);
} catch (SipException | ParseException | InvalidArgumentException e) {
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
index 72a4d8c..20e1c80 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java
@@ -37,7 +37,7 @@
Dialog dialog = evt.getDialog();
if (dialog == null) return;
//DialogState state = dialog.getState();
- if (/*request.getMethod().equals(Request.INVITE) &&*/ dialog.getState()== DialogState.CONFIRMED) {
+ if (/*request.getMecodewwthod().equals(Request.INVITE) &&*/ dialog.getState()== DialogState.CONFIRMED) {
String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser();
String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser();
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
index dc41fe7..51ce21e 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java
@@ -237,7 +237,7 @@
* @throws ParseException
*/
private void responseAck(RequestEvent evt, int statusCode) throws SipException, InvalidArgumentException, ParseException {
- Response response = getMessageFactory().createResponse(Response.TRYING, evt.getRequest());
+ Response response = getMessageFactory().createResponse(statusCode, evt.getRequest());
getServerTransaction(evt).sendResponse(response);
}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index b879403..e45bfb5 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -11,7 +11,7 @@
password:
# [鍙�塢 瓒呮椂鏃堕棿
timeout: 10000
- # [涓嶅彲鐢╙ jdbc鏁版嵁搴撻厤缃�, 鏆備笉鏀寔
+ # [鍙�塢 jdbc鏁版嵁搴撻厤缃�, 椤圭洰浣跨敤sqlite浣滀负鏁版嵁搴擄紝涓�鑸笉闇�瑕侀厤缃�
datasource:
# name: eiot
# url: jdbc:mysql://127.0.0.1:3306/eiot?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true
diff --git a/web_src/package-lock.json b/web_src/package-lock.json
index 54840f6..e4ed934 100644
--- a/web_src/package-lock.json
+++ b/web_src/package-lock.json
@@ -124,7 +124,6 @@
"version": "1.0.10",
"resolved": "https://registry.npm.taobao.org/argparse/download/argparse-1.0.10.tgz",
"integrity": "sha1-vNZ5HqWuCXJeF+WtmIE0zUCz2RE=",
- "dev": true,
"requires": {
"sprintf-js": "~1.0.2"
}
--
Gitblit v1.8.0