diff --git a/doc/_content/introduction/config.md b/doc/_content/introduction/config.md
index 9e8ac0f6..ad88140e 100644
--- a/doc/_content/introduction/config.md
+++ b/doc/_content/introduction/config.md
@@ -160,4 +160,4 @@ user-settings:
如果配置信息无误,你可以启动zlm,再启动wvp来测试了,启动成功的话,你可以在wvp的日志下看到zlm已连接的提示。
-接下来[部署到服务器](./_content/introduction/deployment.md), 如何你只是本地运行直接再本地运行即可。
+接下来[部署到服务器](./_content/introduction/deployment.md), 如果你只是本地运行直接在本地运行即可。
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java b/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
index 041d7388..873feab5 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
@@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.conf;
+import org.apache.commons.lang3.ObjectUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
@@ -45,6 +46,9 @@ public class DynamicTask {
* @return
*/
public void startCron(String key, Runnable task, int cycleForCatalog) {
+ if(ObjectUtils.isEmpty(key)) {
+ return;
+ }
ScheduledFuture> future = futureMap.get(key);
if (future != null) {
if (future.isCancelled()) {
@@ -73,6 +77,9 @@ public class DynamicTask {
* @return
*/
public void startDelay(String key, Runnable task, int delay) {
+ if(ObjectUtils.isEmpty(key)) {
+ return;
+ }
stop(key);
// 获取执行的时刻
@@ -99,9 +106,12 @@ public class DynamicTask {
}
public boolean stop(String key) {
+ if(ObjectUtils.isEmpty(key)) {
+ return false;
+ }
boolean result = false;
- if (futureMap.get(key) != null && !futureMap.get(key).isCancelled() && !futureMap.get(key).isDone()) {
- result = futureMap.get(key).cancel(false);
+ if (!ObjectUtils.isEmpty(futureMap.get(key)) && !futureMap.get(key).isCancelled() && !futureMap.get(key).isDone()) {
+ result = futureMap.get(key).cancel(true);
futureMap.remove(key);
runnableMap.remove(key);
}
@@ -109,6 +119,9 @@ public class DynamicTask {
}
public boolean contains(String key) {
+ if(ObjectUtils.isEmpty(key)) {
+ return false;
+ }
return futureMap.get(key) != null;
}
@@ -117,6 +130,9 @@ public class DynamicTask {
}
public Runnable get(String key) {
+ if(ObjectUtils.isEmpty(key)) {
+ return null;
+ }
return runnableMap.get(key);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
index 562c8640..0993d74a 100644
--- a/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
+++ b/src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
@@ -43,8 +43,6 @@ public class UserSetting {
private Boolean pushAuthority = Boolean.TRUE;
- private Boolean gbSendStreamStrict = Boolean.FALSE;
-
private Boolean syncChannelOnDeviceOnline = Boolean.FALSE;
private Boolean sipLog = Boolean.FALSE;
@@ -208,14 +206,6 @@ public class UserSetting {
this.pushAuthority = pushAuthority;
}
- public Boolean getGbSendStreamStrict() {
- return gbSendStreamStrict;
- }
-
- public void setGbSendStreamStrict(Boolean gbSendStreamStrict) {
- this.gbSendStreamStrict = gbSendStreamStrict;
- }
-
public Boolean getSyncChannelOnDeviceOnline() {
return syncChannelOnDeviceOnline;
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
index 541c111f..9bfab634 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
@@ -165,7 +165,7 @@ public class Device {
* 是否开启ssrc校验,默认关闭,开启可以防止串流
*/
@Schema(description = "是否开启ssrc校验,默认关闭,开启可以防止串流")
- private boolean ssrcCheck = true;
+ private boolean ssrcCheck = false;
/**
* 地理坐标系, 目前支持 WGS84,GCJ02
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
index d7dbe94f..80ea8909 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
@@ -333,7 +333,7 @@ public interface ISIPCommander {
* @param endTime 报警发生终止时间(可选)
* @return true = 命令发送成功
*/
- void alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) throws InvalidArgumentException, SipException, ParseException;
+ void alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String startTime, String endTime) throws InvalidArgumentException, SipException, ParseException;
/**
* 订阅、取消订阅目录信息
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
index 3ea5378a..9d8ce364 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/SIPRequestHeaderPlarformProvider.java
@@ -167,6 +167,7 @@ public class SIPRequestHeaderPlarformProvider {
public Request createMessageRequest(ParentPlatform parentPlatform, String content, SendRtpItem sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException {
CallIdHeader callIdHeader = SipFactory.getInstance().createHeaderFactory().createCallIdHeader(sendRtpItem.getCallId());
+ callIdHeader.setCallId(sendRtpItem.getCallId());
return createMessageRequest(parentPlatform, content, sendRtpItem.getToTag(), SipUtils.getNewViaTag(), sendRtpItem.getFromTag(), callIdHeader);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
index c1e72cd4..28d68013 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
@@ -1275,7 +1275,7 @@ public class SIPCommander implements ISIPCommander {
* @return true = 命令发送成功
*/
@Override
- public void alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String alarmType, String startTime, String endTime) throws InvalidArgumentException, SipException, ParseException {
+ public void alarmSubscribe(Device device, int expires, String startPriority, String endPriority, String alarmMethod, String startTime, String endTime) throws InvalidArgumentException, SipException, ParseException {
StringBuffer cmdXml = new StringBuffer(200);
String charset = device.getCharset();
@@ -1293,9 +1293,6 @@ public class SIPCommander implements ISIPCommander {
if (!ObjectUtils.isEmpty(alarmMethod)) {
cmdXml.append("" + alarmMethod + "\r\n");
}
- if (!ObjectUtils.isEmpty(alarmType)) {
- cmdXml.append("" + alarmType + "\r\n");
- }
if (!ObjectUtils.isEmpty(startTime)) {
cmdXml.append("" + startTime + "\r\n");
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
index 7dd23127..ab770c1f 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
@@ -98,15 +98,20 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In
logger.warn("[收到ACK]:未找到来自{},目标为({})的推流信息",fromUserId, toUserId);
return;
}
- // tcp主动时,此时是级联下级平台,在回复200ok时,本地已经请求zlm开启监听,跳过下面步骤
- if (sendRtpItem.isTcpActive()) {
- return;
- }
- logger.info("[收到ACK]:rtp/{}开始级推流, 目标={}:{},SSRC={}, RTCP={}", sendRtpItem.getStream(),
- sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isRtcp());
- // 取消设置的超时任务
- dynamicTask.stop(callIdHeader.getCallId());
+ // tcp主动时,此时是级联下级平台,在回复200ok时,本地已经请求zlm开启监听,跳过下面步骤
+ if (sendRtpItem.isTcpActive()) {
+ logger.info("收到ACK,rtp/{} TCP主动方式后续处理", sendRtpItem.getStreamId());
+ return;
+ }
+ String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId());
+ logger.info("收到ACK,rtp/{}开始向上级推流, 目标={}:{},SSRC={}, 协议:{}",
+ sendRtpItem.getStream(),
+ sendRtpItem.getIp(),
+ sendRtpItem.getPort(),
+ sendRtpItem.getSsrc(),
+ sendRtpItem.isTcp()?(sendRtpItem.isTcpActive()?"TCP主动":"TCP被动"):"UDP"
+ );
ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(fromUserId);
if (parentPlatform != null) {
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
index 7ae07a72..f999cf2c 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
@@ -148,7 +148,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
logger.info("[收到bye] {} 通知设备停止推流时未找到设备信息", streamId);
}
try {
- logger.warn("[停止点播] {}/{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
+ logger.info("[停止点播] {}/{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId());
cmder.streamByeCmd(device, sendRtpItem.getChannelId(), streamId, null);
} catch (InvalidArgumentException | ParseException | SipException |
SsrcTransactionNotFoundException e) {
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
index 1f71ee0a..ff855de7 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
@@ -469,8 +469,10 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
sendRtpItem.setApp("rtp");
if ("Playback".equalsIgnoreCase(sessionName)) {
sendRtpItem.setPlayType(InviteStreamType.PLAYBACK);
- SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam());
- sendRtpItem.setStream(ssrcInfo.getStream());
+ String startTimeStr = DateUtil.urlFormatter.format(start);
+ String endTimeStr = DateUtil.urlFormatter.format(end);
+ String stream = device.getDeviceId() + "_" + channelId + "_" + startTimeStr + "_" + endTimeStr;
+ SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null, device.isSsrcCheck(), true, 0, false, device.getStreamModeForParam());
// 写入redis, 超时时回复
redisCatchStorage.updateSendRTPSever(sendRtpItem);
playService.playBack(mediaServerItem, ssrcInfo, device.getDeviceId(), channelId, DateUtil.formatter.format(start),
@@ -530,12 +532,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}
}));
sendRtpItem.setPlayType(InviteStreamType.PLAY);
- String streamId = null;
- if (mediaServerItem.isRtpEnable()) {
- streamId = String.format("%s_%s", device.getDeviceId(), channelId);
- }else {
- streamId = String.format("%08x", Integer.parseInt(ssrcInfo.getSsrc())).toUpperCase();
- }
+ String streamId = String.format("%s_%s", device.getDeviceId(), channelId);
sendRtpItem.setStream(streamId);
sendRtpItem.setSsrc(ssrcInfo.getSsrc());
redisCatchStorage.updateSendRTPSever(sendRtpItem);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
index 5c577ba6..7b9f69a3 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
@@ -33,7 +33,7 @@ import java.text.ParseException;
public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler {
- private Logger logger = LoggerFactory.getLogger(KeepaliveNotifyMessageHandler.class);
+ private final Logger logger = LoggerFactory.getLogger(KeepaliveNotifyMessageHandler.class);
private final static String cmdType = "Keepalive";
@Autowired
@@ -59,14 +59,19 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
// 未注册的设备不做处理
return;
}
- logger.info("[收到心跳], device: {}", device.getDeviceId());
SIPRequest request = (SIPRequest) evt.getRequest();
+ logger.info("[收到心跳], device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
+
// 回复200 OK
try {
responseAck(request, Response.OK);
} catch (SipException | InvalidArgumentException | ParseException e) {
logger.error("[命令发送失败] 心跳回复: {}", e.getMessage());
}
+ if (DateUtil.getDifferenceForNow(device.getKeepaliveTime()) <= 3000L){
+ logger.info("[收到心跳] 心跳发送过于频繁,已忽略 device: {}, callId: {}", device.getDeviceId(), request.getCallIdHeader().getCallId());
+ return;
+ }
RemoteAddressInfo remoteAddressInfo = SipUtils.getRemoteAddressFromRequest(request, userSetting.getSipUseSourceIpAsRemoteAddress());
if (!device.getIp().equalsIgnoreCase(remoteAddressInfo.getIp()) || device.getPort() != remoteAddressInfo.getPort()) {
@@ -80,7 +85,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp
}else {
long lastTime = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(device.getKeepaliveTime());
if (System.currentTimeMillis()/1000-lastTime > 10) {
- device.setKeepaliveIntervalTime(new Long(System.currentTimeMillis()/1000-lastTime).intValue());
+ device.setKeepaliveIntervalTime(Long.valueOf(System.currentTimeMillis()/1000-lastTime).intValue());
}
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java
index fbc1ee9e..c6460588 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/utils/SipUtils.java
@@ -281,6 +281,6 @@ public class SipUtils {
return null;
}
}
- return localDateTime.format(DateUtil.formatterISO8601);
+ return localDateTime.format(DateUtil.formatter);
}
}
\ No newline at end of file
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
index c31c8b39..63a54dd4 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -200,7 +200,10 @@ public class ZLMHttpHookListener {
String mediaServerId = json.getString("mediaServerId");
MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId);
-
+ if (mediaInfo == null) {
+ return new HookResultForOnPublish(200, "success");
+ }
+ // 推流鉴权的处理
if (!"rtp".equals(param.getApp())) {
if (userSetting.getPushAuthority()) {
// 推流鉴权
@@ -252,11 +255,21 @@ public class ZLMHttpHookListener {
}
});
+ // 是否录像
if ("rtp".equals(param.getApp())) {
result.setEnable_mp4(userSetting.getRecordSip());
} else {
result.setEnable_mp4(userSetting.isRecordPushLive());
}
+ // 替换流地址
+ if ("rtp".equals(param.getApp()) && !mediaInfo.isRtpEnable()) {
+ String ssrc = String.format("%010d", Long.parseLong(param.getStream(), 16));;
+ InviteInfo inviteInfo = inviteStreamService.getInviteInfoBySSRC(ssrc);
+ if (inviteInfo != null) {
+ result.setStream_replace(inviteInfo.getStream());
+ logger.info("[ZLM HOOK]推流鉴权 stream: {} 替换为 {}", param.getStream(), inviteInfo.getStream());
+ }
+ }
List ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, param.getStream());
if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) {
String deviceId = ssrcTransactionForAll.get(0).getDeviceId();
@@ -569,6 +582,7 @@ public class ZLMHttpHookListener {
Device device = deviceService.getDevice(inviteInfo.getDeviceId());
if (device != null) {
try {
+ // 多查询一次防止已经被处理了
InviteInfo info = inviteStreamService.getInviteInfo(inviteInfo.getType(),
inviteInfo.getDeviceId(), inviteInfo.getChannelId(), inviteInfo.getStream());
if (info != null) {
@@ -643,7 +657,7 @@ public class ZLMHttpHookListener {
if ("rtp".equals(param.getApp())) {
String[] s = param.getStream().split("_");
- if (!mediaInfo.isRtpEnable() || (s.length != 2 && s.length != 4)) {
+ if ((s.length != 2 && s.length != 4)) {
defaultResult.setResult(HookResult.SUCCESS());
return defaultResult;
}
@@ -672,7 +686,6 @@ public class ZLMHttpHookListener {
result.onTimeout(() -> {
logger.info("[ZLM HOOK] 预览流自动点播, 等待超时");
- // 释放rtpserver
msg.setData(new HookResult(ErrorCode.ERROR100.getCode(), "点播超时"));
resultHolder.invokeResult(msg);
});
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java
index 81cae37c..72fed079 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerFactory.java
@@ -168,13 +168,9 @@ public class ZLMServerFactory {
public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId,
String deviceId, String channelId, boolean tcp, boolean rtcp){
- // 默认为随机端口
- int localPort = 0;
- if (userSetting.getGbSendStreamStrict()) {
- localPort = sendRtpPortManager.getNextPort(serverItem);
- if (localPort == 0) {
- return null;
- }
+ int localPort = sendRtpPortManager.getNextPort(serverItem);
+ if (localPort == 0) {
+ return null;
}
SendRtpItem sendRtpItem = new SendRtpItem();
sendRtpItem.setIp(ip);
@@ -204,13 +200,10 @@ public class ZLMServerFactory {
*/
public SendRtpItem createSendRtpItem(MediaServerItem serverItem, String ip, int port, String ssrc, String platformId,
String app, String stream, String channelId, boolean tcp, boolean rtcp){
- // 默认为随机端口
- int localPort = 0;
- if (userSetting.getGbSendStreamStrict()) {
- localPort = sendRtpPortManager.getNextPort(serverItem);
- if (localPort == 0) {
- return null;
- }
+
+ int localPort = sendRtpPortManager.getNextPort(serverItem);
+ if (localPort == 0) {
+ return null;
}
SendRtpItem sendRtpItem = new SendRtpItem();
sendRtpItem.setIp(ip);
diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java
index 68d969f4..12d83627 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/dto/hook/HookResultForOnPublish.java
@@ -6,6 +6,7 @@ public class HookResultForOnPublish extends HookResult{
private boolean enable_mp4;
private int mp4_max_second;
private String mp4_save_path;
+ private String stream_replace;
public HookResultForOnPublish() {
}
@@ -51,12 +52,21 @@ public class HookResultForOnPublish extends HookResult{
this.mp4_save_path = mp4_save_path;
}
+ public String getStream_replace() {
+ return stream_replace;
+ }
+
+ public void setStream_replace(String stream_replace) {
+ this.stream_replace = stream_replace;
+ }
+
@Override
public String toString() {
return "HookResultForOnPublish{" +
"enable_audio=" + enable_audio +
", enable_mp4=" + enable_mp4 +
", mp4_max_second=" + mp4_max_second +
+ ", stream_replace=" + stream_replace +
", mp4_save_path='" + mp4_save_path + '\'' +
'}';
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java b/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java
index ae30f26e..c06400dc 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/IInviteStreamService.java
@@ -74,5 +74,13 @@ public interface IInviteStreamService {
int getStreamInfoCount(String mediaServerId);
+ /**
+ * 获取MediaServer下的流信息
+ */
+ InviteInfo getInviteInfoBySSRC(String ssrc);
+ /**
+ * 更新ssrc
+ */
+ InviteInfo updateInviteInfoForSSRC(InviteInfo inviteInfo, String ssrcInResponse);
}
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
index 0fa3aa61..5192d1d0 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
@@ -190,6 +190,17 @@ public class DeviceServiceImpl implements IDeviceService {
redisCatchStorage.sendDeviceOrChannelStatus(device.getDeviceId(), null, true);
}
+//
+// try {
+// cmder.alarmSubscribe(device, 600, "0", "4", "0", "2023-7-27T00:00:00", "2023-7-28T00:00:00");
+// } catch (InvalidArgumentException e) {
+// throw new RuntimeException(e);
+// } catch (SipException e) {
+// throw new RuntimeException(e);
+// } catch (ParseException e) {
+// throw new RuntimeException(e);
+// }
+
}
@Override
diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java
index f4128163..d630a2c0 100644
--- a/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java
+++ b/src/main/java/com/genersoft/iot/vmp/service/impl/InviteStreamServiceImpl.java
@@ -77,10 +77,11 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
}
String key = VideoManagerConstants.INVITE_PREFIX +
- "_" + inviteInfoForUpdate.getType() +
- "_" + inviteInfoForUpdate.getDeviceId() +
- "_" + inviteInfoForUpdate.getChannelId() +
- "_" + inviteInfoForUpdate.getStream();
+ ":" + inviteInfoForUpdate.getType() +
+ ":" + inviteInfoForUpdate.getDeviceId() +
+ ":" + inviteInfoForUpdate.getChannelId() +
+ ":" + inviteInfoForUpdate.getStream()+
+ ":" + inviteInfoForUpdate.getSsrcInfo().getSsrc();
redisTemplate.opsForValue().set(key, inviteInfoForUpdate);
}
@@ -93,11 +94,15 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
}
removeInviteInfo(inviteInfoInDb);
String key = VideoManagerConstants.INVITE_PREFIX +
- "_" + inviteInfo.getType() +
- "_" + inviteInfo.getDeviceId() +
- "_" + inviteInfo.getChannelId() +
- "_" + stream;
+ ":" + inviteInfo.getType() +
+ ":" + inviteInfo.getDeviceId() +
+ ":" + inviteInfo.getChannelId() +
+ ":" + stream +
+ ":" + inviteInfo.getSsrcInfo().getSsrc();
inviteInfoInDb.setStream(stream);
+ if (inviteInfoInDb.getSsrcInfo() != null) {
+ inviteInfoInDb.getSsrcInfo().setStream(stream);
+ }
redisTemplate.opsForValue().set(key, inviteInfoInDb);
return inviteInfoInDb;
}
@@ -105,10 +110,11 @@ public class InviteStreamServiceImpl implements IInviteStreamService {
@Override
public InviteInfo getInviteInfo(InviteSessionType type, String deviceId, String channelId, String stream) {
String key = VideoManagerConstants.INVITE_PREFIX +
- "_" + (type != null ? type : "*") +
- "_" + (deviceId != null ? deviceId : "*") +
- "_" + (channelId != null ? channelId : "*") +
- "_" + (stream != null ? stream : "*");
+ ":" + (type != null ? type : "*") +
+ ":" + (deviceId != null ? deviceId : "*") +
+ ":" + (channelId != null ? channelId : "*") +
+ ":" + (stream != null ? stream : "*")
+ + ":*";
List