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 1/4] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E4=BF=A1=E4=BB=A4?= =?UTF-8?q?=E5=8C=85=E5=A2=9E=E5=8A=A0Expires=E5=A4=B4=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9CSeq=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); From 87ce22e031399ebcfca8d65402f730be7d3b6dc5 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 17 Dec 2020 14:47:56 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E8=BF=87=E7=A8=8B?= =?UTF-8?q?=E4=B8=AD=E5=8C=BA=E5=88=86=E4=B8=8D=E5=90=8C=E7=9A=84CSeq?= =?UTF-8?q?=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java index baf6e5ac..020b7500 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java @@ -52,7 +52,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { try { Request request = null; if (realm == null || nonce == null) { - request = headerProvider.createRegisterRequest(parentPlatform, null, null); + request = headerProvider.createRegisterRequest(parentPlatform, 1L, null, null); }else { request = headerProvider.createRegisterRequest(parentPlatform, null, null, callId, realm, nonce, scheme); } From 8a82a71ded7459549e0c3448944fef97239e8fcb Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 17 Dec 2020 14:49:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=AC=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E9=85=8D=E7=BD=AE=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E6=96=B9=E4=BE=BF=E4=B8=8A=E7=BA=A7=E7=BA=A7=E8=81=94?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E5=A1=AB=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vmanager/platform/PlatformController.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java b/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java index 8af7cbfe..a94685e9 100644 --- a/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java +++ b/src/main/java/com/genersoft/iot/vmp/vmanager/platform/PlatformController.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.vmanager.platform; +import com.alibaba.fastjson.JSONObject; import com.genersoft.iot.vmp.common.PageResult; import com.genersoft.iot.vmp.gb28181.bean.Device; import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; @@ -15,6 +16,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; +import com.genersoft.iot.vmp.conf.SipConfig; + @CrossOrigin @RestController @@ -29,6 +32,19 @@ public class PlatformController { @Autowired private ISIPCommanderForPlatform commanderForPlatform; + @Autowired + private SipConfig sipConfig; + + @GetMapping("/platforms/serverconfig") + public ResponseEntity serverConfig() { + JSONObject result = new JSONObject(); + result.put("deviceIp", sipConfig.getSipIp()); + result.put("devicePort", sipConfig.getSipPort()); + result.put("username", sipConfig.getSipId()); + result.put("password", sipConfig.getSipPassword()); + return new ResponseEntity<>(result, HttpStatus.OK); + } + @GetMapping("/platforms/{count}/{page}") public PageResult platforms(@PathVariable int page, @PathVariable int count){ From 273ece96b50dbbfab59008afed6504db7dfe3254 Mon Sep 17 00:00:00 2001 From: Lawrence <1934378145@qq.com> Date: Thu, 17 Dec 2020 14:50:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E4=B8=8A=E7=BA=A7?= =?UTF-8?q?=E7=BA=A7=E8=81=94=E5=B9=B3=E5=8F=B0=E6=97=B6=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=A1=AB=E5=85=A5=E6=9C=AC=E7=BA=A7=E5=B9=B3=E5=8F=B0=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web_src/src/components/platformEdit.vue | 662 ++++++++++++------------ 1 file changed, 335 insertions(+), 327 deletions(-) diff --git a/web_src/src/components/platformEdit.vue b/web_src/src/components/platformEdit.vue index 7dee4ca4..7b5a258c 100644 --- a/web_src/src/components/platformEdit.vue +++ b/web_src/src/components/platformEdit.vue @@ -1,410 +1,418 @@