From a208bc54334a44b6462da732d7a4d054a2949191 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Mon, 25 Sep 2023 11:48:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=86=E9=A2=91=E7=BB=93=E6=9D=9F=E6=97=B6?= =?UTF-8?q?=E4=B8=BB=E5=8A=A8=E5=8F=91=E9=80=81=20bye=20callId=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/device/DeviceProxyService.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/device/DeviceProxyService.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/device/DeviceProxyService.java index 83a3947..96376a3 100644 --- a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/device/DeviceProxyService.java +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/service/device/DeviceProxyService.java @@ -93,22 +93,6 @@ public class DeviceProxyService { downloadTask.put(device.getDeviceCode(), executor); scheduledExecutorService.schedule(subscriber::onComplete, time + 60, TimeUnit.SECONDS); executeResultHandler.waitFor(); - - String ip = request.getLocalAddress().getHostAddress(); - SipURI targetUri = (SipURI) request.getFromHeader().getAddress().getURI(); - String targetId = targetUri.getUser(); - String targetIp = request.getRemoteAddress().getHostAddress(); - int targetPort = request.getTopmostViaHeader().getPort(); - String transport = request.getTopmostViaHeader().getTransport(); - long seqNumber = request.getCSeq().getSeqNumber() + 1; - SipProvider provider = sender.getProvider(transport, ip); - CallIdHeader newCallId = request.getCallId(); - Request byeRequest = SipRequestBuilder.createByeRequest(targetIp, targetPort, seqNumber, targetId, SipUtil.generateFromTag(), null, newCallId.getCallId()); - try{ - provider.sendRequest(byeRequest); - }catch (Exception e){ - log.error("bye 请求发送失败 {}",e.getMessage()); - } }; } @@ -199,6 +183,22 @@ public class DeviceProxyService { String tag = request.getFromHeader().getTag(); sender.sendRequest(((provider, ip, port) -> SipRequestBuilder.createMessageRequest(device, ip, port, 1, XmlUtils.toXml(mediaStatusRequestDTO), SipUtil.generateViaTag(), tag, requestCallId))); + + String ip = request.getLocalAddress().getHostAddress(); + SipURI targetUri = (SipURI) request.getFromHeader().getAddress().getURI(); + String targetId = targetUri.getUser(); + String targetIp = request.getRemoteAddress().getHostAddress(); + int targetPort = request.getTopmostViaHeader().getPort(); + String transport = request.getTopmostViaHeader().getTransport(); + long seqNumber = request.getCSeq().getSeqNumber() + 1; + SipProvider provider = sender.getProvider(transport, ip); + CallIdHeader newCallId = request.getCallId(); + Request byeRequest = SipRequestBuilder.createByeRequest(targetIp, targetPort, seqNumber, targetId, SipUtil.generateFromTag(), null, newCallId.getCallId()); + try{ + provider.sendRequest(byeRequest); + }catch (Exception e){ + log.error("bye 请求发送失败 {}",e.getMessage()); + } } public boolean hasResult() {