From 10e2180c72d0f683cf08a4bc586aa8960b2a6d5c Mon Sep 17 00:00:00 2001
From: leesam <leesam@leesam.cn>
Date: 星期三, 10 四月 2024 19:07:37 +0800
Subject: [PATCH] [bugfix]支持context-path配置
---
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java | 48 ++++++++++++++++++++++++------------------------
1 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java
old mode 100644
new mode 100755
index 56fb789..c910451
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/BroadcastResponseMessageHandler.java
@@ -1,17 +1,15 @@
package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd;
-import com.alibaba.fastjson2.JSONObject;
+import com.genersoft.iot.vmp.conf.DynamicTask;
import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatch;
import com.genersoft.iot.vmp.gb28181.bean.AudioBroadcastCatchStatus;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
-import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
-import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler;
-import com.genersoft.iot.vmp.gb28181.utils.XmlUtil;
+import com.genersoft.iot.vmp.service.IPlayService;
import gov.nist.javax.sip.message.SIPRequest;
import org.dom4j.Element;
import org.slf4j.Logger;
@@ -38,10 +36,13 @@
private ResponseMessageHandler responseMessageHandler;
@Autowired
- private DeferredResultHolder deferredResultHolder;
+ private DynamicTask dynamicTask;
@Autowired
private AudioBroadcastManager audioBroadcastManager;
+
+ @Autowired
+ private IPlayService playService;
@Override
public void afterPropertiesSet() throws Exception {
@@ -50,33 +51,32 @@
@Override
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
+
+ SIPRequest request = (SIPRequest) evt.getRequest();
try {
String channelId = getText(rootElement, "DeviceID");
- String key = DeferredResultHolder.CALLBACK_CMD_BROADCAST + device.getDeviceId() + channelId;
-
- // 姝ゅ鏄鏈钩鍙板彂鍑築roadcast鎸囦护鐨勫簲绛�
- JSONObject json = new JSONObject();
- XmlUtil.node2Json(rootElement, json);
- if (logger.isDebugEnabled()) {
- logger.debug(json.toJSONString());
- }
- RequestMessage msg = new RequestMessage();
- msg.setKey(key);
- msg.setData(json);
- deferredResultHolder.invokeAllResult(msg);
-
-
if (!audioBroadcastManager.exit(device.getDeviceId(), channelId)) {
// 鍥炲410
responseAck((SIPRequest) evt.getRequest(), Response.GONE);
return;
}
- logger.info("鏀跺埌璇煶骞挎挱鐨勫洖澶嶏細{}/{}", device.getDeviceId(), channelId );
- AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(device.getDeviceId(), channelId);
- audioBroadcastCatch.setStatus(AudioBroadcastCatchStatus.WaiteInvite);
- audioBroadcastManager.update(audioBroadcastCatch);
+ String result = getText(rootElement, "Result");
+ Element infoElement = rootElement.element("Info");
+ String reason = null;
+ if (infoElement != null) {
+ reason = getText(infoElement, "Reason");
+ }
+ logger.info("[璇煶骞挎挱]鍥炲锛歿}, {}/{}", reason == null? result : result + ": " + reason, device.getDeviceId(), channelId );
+
// 鍥炲200 OK
- responseAck((SIPRequest) evt.getRequest(), Response.OK);
+ responseAck(request, Response.OK);
+ if (result.equalsIgnoreCase("OK")) {
+ AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(device.getDeviceId(), channelId);
+ audioBroadcastCatch.setStatus(AudioBroadcastCatchStatus.WaiteInvite);
+ audioBroadcastManager.update(audioBroadcastCatch);
+ }else {
+ playService.stopAudioBroadcast(device.getDeviceId(), channelId);
+ }
} catch (ParseException | SipException | InvalidArgumentException e) {
logger.error("[鍛戒护鍙戦�佸け璐 鍥芥爣绾ц仈 璇煶鍠婅瘽: {}", e.getMessage());
}
--
Gitblit v1.8.0