| | |
| | | // 校验密码是否正确
|
| | | if (authorhead != null) {
|
| | | passwordCorrect = new DigestServerAuthenticationHelper().doAuthenticatePlainTextPassword(request,
|
| | | sipConfig.getSipPassword());
|
| | | sipConfig.getPassword());
|
| | | }
|
| | | if (StringUtils.isEmpty(sipConfig.getSipPassword())){
|
| | | if (StringUtils.isEmpty(sipConfig.getPassword())){
|
| | | passwordCorrect = true;
|
| | | }
|
| | |
|
| | | // 未携带授权头或者密码错误 回复401
|
| | | if (authorhead == null ) {
|
| | | |
| | | if (authorhead == null) {
|
| | | logger.info("[{}] 未携带授权头 回复401", requestAddress);
|
| | | } else if (!passwordCorrect) {
|
| | | logger.info("[{}] 密码错误 回复401", requestAddress);
|
| | | }
|
| | |
|
| | | logger.info("[{}] 未携带授权头 回复401", requestAddress);
|
| | | response = getMessageFactory().createResponse(Response.UNAUTHORIZED, request);
|
| | | new DigestServerAuthenticationHelper().generateChallenge(getHeaderFactory(), response, sipConfig.getSipDomain());
|
| | | new DigestServerAuthenticationHelper().generateChallenge(getHeaderFactory(), response, sipConfig.getDomain());
|
| | | }else {
|
| | | if (!passwordCorrect){
|
| | | // 注册失败
|
| | | response = getMessageFactory().createResponse(Response.FORBIDDEN, request);
|
| | | response.setReasonPhrase("wrong password");
|
| | | logger.info("[{}] 密码错误 回复403", requestAddress);
|
| | | }else {
|
| | | // 携带授权头并且密码正确
|
| | | response = getMessageFactory().createResponse(Response.OK, request);
|
| | |
| | | if (device == null) {
|
| | | device = new Device();
|
| | | device.setStreamMode("UDP");
|
| | | device.setCharset("gb2312");
|
| | | device.setDeviceId(deviceId);
|
| | | device.setFirsRegister(true);
|
| | | }
|
| | | device.setIp(received);
|
| | | device.setPort(rPort);
|