From 241d223b8a14d9bd4e0d8c24809835355a29fa9d Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Thu, 25 Jan 2024 17:46:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java index c5be4874..cb0d3ddf 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/AssistRESTfulUtils.java @@ -161,6 +161,7 @@ public class AssistRESTfulUtils { if (mediaServerItem == null) { return null; } + logger.info("[访问assist]: {}, 参数: {}", url, param); JSONObject responseJSON = new JSONObject(); //-2自定义流媒体 调用错误码 responseJSON.put("code",-2); From 695f9b7f4d24e5dc0bc80d9093d4a3ca61188593 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 29 Jan 2024 19:31:07 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9D=A5=E8=87=AA?= =?UTF-8?q?=E5=85=B6=E4=BB=96wvp=E7=9A=84=E6=8E=A8=E6=B5=81=E6=97=B6?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=90=8D=E7=A7=B0=E6=9C=AA=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transmit/event/request/impl/InviteRequestProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java index f9a0b7e6..ffe932de 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java @@ -808,7 +808,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements // 发送redis消息 redisGbPlayMsgListener.sendMsg(streamPushItem.getServerId(), streamPushItem.getMediaServerId(), streamPushItem.getApp(), streamPushItem.getStream(), addressStr, port, ssrc, requesterId, - channelId, mediaTransmissionTCP, platform.isRtcp(),null, responseSendItemMsg -> { + channelId, mediaTransmissionTCP, platform.isRtcp(),platform.getName(), responseSendItemMsg -> { SendRtpItem sendRtpItem = responseSendItemMsg.getSendRtpItem(); if (sendRtpItem == null || responseSendItemMsg.getMediaServerItem() == null) { logger.warn("服务器端口资源不足"); From ab34cb37f33f8a64df206c18d7fc5b970be5d0cb Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Mon, 29 Jan 2024 21:20:03 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E6=8C=87?= =?UTF-8?q?=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java | 4 ++++ .../iot/vmp/storager/impl/VideoManagerStorageImpl.java | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index b82bb71e..19bf8e77 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -611,6 +611,10 @@ public class SIPCommander implements ISIPCommander { */ @Override public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException { + if (device == null) { + logger.warn("[发送BYE] device为null"); + return; + } SsrcTransaction ssrcTransaction = streamSession.getSsrcTransaction(device.getDeviceId(), channelId, callId, stream); if (ssrcTransaction == null) { throw new SsrcTransactionNotFoundException(device.getDeviceId(), channelId, callId, stream); diff --git a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java index af9454d2..36aac212 100755 --- a/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java @@ -1,5 +1,6 @@ package com.genersoft.iot.vmp.storager.impl; +import com.baomidou.dynamic.datasource.annotation.DS; import com.genersoft.iot.vmp.conf.SipConfig; import com.genersoft.iot.vmp.conf.UserSetting; import com.genersoft.iot.vmp.gb28181.bean.*; @@ -38,6 +39,7 @@ import java.util.concurrent.ConcurrentHashMap; */ @SuppressWarnings("rawtypes") @Component +@DS("master") public class VideoManagerStorageImpl implements IVideoManagerStorage { private final Logger logger = LoggerFactory.getLogger(VideoManagerStorageImpl.class); From 68fbc8fef1ba8d77472e6b849c9265fff751ec31 Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: Wed, 31 Jan 2024 17:23:47 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B7=A8=E5=9F=9F?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E8=B7=A8=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iot/vmp/conf/security/WebSecurityConfig.java | 13 ++++++++++--- src/main/resources/all-application.yml | 2 +- src/main/resources/application-dev.yml | 4 ---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java index ee147f14..bbf9eb1b 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java @@ -1,12 +1,12 @@ package com.genersoft.iot.vmp.conf.security; import com.genersoft.iot.vmp.conf.UserSetting; -import org.springframework.core.annotation.Order; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.dao.DaoAuthenticationProvider; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; @@ -25,6 +25,7 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; /** * 配置Spring Security @@ -129,8 +130,14 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { corsConfiguration.setAllowedHeaders(Arrays.asList("*")); corsConfiguration.setAllowedMethods(Arrays.asList("*")); corsConfiguration.setMaxAge(3600L); - corsConfiguration.setAllowCredentials(true); - corsConfiguration.setAllowedOrigins(userSetting.getAllowedOrigins()); + if (userSetting.getAllowedOrigins() != null && !userSetting.getAllowedOrigins().isEmpty()) { + corsConfiguration.setAllowCredentials(true); + corsConfiguration.setAllowedOrigins(userSetting.getAllowedOrigins()); + }else { + corsConfiguration.setAllowCredentials(false); + corsConfiguration.setAllowedOrigins(Collections.singletonList(CorsConfiguration.ALL)); + } + corsConfiguration.setExposedHeaders(Arrays.asList(JwtUtils.getHeader())); UrlBasedCorsConfigurationSource url = new UrlBasedCorsConfigurationSource(); diff --git a/src/main/resources/all-application.yml b/src/main/resources/all-application.yml index 1384bd37..528bd1ae 100644 --- a/src/main/resources/all-application.yml +++ b/src/main/resources/all-application.yml @@ -237,7 +237,7 @@ user-settings: register-again-after-time: 60 # 国标续订方式,true为续订,每次注册在同一个会话里,false为重新注册,每次使用新的会话 register-keep-int-dialog: false - # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个 + # 跨域配置,不配置此项则允许所有跨域请求,配置后则只允许配置的页面的地址请求, 可以配置多个 allowed-origins: - http://localhost:8008 - http://192.168.1.3:8008 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index af9bd31e..8f9661bd 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -110,10 +110,6 @@ user-settings: auto-apply-play: true # 设备/通道状态变化时发送消息 device-status-notify: true - # 跨域配置,配置你访问前端页面的地址即可, 可以配置多个 - allowed-origins: - - http://localhost:8080 - - http://127.0.0.1:8080 # [可选] 日志配置, 一般不需要改 logging: config: classpath:logback-spring-local.xml