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

pull/67/head
lawrencehj 2021-03-15 15:22:04 +08:00
parent fa98c6b8c2
commit 95889f358c
1 changed files with 10 additions and 4 deletions

View File

@ -60,16 +60,17 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor {
logger.info(String.format("未找到callId %s 的注册/注销平台id", callId )); logger.info(String.format("未找到callId %s 的注册/注销平台id", callId ));
return; return;
} }
logger.info(String.format("收到 %s 的注册/注销%S响应", platformGBId, response.getStatusCode() ));
ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformGBId); ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(platformGBId);
if (parentPlatformCatch == null) { if (parentPlatformCatch == null) {
logger.warn(String.format("收到 %s 的注册/注销%S请求, 但是平台缓存信息未查询到!!!", platformGBId, response.getStatusCode())); logger.warn(String.format("收到 %s 的注册/注销%S请求, 但是平台缓存信息未查询到!!!", platformGBId, response.getStatusCode()));
return; return;
} }
String action = parentPlatformCatch.getParentPlatform().getExpires().equals("0") ? "注销" : "注册";
logger.info(String.format("收到 %s %s的%S响应", platformGBId, action, response.getStatusCode() ));
ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform(); ParentPlatform parentPlatform = parentPlatformCatch.getParentPlatform();
if (parentPlatform == null) { if (parentPlatform == null) {
logger.warn(String.format("收到 %s 注册/注销%S请求, 但是平台信息未查询到!!!", platformGBId, response.getStatusCode())); logger.warn(String.format("收到 %s %s的%S请求, 但是平台信息未查询到!!!", platformGBId, action, response.getStatusCode()));
return; return;
} }
@ -77,11 +78,16 @@ public class RegisterResponseProcessor implements ISIPResponseProcessor {
WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME); WWWAuthenticateHeader www = (WWWAuthenticateHeader)response.getHeader(WWWAuthenticateHeader.NAME);
sipCommanderForPlatform.register(parentPlatform, callId, www, null, null); sipCommanderForPlatform.register(parentPlatform, callId, www, null, null);
}else if (response.getStatusCode() == 200){ }else if (response.getStatusCode() == 200){
// 注册成功 // 注册/注销成功
logger.info(String.format("%s 注册成功", platformGBId )); logger.info(String.format("%s %s成功", platformGBId, action));
redisCatchStorage.delPlatformRegisterInfo(callId); redisCatchStorage.delPlatformRegisterInfo(callId);
parentPlatform.setStatus(true); parentPlatform.setStatus(true);
// 取回Expires设置避免注销过程中被置为0
ParentPlatform parentPlatformTmp = storager.queryParentPlatById(platformGBId);
String expires = parentPlatformTmp.getExpires();
parentPlatform.setExpires(expires);
storager.updateParentPlatform(parentPlatform); storager.updateParentPlatform(parentPlatform);
redisCatchStorage.updatePlatformRegister(parentPlatform); redisCatchStorage.updatePlatformRegister(parentPlatform);
redisCatchStorage.updatePlatformKeepalive(parentPlatform); redisCatchStorage.updatePlatformKeepalive(parentPlatform);