From 54d79531795d43bf45fa8d7cb2ed2d072f7f5ccd Mon Sep 17 00:00:00 2001 From: panlinlin <648540858@qq.com> Date: 星期四, 07 一月 2021 13:15:39 +0800 Subject: [PATCH] 完成向上级联->删除的时候注销 --- src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java | 29 ++++++++++++++++------------- 1 files changed, 16 insertions(+), 13 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..bfe5e3f 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鍝嶅簲澶勭悊鍣� @@ -62,24 +64,28 @@ 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() )); - ParentPlatform parentPlatform = storager.queryParentPlatById(platformGBId); + 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 )); @@ -90,11 +96,8 @@ 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