|
@@ -25,12 +25,7 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
|
@@ -207,12 +202,13 @@ public class PlayController {
|
|
|
|
|
|
@Operation(summary = "语音广播命令")
|
|
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
|
|
- @GetMapping("/broadcast/{deviceId}")
|
|
|
- @PostMapping("/broadcast/{deviceId}")
|
|
|
- public DeferredResult<String> broadcastApi(@PathVariable String deviceId) {
|
|
|
+ @GetMapping("/broadcast")
|
|
|
+// @PostMapping("/broadcast/{deviceId}")
|
|
|
+ public DeferredResult<String> broadcastApi(@RequestParam String deviceId) {
|
|
|
if (logger.isDebugEnabled()) {
|
|
|
logger.debug("语音广播API调用");
|
|
|
}
|
|
|
+
|
|
|
Device device = storager.queryVideoDevice(deviceId);
|
|
|
DeferredResult<String> result = new DeferredResult<>(3 * 1000L);
|
|
|
String key = DeferredResultHolder.CALLBACK_CMD_BROADCAST + deviceId;
|
|
@@ -236,6 +232,7 @@ public class PlayController {
|
|
|
resultHolder.invokeResult(msg);
|
|
|
return result;
|
|
|
}
|
|
|
+ // 发送广播命令
|
|
|
try {
|
|
|
cmder.audioBroadcastCmd(device, (event) -> {
|
|
|
RequestMessage msg = new RequestMessage();
|
|
@@ -249,6 +246,7 @@ public class PlayController {
|
|
|
msg.setData(json);
|
|
|
resultHolder.invokeResult(msg);
|
|
|
});
|
|
|
+ // 收到broadcast回复后,去向zlm申请推流端口
|
|
|
} catch (InvalidArgumentException | SipException | ParseException e) {
|
|
|
logger.error("[命令发送失败] 语音广播: {}", e.getMessage());
|
|
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage());
|