mirror of
https://gitee.com/pan648540858/wvp-GB28181-pro.git
synced 2026-05-25 14:37:53 +08:00
Merge branch 'master' into dev/压力测试
# Conflicts: # src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
This commit is contained in:
commit
6a1f2887e5
@ -219,6 +219,11 @@ public class UserSetting {
|
|||||||
*/
|
*/
|
||||||
private boolean useAliasForGroupSync = false;
|
private boolean useAliasForGroupSync = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID严格模式,开启后设备注册时如果设备ID不符合规范则拒绝注册, 默认开启
|
||||||
|
*/
|
||||||
|
private boolean deviceIdStrict = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对于识别为设备的国标设备的,是否默认开启位置订阅
|
* 对于识别为设备的国标设备的,是否默认开启位置订阅
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -29,7 +29,7 @@ public class GbCode {
|
|||||||
* 解析国标编号
|
* 解析国标编号
|
||||||
*/
|
*/
|
||||||
public static GbCode decode(String code){
|
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;
|
return null;
|
||||||
}
|
}
|
||||||
code = code.trim();
|
code = code.trim();
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.conf.SipConfig;
|
|||||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
|
import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
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.gb28181.bean.GbSipDate;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
|
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||||
@ -93,6 +94,17 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen
|
|||||||
AddressImpl address = (AddressImpl) fromHeader.getAddress();
|
AddressImpl address = (AddressImpl) fromHeader.getAddress();
|
||||||
SipUri uri = (SipUri) address.getURI();
|
SipUri uri = (SipUri) address.getURI();
|
||||||
String deviceId = uri.getUser();
|
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);
|
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user