|
@@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.genersoft.iot.vmp.common.HfyAiInfo;
|
|
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
|
|
+import com.genersoft.iot.vmp.conf.DynamicTask;
|
|
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
|
|
import com.genersoft.iot.vmp.conf.UserSetting;
|
|
|
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
|
@@ -12,9 +13,11 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager;
|
|
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
|
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander;
|
|
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderProvider;
|
|
|
+import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.TestInviteRequestProcessor;
|
|
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
|
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory;
|
|
|
import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange;
|
|
|
+
|
|
|
import com.genersoft.iot.vmp.utils.DateUtil;
|
|
|
import com.genersoft.iot.vmp.gb28181.utils.NumericUtil;
|
|
|
import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe;
|
|
@@ -86,6 +89,13 @@ public class SIPCommander implements ISIPCommander {
|
|
|
@Autowired
|
|
|
private IMediaServerService mediaServerService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private DynamicTask dynamicTask;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TestInviteRequestProcessor testInviteRequestProcessor;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 云台方向放控制,使用配置文件中的默认镜头移动速度
|
|
@@ -511,14 +521,8 @@ public class SIPCommander implements ISIPCommander {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void sendBoradcastInviteCmd(ServerTransaction serverTransaction,MediaServerItem mediaServerItem,SSRCInfo ssrcInfo,Device device,
|
|
|
- String startTime, String endTime,
|
|
|
- InviteStreamCallback inviteStreamCallback,
|
|
|
- SipSubscribe.Event okEvent,
|
|
|
- SipSubscribe.Event errorEvent)throws
|
|
|
- InvalidArgumentException, SipException, ParseException{
|
|
|
+ public String createBroadcastInviteSdp(MediaServerItem mediaServerItem,SSRCInfo ssrcInfo){
|
|
|
logger.info("{} 语音对讲拉语音流的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort());
|
|
|
- int testPort = 31234;
|
|
|
// 创建sdp
|
|
|
StringBuffer content = new StringBuffer(200);
|
|
|
content.append("v=0\r\n");
|
|
@@ -532,8 +536,19 @@ public class SIPCommander implements ISIPCommander {
|
|
|
content.append("a=setup:passive\r\n");
|
|
|
content.append("y=" + ssrcInfo.getSsrc() + "\r\n");//ssrc
|
|
|
content.append("f=v/////a/1/8/1\r\n");//f 参数?
|
|
|
+// String _ssrc = ssrcInfo.getSsrc();
|
|
|
+ return content.toString();
|
|
|
+ }
|
|
|
+ public void sendBoradcastInviteCmd(ServerTransaction serverTransaction,MediaServerItem mediaServerItem,SSRCInfo ssrcInfo,Device device,
|
|
|
+ String startTime, String endTime,
|
|
|
+ InviteStreamCallback inviteStreamCallback,
|
|
|
+ SipSubscribe.Event okEvent,
|
|
|
+ SipSubscribe.Event errorEvent)throws
|
|
|
+ InvalidArgumentException, SipException, ParseException{
|
|
|
+ String sdpContent = createBroadcastInviteSdp(mediaServerItem,ssrcInfo);
|
|
|
String _ssrc = ssrcInfo.getSsrc();
|
|
|
// 使用 返回sdp ack 数据给设备
|
|
|
+ logger.info("返回给设备的 audio invite sdp部分为{}",sdpContent);
|
|
|
try {
|
|
|
CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId()
|
|
|
: udpSipProvider.getNewCallId();
|
|
@@ -548,11 +563,17 @@ public class SIPCommander implements ISIPCommander {
|
|
|
// logger.error("[命令发送失败] 语音广播 发送BYE: {}", e.getMessage());
|
|
|
// }
|
|
|
}, 60 * 1000);
|
|
|
- responseSdpACK(serverTransaction,
|
|
|
- content.toString(),
|
|
|
- device.getDeviceId(),
|
|
|
- device.getHostAddress(),
|
|
|
- device.getPort()
|
|
|
+// testInviteRequestProcessor.responseBroadcastSdpACK(serverTransaction,
|
|
|
+// sdpContent,
|
|
|
+// device.getDeviceId(),
|
|
|
+// device.getHostAddress(),
|
|
|
+// device.getPort()
|
|
|
+// );
|
|
|
+ testInviteRequestProcessor.responseBroadcastSdpACK(serverTransaction,
|
|
|
+ sdpContent,
|
|
|
+ sipConfig.getId(),
|
|
|
+ mediaServerItem.getSdpIp(),
|
|
|
+ sipConfig.getPort()
|
|
|
);
|
|
|
}catch(SipException e){
|
|
|
logger.warn("下发audio invite 失败");
|
|
@@ -560,21 +581,23 @@ public class SIPCommander implements ISIPCommander {
|
|
|
|
|
|
|
|
|
|
|
|
- logger.info("下发audio invite 为{}",content.toString());
|
|
|
// todo 订阅audio推流流变化
|
|
|
- Request request = headerProvider.createPlaybackInviteRequest(device,null, content.toString(), null, SipUtils.getNewFromTag(), null, callIdHeader, ssrcInfo.getSsrc());
|
|
|
- transmitRequest(device.getTransport(), request, (e)->{
|
|
|
- logger.warn("下发audio invite 失败");
|
|
|
- }, event -> {
|
|
|
- ResponseEvent responseEvent = (ResponseEvent) event.event;
|
|
|
- SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
|
|
- streamSession.put(device.getDeviceId(), null, callIdHeader.getCallId(), ssrcInfo.getStream(), ssrcInfo.getSsrc(), mediaServerItem.getId(), response, VideoStreamSessionManager.SessionType.playback);
|
|
|
- okEvent.response(event);
|
|
|
- });
|
|
|
+// Request request = headerProvider.createPlaybackInviteRequest(device,null, content.toString(), null, SipUtils.getNewFromTag(), null, callIdHeader, ssrcInfo.getSsrc());
|
|
|
+// transmitRequest(device.getTransport(), request, (e)->{
|
|
|
+// logger.warn("下发audio invite 失败");
|
|
|
+// }, event -> {
|
|
|
+// ResponseEvent responseEvent = (ResponseEvent) event.event;
|
|
|
+// SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
|
|
+// streamSession.put(device.getDeviceId(), null, callIdHeader.getCallId(), ssrcInfo.getStream(), ssrcInfo.getSsrc(), mediaServerItem.getId(), response, VideoStreamSessionManager.SessionType.playback);
|
|
|
+// okEvent.response(event);
|
|
|
+// });
|
|
|
// if (inviteStreamCallback != null) {
|
|
|
// inviteStreamCallback.call(new InviteStreamInfo(mediaServerItem, null, callIdHeader.getCallId(), "rtp", ssrcInfo.getStream()));
|
|
|
// }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 请求历史媒体下载
|
|
|
*
|
|
@@ -737,7 +760,7 @@ public class SIPCommander implements ISIPCommander {
|
|
|
broadcastXml.append("<SN>" + (int) ((Math.random() * 9 + 1) * 100000) + "</SN>\r\n");
|
|
|
|
|
|
// broadcastXml.append("<SourceID>" + sipConfig.getId() + "</SourceID>\r\n");
|
|
|
- broadcastXml.append("<SourceID>" + sipConfig.getId() + "</SourceID>\r\n");
|
|
|
+ broadcastXml.append("<SourceID>" + device.getDeviceId() + "</SourceID>\r\n");
|
|
|
|
|
|
broadcastXml.append("<TargetID>" + device.getDeviceId() + "</TargetID>\r\n");
|
|
|
broadcastXml.append("</Notify>\r\n");
|