panlinlin
2021-01-15 e09e541c827157884e013ff0b50aa88b8b0f46be
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
@@ -70,7 +70,7 @@
    @Override
    public boolean unregister(ParentPlatform parentPlatform, SipSubscribe.Event errorEvent , SipSubscribe.Event okEvent) {
        parentPlatform.setExpires("0");
        ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getDeviceGBId());
        ParentPlatformCatch parentPlatformCatch = redisCatchStorage.queryPlatformCatchInfo(parentPlatform.getServerGBId());
        if (parentPlatformCatch != null) {
            parentPlatformCatch.setParentPlatform(parentPlatform);
            redisCatchStorage.updatePlatformCatchInfo(parentPlatformCatch);
@@ -86,11 +86,21 @@
            if (www == null ) {
                request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, 1L, null, null);
                // 将 callid 写入缓存, 等注册成功可以更新状态
                CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME);
                redisCatchStorage.updatePlatformRegisterInfo(callIdHeader.getCallId(), parentPlatform.getServerGBId());
                sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (event)->{
                    redisCatchStorage.delPlatformRegisterInfo(callIdHeader.getCallId());
                    if (errorEvent != null) {
                        errorEvent.response(event);
                    }
                });
            }else {
                request = headerProviderPlarformProvider.createRegisterRequest(parentPlatform, null, null, callId, www);
            }
            transmitRequest(parentPlatform, request, errorEvent, okEvent);
            transmitRequest(parentPlatform, request, null, okEvent);
            return true;
        } catch (ParseException e) {
            e.printStackTrace();