Commit 95889f358c7e735eb0712047002ef79a4b982a06
1 parent
fa98c6b8
完善向上级注册/注销过程
Showing
1 changed file
with
10 additions
and
4 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/response/impl/RegisterResponseProcessor.java
| ... | ... | @@ -60,16 +60,17 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor { |
| 60 | 60 | logger.info(String.format("未找到callId: %s 的注册/注销平台id", callId )); |
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | - logger.info(String.format("收到 %s 的注册/注销%S响应", platformGBId, response.getStatusCode() )); | |
| 64 | 63 | |
| 65 | 64 | ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformGBId); |
| 66 | 65 | if (parentPlatformCatch == null) { |
| 67 | 66 | logger.warn(String.format("收到 %s 的注册/注销%S请求, 但是平台缓存信息未查询到!!!", platformGBId, response.getStatusCode())); |
| 68 | 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 | 71 | ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform(); |
| 71 | 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 | 74 | return; |
| 74 | 75 | } |
| 75 | 76 | |
| ... | ... | @@ -77,11 +78,16 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor { |
| 77 | 78 | WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME); |
| 78 | 79 | sipCommanderForPlatform.register(parentPlatform, callId, www, null, null); |
| 79 | 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 | 83 | redisCatchStorage.delPlatformRegisterInfo(callId); |
| 83 | 84 | parentPlatform.setStatus(true); |
| 85 | + // 取回Expires设置,避免注销过程中被置为0 | |
| 86 | + ParentPlatform parentPlatformTmp = storager.queryParentPlatById(platformGBId); | |
| 87 | + String expires = parentPlatformTmp.getExpires(); | |
| 88 | + parentPlatform.setExpires(expires); | |
| 84 | 89 | storager.updateParentPlatform(parentPlatform); |
| 90 | + | |
| 85 | 91 | redisCatchStorage.updatePlatformRegister(parentPlatform); |
| 86 | 92 | |
| 87 | 93 | redisCatchStorage.updatePlatformKeepalive(parentPlatform); | ... | ... |