File was renamed from src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/AckRequestProcessor.java |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.request.impl;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.sip.*;
|
| | | import javax.sip.address.SipURI;
|
| | | import javax.sip.header.FromHeader;
|
| | | import javax.sip.header.HeaderAddress;
|
| | | import javax.sip.header.ToHeader;
|
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| | |
|
| | | import com.genersoft.iot.vmp.common.StreamInfo;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
| | | 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.media.zlm.ZLMRTPServerFactory;
|
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
| | | import com.genersoft.iot.vmp.service.IMediaServerService;
|
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
| | | 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 javax.sip.Dialog; |
| | | import javax.sip.DialogState; |
| | | import javax.sip.RequestEvent; |
| | | import javax.sip.address.SipURI; |
| | | import javax.sip.header.FromHeader; |
| | | import javax.sip.header.HeaderAddress; |
| | | import javax.sip.header.ToHeader; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | |
|
| | | /**
|
| | | * @Description:ACK请求处理器 |
| | | * @author: swwheihei
|
| | | * @date: 2020年5月3日 下午5:31:45 |
| | | * SIP命令类型: ACK请求 |
| | | */
|
| | | public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
| | | @Component |
| | | public class AckRequestProcessor extends SIPRequestProcessorParent implements InitializingBean, ISIPRequestProcessor { |
| | |
|
| | | private Logger logger = LoggerFactory.getLogger(AckRequestProcessor.class);
|
| | | private String method = "ACK"; |
| | |
|
| | | @Autowired |
| | | private SIPProcessorObserver sipProcessorObserver; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | | // 添加消息处理的订阅 |
| | | sipProcessorObserver.addRequestProcessor(method, this); |
| | | } |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage;
|
| | |
|
| | | @Autowired |
| | | private ZLMRTPServerFactory zlmrtpServerFactory;
|
| | |
|
| | | @Autowired |
| | | private IMediaServerService mediaServerService;
|
| | | |
| | |
|
| | | /**
|
| | | * 处理 ACK请求
|
| | |
| | | */
|
| | | @Override
|
| | | public void process(RequestEvent evt) {
|
| | | //Request request = evt.getRequest();
|
| | | Dialog dialog = evt.getDialog();
|
| | | if (dialog == null) return;
|
| | | //DialogState state = dialog.getState();
|
| | | if (/*request.getMecodewwthod().equals(Request.INVITE) &&*/ dialog.getState()== DialogState.CONFIRMED) {
|
| | | if (dialog.getState()== DialogState.CONFIRMED) { |
| | | String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser();
|
| | | String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser();
|
| | | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | // try {
|
| | | // Request ackRequest = null;
|
| | | // CSeq csReq = (CSeq) request.getHeader(CSeq.NAME);
|
| | | // ackRequest = dialog.createAck(csReq.getSeqNumber());
|
| | | // dialog.sendAck(ackRequest);
|
| | | // logger.info("send ack to callee:" + ackRequest.toString());
|
| | | // } catch (SipException e) {
|
| | | // e.printStackTrace();
|
| | | // } catch (InvalidArgumentException e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | |
| | | }
|
| | |
|
| | | public IRedisCatchStorage getRedisCatchStorage() {
|
| | | return redisCatchStorage;
|
| | | }
|
| | |
|
| | | public void setRedisCatchStorage(IRedisCatchStorage redisCatchStorage) {
|
| | | this.redisCatchStorage = redisCatchStorage;
|
| | | }
|
| | |
|
| | | public ZLMRTPServerFactory getZlmrtpServerFactory() {
|
| | | return zlmrtpServerFactory;
|
| | | }
|
| | |
|
| | | public void setZlmrtpServerFactory(ZLMRTPServerFactory zlmrtpServerFactory) {
|
| | | this.zlmrtpServerFactory = zlmrtpServerFactory;
|
| | | }
|
| | |
|
| | | public IMediaServerService getMediaServerService() {
|
| | | return mediaServerService;
|
| | | }
|
| | |
|
| | | public void setMediaServerService(IMediaServerService mediaServerService) {
|
| | | this.mediaServerService = mediaServerService;
|
| | | }
|
| | | }
|