|
@@ -479,6 +479,7 @@ public class PlayController {
|
|
|
@RequestParam("deviceId") String deviceId,
|
|
|
@RequestParam(value = "audioCoded",required = false) String audioCoded
|
|
|
){
|
|
|
+ logger.info("[语音对讲] web端已经开启推流");
|
|
|
RequestMessage msg = new RequestMessage();
|
|
|
// 返回invite信息给设备
|
|
|
String key = DeferredResultHolder.CALLBACK_CMD_BROADCAST_INVITE + deviceId;
|
|
@@ -487,6 +488,7 @@ public class PlayController {
|
|
|
msg.setId(uuid);
|
|
|
DeferredResult<WVPResult<String>> result = new DeferredResult<>(10*1000l);
|
|
|
WVPResult wvpResult = new WVPResult();
|
|
|
+ Map<String, Object> resultData = new HashMap<>(16);
|
|
|
resultHolder.put(key, uuid, result);
|
|
|
|
|
|
|
|
@@ -525,6 +527,31 @@ public class PlayController {
|
|
|
5000,
|
|
|
(int code, JSONObject json, SIPRequest request)->{
|
|
|
// todo 处理并返回语音广播请求,应该有一个ack
|
|
|
+ if(code == 1){
|
|
|
+ logger.warn("等待设备ack超时");
|
|
|
+ wvpResult.setCode(ErrorCode.ERR_TIMEOUT.getCode());
|
|
|
+ wvpResult.setMsg(ErrorCode.ERR_TIMEOUT.getMsg());
|
|
|
+ } else if (code == 2) {
|
|
|
+ wvpResult.setCode(ErrorCode.ERROR100.getCode());
|
|
|
+ wvpResult.setMsg((String) json.get("msg"));
|
|
|
+ } else if (code == 0) {
|
|
|
+ logger.info("收到设备invite信息: {}",json);
|
|
|
+ // 获取id
|
|
|
+ resultData.put("mediaId",mediaServerItem.getId());
|
|
|
+// resultData.put("app",app);
|
|
|
+// resultData.put("stream",stream);
|
|
|
+// resultData.put("type",type);
|
|
|
+// resultData.put("sign",sign);
|
|
|
+// resultData.put("webRtcPushUrl", webRtcPushUrl);
|
|
|
+// resultData.put("audioFormats",json.get("audioFormats"));
|
|
|
+// logger.info("获取webrtc推流地址:{}",webRtcPushUrl);
|
|
|
+
|
|
|
+ wvpResult.setCode(ErrorCode.SUCCESS.getCode());
|
|
|
+ wvpResult.setMsg(ErrorCode.SUCCESS.getMsg());
|
|
|
+ wvpResult.setData(resultData);
|
|
|
+ }
|
|
|
+ msg.setData(wvpResult);
|
|
|
+ resultHolder.invokeAllResult(msg);
|
|
|
}
|
|
|
);
|
|
|
}
|