File was renamed from src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/RegisterRequestProcessor.java |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.request.impl;
|
| | |
|
| | | import java.security.NoSuchAlgorithmException;
|
| | | import java.text.ParseException;
|
| | | import java.util.Calendar;
|
| | | import java.util.Locale;
|
| | |
|
| | | import javax.sip.InvalidArgumentException;
|
| | | import javax.sip.RequestEvent;
|
| | | import javax.sip.ServerTransaction;
|
| | | import javax.sip.SipException;
|
| | | import javax.sip.header.AuthorizationHeader;
|
| | | import javax.sip.header.ContactHeader;
|
| | | import javax.sip.header.ExpiresHeader;
|
| | | import javax.sip.header.FromHeader;
|
| | | import javax.sip.header.ViaHeader;
|
| | | import javax.sip.message.Request;
|
| | | import javax.sip.message.Response;
|
| | |
|
| | | import com.genersoft.iot.vmp.gb28181.bean.WvpSipDate;
|
| | | import gov.nist.javax.sip.RequestEventExt;
|
| | | import gov.nist.javax.sip.header.SIPDateHeader;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.util.StringUtils;
|
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| | |
|
| | | import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
| | | import com.genersoft.iot.vmp.conf.SipConfig;
|
| | | import com.genersoft.iot.vmp.gb28181.auth.DigestServerAuthenticationHelper;
|
| | | import com.genersoft.iot.vmp.gb28181.auth.RegisterLogicHandler;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.Device;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.WvpSipDate; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcessor;
|
| | | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
| | |
|
| | | import gov.nist.javax.sip.RequestEventExt; |
| | | import gov.nist.javax.sip.address.AddressImpl;
|
| | | import gov.nist.javax.sip.address.SipUri;
|
| | | import gov.nist.javax.sip.header.Expires;
|
| | | import gov.nist.javax.sip.header.SIPDateHeader; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.InitializingBean; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.sip.InvalidArgumentException; |
| | | import javax.sip.RequestEvent; |
| | | import javax.sip.ServerTransaction; |
| | | import javax.sip.SipException; |
| | | import javax.sip.header.*; |
| | | import javax.sip.message.Request; |
| | | import javax.sip.message.Response; |
| | | import java.security.NoSuchAlgorithmException; |
| | | import java.text.ParseException; |
| | | import java.util.Calendar; |
| | | import java.util.Locale; |
| | |
|
| | | /**
|
| | | * @Description:收到注册请求 处理 |
| | | * @author: swwheihei
|
| | | * @date: 2020年5月3日 下午4:47:25 |
| | | * SIP命令类型: REGISTER请求 |
| | | */
|
| | | public class RegisterRequestProcessor extends SIPRequestAbstractProcessor {
|
| | | @Component |
| | | public class RegisterRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor { |
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(RegisterRequestProcessor.class);
|
| | |
|
| | | public String method = "REGISTER"; |
| | | |
| | | @Autowired |
| | | private SipConfig sipConfig;
|
| | |
|
| | | @Autowired |
| | | private RegisterLogicHandler handler;
|
| | |
|
| | | @Autowired |
| | | private IVideoManagerStorager storager;
|
| | |
|
| | | @Autowired |
| | | private EventPublisher publisher;
|
| | | |
| | | @Autowired |
| | | private SIPProcessorObserver sipProcessorObserver; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | | // 添加消息处理的订阅 |
| | | sipProcessorObserver.addRequestProcessor(method, this); |
| | | } |
| | |
|
| | | /**
|
| | | * 收到注册请求 处理
|
| | |
| | | // 注册失败
|
| | | response = getMessageFactory().createResponse(Response.FORBIDDEN, request);
|
| | | response.setReasonPhrase("wrong password");
|
| | | logger.info("[{}] 密码错误 回复403", requestAddress);
|
| | | logger.info("[{}] 密码/SIP服务器ID错误, 回复403", requestAddress); |
| | | }else {
|
| | | // 携带授权头并且密码正确
|
| | | response = getMessageFactory().createResponse(Response.OK, request);
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | public void setSipConfig(SipConfig sipConfig) {
|
| | | this.sipConfig = sipConfig;
|
| | | }
|
| | |
|
| | | public void setHandler(RegisterLogicHandler handler) {
|
| | | this.handler = handler;
|
| | | }
|
| | |
|
| | | public void setVideoManagerStorager(IVideoManagerStorager storager) {
|
| | | this.storager = storager;
|
| | | }
|
| | |
|
| | | public void setPublisher(EventPublisher publisher) {
|
| | | this.publisher = publisher;
|
| | | }
|
| | |
|
| | | }
|