Commit 95889f358c7e735eb0712047002ef79a4b982a06

Authored by lawrencehj
1 parent fa98c6b8

完善向上级注册/注销过程

src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
@@ -60,16 +60,17 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor { @@ -60,16 +60,17 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor {
60 logger.info(String.format("未找到callId: %s 的注册/注销平台id", callId )); 60 logger.info(String.format("未找到callId: %s 的注册/注销平台id", callId ));
61 return; 61 return;
62 } 62 }
63 - logger.info(String.format("收到 %s 的注册/注销%S响应", platformGBId, response.getStatusCode() ));  
64 63
65 ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformGBId); 64 ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformGBId);
66 if (parentPlatformCatch == null) { 65 if (parentPlatformCatch == null) {
67 logger.warn(String.format("收到 %s 的注册/注销%S请求, 但是平台缓存信息未查询到!!!", platformGBId, response.getStatusCode())); 66 logger.warn(String.format("收到 %s 的注册/注销%S请求, 但是平台缓存信息未查询到!!!", platformGBId, response.getStatusCode()));
68 return; 67 return;
69 } 68 }
  69 + String action = parentPlatformCatch.getParentPlatform().getExpires().equals("0") ? "注销" : "注册";
  70 + logger.info(String.format("收到 %s %s的%S响应", platformGBId, action, response.getStatusCode() ));
70 ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform(); 71 ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform();
71 if (parentPlatform == null) { 72 if (parentPlatform == null) {
72 - logger.warn(String.format("收到 %s 的注册/注销%S请求, 但是平台信息未查询到!!!", platformGBId, response.getStatusCode())); 73 + logger.warn(String.format("收到 %s %s的%S请求, 但是平台信息未查询到!!!", platformGBId, action, response.getStatusCode()));
73 return; 74 return;
74 } 75 }
75 76
@@ -77,11 +78,16 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor { @@ -77,11 +78,16 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor {
77 WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME); 78 WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME);
78 sipCommanderForPlatform.register(parentPlatform, callId, www, null, null); 79 sipCommanderForPlatform.register(parentPlatform, callId, www, null, null);
79 }else if (response.getStatusCode() == 200){ 80 }else if (response.getStatusCode() == 200){
80 - // 注册成功  
81 - logger.info(String.format("%s 注册成功", platformGBId )); 81 + // 注册/注销成功
  82 + logger.info(String.format("%s %s成功", platformGBId, action));
82 redisCatchStorage.delPlatformRegisterInfo(callId); 83 redisCatchStorage.delPlatformRegisterInfo(callId);
83 parentPlatform.setStatus(true); 84 parentPlatform.setStatus(true);
  85 + // 取回Expires设置,避免注销过程中被置为0
  86 + ParentPlatform parentPlatformTmp = storager.queryParentPlatById(platformGBId);
  87 + String expires = parentPlatformTmp.getExpires();
  88 + parentPlatform.setExpires(expires);
84 storager.updateParentPlatform(parentPlatform); 89 storager.updateParentPlatform(parentPlatform);
  90 +
85 redisCatchStorage.updatePlatformRegister(parentPlatform); 91 redisCatchStorage.updatePlatformRegister(parentPlatform);
86 92
87 redisCatchStorage.updatePlatformKeepalive(parentPlatform); 93 redisCatchStorage.updatePlatformKeepalive(parentPlatform);