|  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderPlarformProvider; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.service.IMediaServerService; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 
|---|
|  |  |  | 
|---|
|  |  |  | private SipSubscribe sipSubscribe; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ZLMRTPServerFactory zlmrtpServerFactory; | 
|---|
|  |  |  | private ZLMServerFactory ZLMServerFactory; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SipLayer sipLayer; | 
|---|
|  |  |  | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | if (channel.getChannelId().length() != 20) { | 
|---|
|  |  |  | catalogXml.append("</Item>\r\n"); | 
|---|
|  |  |  | logger.warn("[编号长度异常] {} 长度错误,请使用20位长度的国标编号,当前长度:{}", channel.getChannelId(), channel.getChannelId().length()); | 
|---|
|  |  |  | catalogXml.append("</Item>\r\n"); | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | switch (Integer.parseInt(channel.getChannelId().substring(10, 13))){ | 
|---|
|  |  |  | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | catalogXml.append("<PTZType></PTZType>\r\n"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | catalogXml.append("<Status>" + (channel.getStatus() == 1?"ON":"OFF") + "</Status>\r\n"); | 
|---|
|  |  |  | catalogXml.append("<Status>" + (channel.isStatus() ?"ON":"OFF") + "</Status>\r\n"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | catalogXml.append("<Longitude>" + | 
|---|
|  |  |  | (channel.getLongitudeWgs84() != 0? channel.getLongitudeWgs84():channel.getLongitude()) | 
|---|
|  |  |  | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException { | 
|---|
|  |  |  | public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,boolean status) throws SipException, InvalidArgumentException, ParseException { | 
|---|
|  |  |  | if (parentPlatform == null) { | 
|---|
|  |  |  | return ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | String statusStr = (status==1)?"ONLINE":"OFFLINE"; | 
|---|
|  |  |  | String statusStr = (status)?"ONLINE":"OFFLINE"; | 
|---|
|  |  |  | String characterSet = parentPlatform.getCharacterSet(); | 
|---|
|  |  |  | StringBuffer deviceStatusXml = new StringBuffer(600); | 
|---|
|  |  |  | deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n") | 
|---|
|  |  |  | 
|---|
|  |  |  | catalogXml.append("<Manufacturer>" + channel.getManufacture() + "</Manufacturer>\r\n") | 
|---|
|  |  |  | .append("<Secrecy>" + channel.getSecrecy() + "</Secrecy>\r\n") | 
|---|
|  |  |  | .append("<RegisterWay>" + channel.getRegisterWay() + "</RegisterWay>\r\n") | 
|---|
|  |  |  | .append("<Status>" + (channel.getStatus() == 0 ? "OFF" : "ON") + "</Status>\r\n"); | 
|---|
|  |  |  | .append("<Status>" + (channel.isStatus() ? "ON" : "OFF") + "</Status>\r\n"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (channel.getChannelType() != 2) {  // 业务分组/虚拟组织/行政区划 不设置以下属性 | 
|---|
|  |  |  | catalogXml.append("<Model>" + channel.getModel() + "</Model>\r\n") | 
|---|
|  |  |  | 
|---|
|  |  |  | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); | 
|---|
|  |  |  | if (mediaServerItem != null) { | 
|---|
|  |  |  | mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc()); | 
|---|
|  |  |  | zlmrtpServerFactory.closeRtpServer(mediaServerItem, sendRtpItem.getStreamId()); | 
|---|
|  |  |  | ZLMServerFactory.closeRtpServer(mediaServerItem, sendRtpItem.getStreamId()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | SIPRequest byeRequest = headerProviderPlatformProvider.createByeRequest(parentPlatform, sendRtpItem); | 
|---|
|  |  |  | if (byeRequest == null) { | 
|---|