| | |
| | | import javax.sip.message.Request;
|
| | | import javax.sip.message.Response;
|
| | |
|
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
| | | import org.dom4j.Document;
|
| | | import org.dom4j.DocumentException;
|
| | | import org.dom4j.Element;
|
| | |
| | | private SIPCommander cmder;
|
| | |
|
| | | private IVideoManagerStorager storager;
|
| | |
|
| | | private IRedisCatchStorage redisCatchStorage;
|
| | |
|
| | | private EventPublisher publisher;
|
| | |
|
| | |
| | | DeviceChannel deviceChannel = new DeviceChannel();
|
| | | deviceChannel.setName(channelName);
|
| | | deviceChannel.setChannelId(channelDeviceId);
|
| | | if (status.equals("ON") || status.equals("On")) {
|
| | | // ONLINE OFFLINE HIKVISION DS-7716N-E4 NVR的兼容性处理
|
| | | if (status.equals("ON") || status.equals("On") || status.equals("ONLINE")) {
|
| | | deviceChannel.setStatus(1);
|
| | | }
|
| | | if (status.equals("OFF") || status.equals("Off")) {
|
| | | if (status.equals("OFF") || status.equals("Off") || status.equals("OFFLINE")) {
|
| | | deviceChannel.setStatus(0);
|
| | | }
|
| | |
|
| | |
| | | device.setStreamMode("UDP");
|
| | | }
|
| | | storager.updateDevice(device);
|
| | | cmder.catalogQuery(device);
|
| | | cmder.catalogQuery(device, null);
|
| | | // 回复200 OK
|
| | | responseAck(evt);
|
| | | if (offLineDetector.isOnline(deviceId)) {
|
| | |
| | | try {
|
| | | Element rootElement = getRootElement(evt);
|
| | | String deviceId = XmlUtil.getText(rootElement, "DeviceID");
|
| | | // 回复200 OK
|
| | | responseAck(evt);
|
| | | if (offLineDetector.isOnline(deviceId)) {
|
| | | publisher.onlineEventPublish(deviceId, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE);
|
| | | } else {
|
| | | // 检查设备是否存在, 不存在则不回复
|
| | | if (storager.exists(deviceId)) {
|
| | | // 回复200 OK
|
| | | responseAck(evt);
|
| | | if (offLineDetector.isOnline(deviceId)) {
|
| | | publisher.onlineEventPublish(deviceId, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE);
|
| | | } else {
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (ParseException | SipException | InvalidArgumentException | DocumentException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | String NotifyType =XmlUtil.getText(rootElement, "NotifyType");
|
| | | if (NotifyType.equals("121")){
|
| | | logger.info("媒体播放完毕,通知关流");
|
| | | StreamInfo streamInfo = storager.queryPlaybackByDevice(deviceId, "*");
|
| | | StreamInfo streamInfo = redisCatchStorage.queryPlaybackByDevice(deviceId, "*");
|
| | | if (streamInfo != null) {
|
| | | storager.stopPlayback(streamInfo);
|
| | | cmder.streamByeCmd(streamInfo.getSsrc());
|
| | | redisCatchStorage.stopPlayback(streamInfo);
|
| | | cmder.streamByeCmd(streamInfo.getStreamId());
|
| | | }
|
| | | }
|
| | | } catch (ParseException | SipException | InvalidArgumentException | DocumentException e) {
|
| | |
| | | this.offLineDetector = offLineDetector;
|
| | | }
|
| | |
|
| | | public IRedisCatchStorage getRedisCatchStorage() {
|
| | | return redisCatchStorage;
|
| | | }
|
| | |
|
| | | public void setRedisCatchStorage(IRedisCatchStorage redisCatchStorage) {
|
| | | this.redisCatchStorage = redisCatchStorage;
|
| | | }
|
| | | }
|