From 8da6906e40c8a96a94624b468833bebc2c3a3d5c Mon Sep 17 00:00:00 2001
From: Lawrence <1934378145@qq.com>
Date: 星期三, 20 一月 2021 20:43:40 +0800
Subject: [PATCH] 修改功能说明
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java | 42 ++++++++++++++++++++++--------------------
1 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
index 0885712..4716a30 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
@@ -22,9 +22,11 @@
import javax.sip.address.Address;
import javax.sip.address.URI;
import javax.sip.header.CallIdHeader;
+import javax.sip.header.ExpiresHeader;
import javax.sip.header.ToHeader;
import javax.sip.header.WWWAuthenticateHeader;
import javax.sip.message.Response;
+import java.util.UUID;
/**
* @Description:Register鍝嶅簲澶勭悊鍣�
@@ -59,42 +61,42 @@
public void process(ResponseEvent evt, SipLayer layer, SipConfig config) {
// TODO Auto-generated method stub
Response response = evt.getResponse();
- ToHeader toHeader = (ToHeader) response.getHeader(ToHeader.NAME);
- SipUri uri = (SipUri)toHeader.getAddress().getURI();
- String platformGBId = uri.getAuthority().getUser();
- logger.info(String.format("鏀跺埌 %s 鐨勬敞鍐�%S璇锋眰", platformGBId, response.getStatusCode() ));
+ CallIdHeader callIdHeader = (CallIdHeader) response.getHeader(CallIdHeader.NAME);
+ String callId = callIdHeader.getCallId();
- ParentPlatform parentPlatform = storager.queryParentPlatById(platformGBId);
+ String platformGBId = redisCatchStorage.queryPlatformRegisterInfo(callId);
+ if (platformGBId == null) {
+ logger.info(String.format("鏈壘鍒癱allId锛� %s 鐨勬敞鍐�/娉ㄩ攢骞冲彴id", callId ));
+ return;
+ }
+ logger.info(String.format("鏀跺埌 %s 鐨勬敞鍐�/娉ㄩ攢%S鍝嶅簲", platformGBId, response.getStatusCode() ));
+
+ ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformGBId);
+ if (parentPlatformCatch == null) {
+ logger.warn(String.format("鏀跺埌 %s 鐨勬敞鍐�/娉ㄩ攢%S璇锋眰, 浣嗘槸骞冲彴缂撳瓨淇℃伅鏈煡璇㈠埌!!!", platformGBId, response.getStatusCode()));
+ return;
+ }
+ ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform();
if (parentPlatform == null) {
- logger.warn(String.format("鏀跺埌 %s 鐨勬敞鍐�%S璇锋眰, 浣嗘槸骞冲彴淇℃伅鏈煡璇㈠埌!!!", platformGBId, response.getStatusCode()));
+ logger.warn(String.format("鏀跺埌 %s 鐨勬敞鍐�/娉ㄩ攢%S璇锋眰, 浣嗘槸骞冲彴淇℃伅鏈煡璇㈠埌!!!", platformGBId, response.getStatusCode()));
return;
}
if (response.getStatusCode() == 401) {
-
WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME);
- String realm = www.getRealm();
- String nonce = www.getNonce();
- String scheme = www.getScheme();
-
- CallIdHeader callIdHeader = (CallIdHeader)response.getHeader(CallIdHeader.NAME);
- String callId = callIdHeader.getCallId();
- sipCommanderForPlatform.register(parentPlatform, callId, realm, nonce, scheme);
+ sipCommanderForPlatform.register(parentPlatform, callId, www, null, null);
}else if (response.getStatusCode() == 200){
// 娉ㄥ唽鎴愬姛
logger.info(String.format("%s 娉ㄥ唽鎴愬姛", platformGBId ));
+ redisCatchStorage.delPlatformRegisterInfo(callId);
parentPlatform.setStatus(true);
storager.updateParentPlatform(parentPlatform);
- //
redisCatchStorage.updatePlatformRegister(parentPlatform);
redisCatchStorage.updatePlatformKeepalive(parentPlatform);
- ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getDeviceGBId());
- if (parentPlatformCatch == null) {
- parentPlatformCatch = new ParentPlatformCatch();
- parentPlatformCatch.setId(parentPlatform.getDeviceGBId());
- }
+ parentPlatformCatch.setParentPlatform(parentPlatform);
+
redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
}
}
--
Gitblit v1.8.0