| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public void deviceStatusResponse(ParentPlatform parentPlatform, String sn, String fromTag) throws SipException, InvalidArgumentException, ParseException { |
| | | public void deviceStatusResponse(ParentPlatform parentPlatform,String channelId, String sn, String fromTag,int status) throws SipException, InvalidArgumentException, ParseException { |
| | | if (parentPlatform == null) { |
| | | return ; |
| | | } |
| | | String statusStr = (status==1)?"ONLINE":"OFFLINE"; |
| | | String characterSet = parentPlatform.getCharacterSet(); |
| | | StringBuffer deviceStatusXml = new StringBuffer(600); |
| | | deviceStatusXml.append("<?xml version=\"1.0\" encoding=\"" + characterSet + "\"?>\r\n"); |
| | | deviceStatusXml.append("<Response>\r\n"); |
| | | deviceStatusXml.append("<CmdType>DeviceStatus</CmdType>\r\n"); |
| | | deviceStatusXml.append("<SN>" +sn + "</SN>\r\n"); |
| | | deviceStatusXml.append("<DeviceID>" + parentPlatform.getDeviceGBId() + "</DeviceID>\r\n"); |
| | | deviceStatusXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| | | deviceStatusXml.append("<Result>OK</Result>\r\n"); |
| | | deviceStatusXml.append("<Online>ONLINE</Online>\r\n"); |
| | | deviceStatusXml.append("<Online>"+statusStr+"</Online>\r\n"); |
| | | deviceStatusXml.append("<Status>OK</Status>\r\n"); |
| | | deviceStatusXml.append("</Response>\r\n"); |
| | | |
| | |
| | | |
| | | Request request = headerProviderPlatformProvider.createMessageRequest(parentPlatform, deviceStatusXml.toString(), fromTag, SipUtils.getNewViaTag(), callIdHeader); |
| | | sipSender.transmitRequest(parentPlatform.getDeviceIp(), request); |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void streamByeCmd(ParentPlatform parentPlatform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException { |
| | | public synchronized void streamByeCmd(ParentPlatform platform, SendRtpItem sendRtpItem) throws SipException, InvalidArgumentException, ParseException { |
| | | if (sendRtpItem == null ) { |
| | | logger.info("[向上级发送BYE], sendRtpItem 为NULL"); |
| | | return; |
| | | } |
| | | if (parentPlatform == null) { |
| | | if (platform == null) { |
| | | logger.info("[向上级发送BYE], platform 为NULL"); |
| | | return; |
| | | } |
| | | logger.info("[向上级发送BYE], {}/{}", parentPlatform.getServerGBId(), sendRtpItem.getChannelId()); |
| | | logger.info("[向上级发送BYE], {}/{}", platform.getServerGBId(), sendRtpItem.getChannelId()); |
| | | String mediaServerId = sendRtpItem.getMediaServerId(); |
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); |
| | | if (mediaServerItem != null) { |
| | | mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc()); |
| | | zlmrtpServerFactory.closeRtpServer(mediaServerItem, sendRtpItem.getStreamId()); |
| | | } |
| | | SIPRequest byeRequest = headerProviderPlatformProvider.createByeRequest(parentPlatform, sendRtpItem); |
| | | SIPRequest byeRequest = headerProviderPlatformProvider.createByeRequest(platform, sendRtpItem); |
| | | if (byeRequest == null) { |
| | | logger.warn("[向上级发送bye]:无法创建 byeRequest"); |
| | | } |
| | | sipSender.transmitRequest(parentPlatform.getDeviceIp(),byeRequest); |
| | | sipSender.transmitRequest(platform.getDeviceIp(),byeRequest); |
| | | } |
| | | } |