| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.response.impl; |
| | | |
| | | import com.genersoft.iot.vmp.conf.SipConfig; |
| | | import com.genersoft.iot.vmp.gb28181.SipLayer; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| | | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract; |
| | | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| | | import com.genersoft.iot.vmp.utils.GitUtil; |
| | | import gov.nist.javax.sip.ResponseEventExt; |
| | | import gov.nist.javax.sip.message.SIPResponse; |
| | | import gov.nist.javax.sip.stack.SIPClientTransaction; |
| | | import gov.nist.javax.sip.stack.SIPDialog; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import javax.sip.address.Address; |
| | | import javax.sip.address.SipURI; |
| | | import javax.sip.header.CSeqHeader; |
| | | import javax.sip.header.CallIdHeader; |
| | | import javax.sip.header.UserAgentHeader; |
| | | import javax.sip.message.Request; |
| | | import javax.sip.message.Response; |
| | | import java.text.ParseException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private SipFactory sipFactory; |
| | | |
| | | @Autowired |
| | | private GitUtil gitUtil; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | |
| | | // 下发ack |
| | | if (statusCode == Response.OK) { |
| | | ResponseEventExt event = (ResponseEventExt)evt; |
| | | SIPDialog dialog = (SIPDialog)evt.getDialog(); |
| | | SIPDialog dialog = new SIPDialog((SIPClientTransaction) event.getClientTransaction(), (SIPResponse) event.getResponse()); |
| | | CSeqHeader cseq = (CSeqHeader) response.getHeader(CSeqHeader.NAME); |
| | | Request reqAck = dialog.createAck(cseq.getSeqNumber()); |
| | | SipURI requestURI = (SipURI) reqAck.getRequestURI(); |
| | |
| | | } |
| | | requestURI.setPort(event.getRemotePort()); |
| | | reqAck.setRequestURI(requestURI); |
| | | List<String> agentParam = new ArrayList<>(); |
| | | agentParam.add("wvp-pro"); |
| | | // TODO 添加版本信息以及日期 |
| | | UserAgentHeader userAgentHeader = null; |
| | | try { |
| | | userAgentHeader = sipFactory.createHeaderFactory().createUserAgentHeader(agentParam); |
| | | } catch (ParseException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | UserAgentHeader userAgentHeader = SipUtils.createUserAgentHeader(sipFactory, gitUtil); |
| | | reqAck.addHeader(userAgentHeader); |
| | | Address concatAddress = sipFactory.createAddressFactory().createAddress(sipFactory.createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort())); |
| | | reqAck.addHeader(sipFactory.createHeaderFactory().createContactHeader(concatAddress)); |