From 5cecb10b00e1f439917b5fc230ea46d8b28dd82d Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 17 Dec 2020 14:46:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=BF=A1=E4=BB=A4=E5=8C=85?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0Expires=E5=A4=B4=EF=BC=8C=E4=BF=AE=E6=94=B9CS?= =?UTF-8?q?eq=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transmit/cmd/SIPRequestHeaderProvider.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java index fa3465dd..d4321d96 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderProvider.java @@ -173,7 +173,7 @@ public class SIPRequestHeaderProvider { } - public Request createRegisterRequest(@NotNull ParentPlatform platform, String fromTag, String viaTag) throws ParseException, InvalidArgumentException, PeerUnavailableException { + public Request createRegisterRequest(@NotNull ParentPlatform platform, long CSeq, String fromTag, String viaTag) throws ParseException, InvalidArgumentException, PeerUnavailableException { Request request = null; String sipAddress = sipConfig.getSipIp() + ":" + sipConfig.getSipPort(); //请求行 @@ -206,7 +206,7 @@ public class SIPRequestHeaderProvider { MaxForwardsHeader maxForwards = sipFactory.createHeaderFactory().createMaxForwardsHeader(70); //ceq - CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(1L, Request.REGISTER); + CSeqHeader cSeqHeader = sipFactory.createHeaderFactory().createCSeqHeader(CSeq, Request.REGISTER); request = sipFactory.createMessageFactory().createRequest(requestLine, Request.REGISTER, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards); @@ -214,12 +214,15 @@ public class SIPRequestHeaderProvider { .createSipURI(platform.getDeviceGBId(), sipAddress)); request.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); + ExpiresHeader expires = sipFactory.createHeaderFactory().createExpiresHeader(3600); + request.addHeader(expires); + return request; } public Request createRegisterRequest(@NotNull ParentPlatform parentPlatform, String fromTag, String viaTag, String callId, String realm, String nonce, String scheme) throws ParseException, PeerUnavailableException, InvalidArgumentException { - Request registerRequest = createRegisterRequest(parentPlatform, fromTag, viaTag); + Request registerRequest = createRegisterRequest(parentPlatform, 2L, fromTag, viaTag); CallIdHeader callIdHeader = (CallIdHeader)registerRequest.getHeader(CallIdHeader.NAME); callIdHeader.setCallId(callId); @@ -233,8 +236,7 @@ public class SIPRequestHeaderProvider { String RESPONSE = DigestUtils.md5DigestAsHex((HA1 + ":" + nonce + ":" + HA2).getBytes()); String authorizationHeaderContent = scheme + " username=\"" + parentPlatform.getDeviceGBId() + "\", " + "realm=\"" - + realm + "\", uri=\"" + uri + "\", response=\"" + RESPONSE + "\", nonce=\"" - + nonce + "\""; + + realm + "\", nonce=\"" + nonce + "\", uri=\"" + uri + "\", response=\"" + RESPONSE + "\"" + ", algorithm=MD5"; AuthorizationHeader authorizationHeader = sipFactory.createHeaderFactory().createAuthorizationHeader(authorizationHeaderContent); registerRequest.addHeader(authorizationHeader);