Compare commits

...

3 Commits

Author SHA1 Message Date
山海守门人
766ff34b86
Pre Merge pull request !44 from 山海守门人/dev_260107 2026-01-29 22:15:20 +00:00
lin
40555d917b redis增肌连接池支持,增加设备国标严格限制设置 2026-01-30 06:14:58 +08:00
紫穹
bed4e79061 fix: 修改编译版本为jdk21 2026-01-07 07:46:49 +08:00
5 changed files with 26 additions and 4 deletions

View File

@ -1,4 +1,4 @@
FROM ringcentral/jdk:11 AS builder
FROM ringcentral/jdk:21 AS builder
EXPOSE 18978/tcp
EXPOSE 8116/tcp
@ -56,11 +56,11 @@ COPY . /build
WORKDIR /build
RUN ls && mvn clean package -Dmaven.test.skip=true
WORKDIR /build/target
#确保文件名一致
#确保文件名一致
RUN mv wvp-pro-*.jar wvp.jar
FROM ringcentral/jdk:11
FROM ringcentral/jdk:21
RUN mkdir -p /opt/wvp
WORKDIR /opt/wvp
COPY --from=builder /build/target /opt/wvp

View File

@ -405,6 +405,11 @@
<version>1.18.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

View File

@ -219,4 +219,9 @@ public class UserSetting {
*/
private boolean useAliasForGroupSync = false;
/**
* 设备ID严格模式开启后设备注册时如果设备ID不符合规范则拒绝注册, 默认开启
*/
private boolean deviceIdStrict = true;
}

View File

@ -29,7 +29,7 @@ public class GbCode {
* 解析国标编号
*/
public static GbCode decode(String code){
if (code == null || code.trim().length() != 20) {
if (code == null || code.trim().length() != 20 || !code.matches("\\d{20}")) {
return null;
}
code = code.trim();

View File

@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
import com.genersoft.iot.vmp.conf.UserSetting;
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.GbCode;
import com.genersoft.iot.vmp.gb28181.bean.GbSipDate;
import com.genersoft.iot.vmp.common.RemoteAddressInfo;
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
@ -88,6 +89,17 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
AddressImpl address = (AddressImpl) fromHeader.getAddress();
SipUri uri = (SipUri) address.getURI();
String deviceId = uri.getUser();
if (userSetting.isDeviceIdStrict()) {
// 严格模式下非20位设备ID不予处理
GbCode decode = GbCode.decode(deviceId);
if (decode == null) {
// 注册失败
response = getMessageFactory().createResponse(Response.FORBIDDEN, request);
sipSender.transmitRequest(request.getLocalAddress().getHostAddress(), response);
return;
}
}
// 调整逻辑如果为设置公共密码那么就必须要预设用户信息否则无法注册
Device device = deviceService.getDeviceByDeviceId(deviceId);