修复国标录像下载
This commit is contained in:
@@ -456,7 +456,7 @@ public class SIPCommander implements ISIPCommander {
|
||||
String startTime, String endTime, int downloadSpeed,
|
||||
SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
||||
|
||||
log.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getSdpIp(), ssrcInfo.getPort());
|
||||
log.info("[发送-请求历史媒体下载-命令] 流ID: {},节点为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getSdpIp(), ssrcInfo.getPort());
|
||||
String sdpIp;
|
||||
if (!ObjectUtils.isEmpty(device.getSdpIp())) {
|
||||
sdpIp = device.getSdpIp();
|
||||
@@ -524,27 +524,8 @@ public class SIPCommander implements ISIPCommander {
|
||||
|
||||
content.append("y=" + ssrcInfo.getSsrc() + "\r\n");//ssrc
|
||||
log.debug("此时请求下载信令的ssrc===>{}",ssrcInfo.getSsrc());
|
||||
Hook rtpHook = Hook.getInstance(HookType.on_media_arrival, "rtp", ssrcInfo.getStream(), mediaServerItem.getId());
|
||||
// 添加订阅
|
||||
CallIdHeader newCallIdHeader = sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()), device.getTransport());
|
||||
String callId= newCallIdHeader.getCallId();
|
||||
subscribe.addSubscribe(rtpHook, (hookData) -> {
|
||||
log.debug("sipc 添加订阅===callId {}",callId);
|
||||
subscribe.removeSubscribe(rtpHook);
|
||||
// 添加流注销的订阅,注销了后向设备发送bye
|
||||
Hook departureHook = Hook.getInstance(HookType.on_media_departure, "rtp", ssrcInfo.getStream(), mediaServerItem.getId());
|
||||
subscribe.addSubscribe(departureHook,
|
||||
(departureHookData) -> {
|
||||
log.info("[录像]下载结束, 发送BYE");
|
||||
try {
|
||||
streamByeCmd(device, channel.getDeviceId(), ssrcInfo.getStream(), callId);
|
||||
} catch (InvalidArgumentException | ParseException | SipException |
|
||||
SsrcTransactionNotFoundException e) {
|
||||
log.error("[录像]下载结束, 发送BYE失败 {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Request request = headerProvider.createPlaybackInviteRequest(device, channel.getDeviceId(), content.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null,newCallIdHeader, ssrcInfo.getSsrc());
|
||||
|
||||
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, errorEvent, event -> {
|
||||
@@ -653,9 +634,6 @@ public class SIPCommander implements ISIPCommander {
|
||||
}
|
||||
|
||||
log.info("[发送BYE] 设备: device: {}, channel: {}, callId: {}", device.getDeviceId(), channelId, ssrcTransaction.getCallId());
|
||||
mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
|
||||
|
||||
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
|
||||
sessionManager.removeByCallId(ssrcTransaction.getCallId());
|
||||
Request byteRequest = headerProvider.createByteRequest(device, channelId, ssrcTransaction.getSipTransactionInfo());
|
||||
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), byteRequest, null, okEvent);
|
||||
|
||||
@@ -85,7 +85,6 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
|
||||
@Override
|
||||
public void handForDevice(RequestEvent evt, Device device, Element rootElement) {
|
||||
log.info("[收到报警通知]设备:{}", device.getDeviceId());
|
||||
boolean isEmpty = taskQueue.isEmpty();
|
||||
taskQueue.offer(new SipMsgInfo(evt, device, rootElement));
|
||||
// 回复200 OK
|
||||
@@ -96,7 +95,9 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
}
|
||||
if (isEmpty) {
|
||||
taskExecutor.execute(() -> {
|
||||
log.info("[处理报警通知]待处理数量:{}", taskQueue.size() );
|
||||
if (log.isDebugEnabled()) {
|
||||
log.info("[处理报警通知]待处理数量:{}", taskQueue.size() );
|
||||
}
|
||||
while (!taskQueue.isEmpty()) {
|
||||
try {
|
||||
SipMsgInfo sipMsgInfo = taskQueue.poll();
|
||||
@@ -161,7 +162,9 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme
|
||||
deviceAlarm.setAlarmType(getText(sipMsgInfo.getRootElement().element("Info"), "AlarmType"));
|
||||
}
|
||||
}
|
||||
log.info("[收到报警通知]内容:{}", JSON.toJSONString(deviceAlarm));
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("[收到报警通知]设备:{}, 内容:{}", device.getDeviceId(), JSON.toJSONString(deviceAlarm));
|
||||
}
|
||||
// 作者自用判断,其他小伙伴需要此消息可以自行修改,但是不要提在pr里
|
||||
if (DeviceAlarmMethod.Other.getVal() == Integer.parseInt(deviceAlarm.getAlarmMethod())) {
|
||||
// 发送给平台的报警信息。 发送redis通知
|
||||
|
||||
Reference in New Issue
Block a user