From a1398a56cc3587f08c28032a5c00f4c71b48e4f7 Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期四, 02 十二月 2021 09:33:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/wvp-28181-2.0' into wvp-28181-2.0
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java | 103 +++++++++++++++++++++++----------------------------
1 files changed, 47 insertions(+), 56 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java
index 9149be1..3724a3b 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java
@@ -36,9 +36,9 @@
@Autowired
private SipSubscribe sipSubscribe;
- @Autowired
- @Qualifier(value = "taskExecutor")
- private ThreadPoolTaskExecutor poolTaskExecutor;
+// @Autowired
+// @Qualifier(value = "taskExecutor")
+// private ThreadPoolTaskExecutor poolTaskExecutor;
/**
* 娣诲姞 request璁㈤槄
@@ -71,17 +71,15 @@
* @param requestEvent RequestEvent浜嬩欢
*/
@Override
+ @Async
public void processRequest(RequestEvent requestEvent) {
-
- poolTaskExecutor.execute(() -> {
- String method = requestEvent.getRequest().getMethod();
- ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method);
- if (sipRequestProcessor == null) {
- logger.warn("涓嶆敮鎸佹柟娉晎}鐨剅equest", method);
- return;
- }
- requestProcessorMap.get(method).process(requestEvent);
- });
+ String method = requestEvent.getRequest().getMethod();
+ ISIPRequestProcessor sipRequestProcessor = requestProcessorMap.get(method);
+ if (sipRequestProcessor == null) {
+ logger.warn("涓嶆敮鎸佹柟娉晎}鐨剅equest", method);
+ return;
+ }
+ requestProcessorMap.get(method).process(requestEvent);
}
@@ -90,55 +88,48 @@
* @param responseEvent responseEvent浜嬩欢
*/
@Override
+ @Async
public void processResponse(ResponseEvent responseEvent) {
logger.debug(responseEvent.getResponse().toString());
-// CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
-// String method = cseqHeader.getMethod();
-// ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(method);
-// if (sipRequestProcessor == null) {
-// logger.warn("涓嶆敮鎸佹柟娉晎}鐨剅esponse", method);
-// return;
-// }
-// sipRequestProcessor.process(responseEvent);
-
- poolTaskExecutor.execute(() -> {
- Response response = responseEvent.getResponse();
- logger.debug(responseEvent.getResponse().toString());
- int status = response.getStatusCode();
- if (((status >= 200) && (status < 300)) || status == 401) { // Success!
+ Response response = responseEvent.getResponse();
+ logger.debug(responseEvent.getResponse().toString());
+ int status = response.getStatusCode();
+ if (((status >= 200) && (status < 300)) || status == 401) { // Success!
// ISIPResponseProcessor processor = processorFactory.createResponseProcessor(evt);
- CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
- String method = cseqHeader.getMethod();
- ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(method);
- if (sipRequestProcessor != null) {
- sipRequestProcessor.process(responseEvent);
- }
- if (responseEvent.getResponse() != null && sipSubscribe.getOkSubscribesSize() > 0 ) {
- CallIdHeader callIdHeader = (CallIdHeader)responseEvent.getResponse().getHeader(CallIdHeader.NAME);
- if (callIdHeader != null) {
- SipSubscribe.Event subscribe = sipSubscribe.getOkSubscribe(callIdHeader.getCallId());
- if (subscribe != null) {
- SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent);
- subscribe.response(eventResult);
- }
- }
- }
- } else if ((status >= 100) && (status < 200)) {
- // 澧炲姞鍏跺畠鏃犻渶鍥炲鐨勫搷搴旓紝濡�101銆�180绛�
- } else {
- logger.warn("鎺ユ敹鍒板け璐ョ殑response鍝嶅簲锛乻tatus锛�" + status + ",message:" + response.getReasonPhrase()/* .getContent().toString()*/);
- if (responseEvent.getResponse() != null && sipSubscribe.getErrorSubscribesSize() > 0 ) {
- CallIdHeader callIdHeader = (CallIdHeader)responseEvent.getResponse().getHeader(CallIdHeader.NAME);
- if (callIdHeader != null) {
- SipSubscribe.Event subscribe = sipSubscribe.getErrorSubscribe(callIdHeader.getCallId());
- if (subscribe != null) {
- SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent);
- subscribe.response(eventResult);
- }
+ CSeqHeader cseqHeader = (CSeqHeader) responseEvent.getResponse().getHeader(CSeqHeader.NAME);
+ String method = cseqHeader.getMethod();
+ ISIPResponseProcessor sipRequestProcessor = responseProcessorMap.get(method);
+ if (sipRequestProcessor != null) {
+ sipRequestProcessor.process(responseEvent);
+ }
+ if (responseEvent.getResponse() != null && sipSubscribe.getOkSubscribesSize() > 0 ) {
+ CallIdHeader callIdHeader = (CallIdHeader)responseEvent.getResponse().getHeader(CallIdHeader.NAME);
+ if (callIdHeader != null) {
+ SipSubscribe.Event subscribe = sipSubscribe.getOkSubscribe(callIdHeader.getCallId());
+ if (subscribe != null) {
+ SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent);
+ subscribe.response(eventResult);
}
}
}
- });
+ } else if ((status >= 100) && (status < 200)) {
+ // 澧炲姞鍏跺畠鏃犻渶鍥炲鐨勫搷搴旓紝濡�101銆�180绛�
+ } else {
+ logger.warn("鎺ユ敹鍒板け璐ョ殑response鍝嶅簲锛乻tatus锛�" + status + ",message:" + response.getReasonPhrase()/* .getContent().toString()*/);
+ if (responseEvent.getResponse() != null && sipSubscribe.getErrorSubscribesSize() > 0 ) {
+ CallIdHeader callIdHeader = (CallIdHeader)responseEvent.getResponse().getHeader(CallIdHeader.NAME);
+ if (callIdHeader != null) {
+ SipSubscribe.Event subscribe = sipSubscribe.getErrorSubscribe(callIdHeader.getCallId());
+ if (subscribe != null) {
+ SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(responseEvent);
+ subscribe.response(eventResult);
+ }
+ }
+ }
+ if (responseEvent.getDialog() != null) {
+ responseEvent.getDialog().delete();
+ }
+ }
}
--
Gitblit v1.8.0