From 0352ad2d639cf52986e0638015084d7f020ec3ca Mon Sep 17 00:00:00 2001
From: 648540858 <648540858@qq.com>
Date: 星期五, 13 十一月 2020 09:50:37 +0800
Subject: [PATCH] Merge pull request #12 from lawrencehj/master
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
index ee142d7..06afc35 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
@@ -34,7 +34,7 @@
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.utils.redis.RedisUtil;
import org.springframework.util.StringUtils;
-
+import com.genersoft.iot.vmp.common.StreamInfo;
/**
* @Description:MESSAGE璇锋眰澶勭悊鍣�
* @author: swwheihei
@@ -64,6 +64,7 @@
private static final String MESSAGE_DEVICE_INFO = "DeviceInfo";
private static final String MESSAGE_ALARM = "Alarm";
private static final String MESSAGE_RECORD_INFO = "RecordInfo";
+ private static final String MESSAGE_MEDIA_STATUS = "MediaStatus";
// private static final String MESSAGE_BROADCAST = "Broadcast";
// private static final String MESSAGE_DEVICE_STATUS = "DeviceStatus";
// private static final String MESSAGE_MOBILE_POSITION = "MobilePosition";
@@ -98,6 +99,11 @@
} else if (MESSAGE_RECORD_INFO.equals(cmd)) {
logger.info("鎺ユ敹鍒癛ecordInfo娑堟伅");
processMessageRecordInfo(evt);
+ }else if (MESSAGE_MEDIA_STATUS.equals(cmd)) {
+ logger.info("鎺ユ敹鍒癕ediaStatus娑堟伅");
+ processMessageMediaStatus(evt);
+ } else {
+ logger.info("鎺ユ敹鍒版秷鎭細" + cmd);
}
} catch (DocumentException e) {
e.printStackTrace();
@@ -399,6 +405,35 @@
}
}
+
+ private void processMessageMediaStatus(RequestEvent evt){
+ try {
+ // 鍥炲200 OK
+ responseAck(evt);
+ Element rootElement = getRootElement(evt);
+ String deviceId = XmlUtil.getText(rootElement, "DeviceID");
+ String NotifyType =XmlUtil.getText(rootElement, "NotifyType");
+ if (NotifyType.equals("121")){
+ logger.info("濯掍綋鎾斁瀹屾瘯锛岄�氱煡鍏虫祦");
+ StreamInfo streamInfo = storager.queryPlaybackByDevice(deviceId, "*");
+ if (streamInfo != null) {
+ storager.stopPlayback(streamInfo);
+ cmder.streamByeCmd(streamInfo.getSsrc());
+ }
+ }
+ } catch (ParseException | SipException | InvalidArgumentException | DocumentException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ /***
+ * 鍥炲200 OK
+ * @param evt
+ * @throws SipException
+ * @throws InvalidArgumentException
+ * @throws ParseException
+ */
private void responseAck(RequestEvent evt) throws SipException, InvalidArgumentException, ParseException {
Response response = getMessageFactory().createResponse(Response.OK, evt.getRequest());
getServerTransaction(evt).sendResponse(response);
--
Gitblit v1.8.0