修复语音对讲后停止点播失败的BUG
parent
3fe131eed3
commit
ea12e3465f
|
@ -27,6 +27,11 @@ public class SsrcTransaction {
|
||||||
*/
|
*/
|
||||||
private String callId;
|
private String callId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联的流应用名
|
||||||
|
*/
|
||||||
|
private String app;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联的流ID
|
* 关联的流ID
|
||||||
*/
|
*/
|
||||||
|
@ -52,12 +57,13 @@ public class SsrcTransaction {
|
||||||
*/
|
*/
|
||||||
private InviteSessionType type;
|
private InviteSessionType type;
|
||||||
|
|
||||||
public static SsrcTransaction buildForDevice(String deviceId, Integer channelId, String callId, String stream,
|
public static SsrcTransaction buildForDevice(String deviceId, Integer channelId, String callId, String app, String stream,
|
||||||
String ssrc, String mediaServerId, SIPResponse response, InviteSessionType type) {
|
String ssrc, String mediaServerId, SIPResponse response, InviteSessionType type) {
|
||||||
SsrcTransaction ssrcTransaction = new SsrcTransaction();
|
SsrcTransaction ssrcTransaction = new SsrcTransaction();
|
||||||
ssrcTransaction.setDeviceId(deviceId);
|
ssrcTransaction.setDeviceId(deviceId);
|
||||||
ssrcTransaction.setChannelId(channelId);
|
ssrcTransaction.setChannelId(channelId);
|
||||||
ssrcTransaction.setCallId(callId);
|
ssrcTransaction.setCallId(callId);
|
||||||
|
ssrcTransaction.setApp(app);
|
||||||
ssrcTransaction.setStream(stream);
|
ssrcTransaction.setStream(stream);
|
||||||
ssrcTransaction.setMediaServerId(mediaServerId);
|
ssrcTransaction.setMediaServerId(mediaServerId);
|
||||||
ssrcTransaction.setSsrc(ssrc);
|
ssrcTransaction.setSsrc(ssrc);
|
||||||
|
@ -65,13 +71,14 @@ public class SsrcTransaction {
|
||||||
ssrcTransaction.setType(type);
|
ssrcTransaction.setType(type);
|
||||||
return ssrcTransaction;
|
return ssrcTransaction;
|
||||||
}
|
}
|
||||||
public static SsrcTransaction buildForPlatform(String platformId, Integer channelId, String callId, String stream,
|
public static SsrcTransaction buildForPlatform(String platformId, Integer channelId, String callId, String app,String stream,
|
||||||
String ssrc, String mediaServerId, SIPResponse response, InviteSessionType type) {
|
String ssrc, String mediaServerId, SIPResponse response, InviteSessionType type) {
|
||||||
SsrcTransaction ssrcTransaction = new SsrcTransaction();
|
SsrcTransaction ssrcTransaction = new SsrcTransaction();
|
||||||
ssrcTransaction.setPlatformId(platformId);
|
ssrcTransaction.setPlatformId(platformId);
|
||||||
ssrcTransaction.setChannelId(channelId);
|
ssrcTransaction.setChannelId(channelId);
|
||||||
ssrcTransaction.setCallId(callId);
|
ssrcTransaction.setCallId(callId);
|
||||||
ssrcTransaction.setStream(stream);
|
ssrcTransaction.setStream(stream);
|
||||||
|
ssrcTransaction.setApp(app);
|
||||||
ssrcTransaction.setMediaServerId(mediaServerId);
|
ssrcTransaction.setMediaServerId(mediaServerId);
|
||||||
ssrcTransaction.setSsrc(ssrc);
|
ssrcTransaction.setSsrc(ssrc);
|
||||||
ssrcTransaction.setSipTransactionInfo(new SipTransactionInfo(response));
|
ssrcTransaction.setSipTransactionInfo(new SipTransactionInfo(response));
|
||||||
|
|
|
@ -195,7 +195,7 @@ public class GBRecordController {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, channelId, stream, null);
|
cmder.streamByeCmd(device, channelId, "rtp", stream, null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
log.warn("[停止历史媒体下载]停止历史媒体下载,发送BYE失败 {}", e.getMessage());
|
log.warn("[停止历史媒体下载]停止历史媒体下载,发送BYE失败 {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public interface IPlatformService {
|
||||||
/**
|
/**
|
||||||
* 语音喊话回复BYE
|
* 语音喊话回复BYE
|
||||||
*/
|
*/
|
||||||
void stopBroadcast(Platform platform, CommonGBChannel channel, String stream, boolean sendBye, MediaServer mediaServerItem);
|
void stopBroadcast(Platform platform, CommonGBChannel channel, String app, String stream, boolean sendBye, MediaServer mediaServerItem);
|
||||||
|
|
||||||
void addSimulatedSubscribeInfo(Platform parentPlatform);
|
void addSimulatedSubscribeInfo(Platform parentPlatform);
|
||||||
|
|
||||||
|
|
|
@ -553,14 +553,14 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
log.info("[国标级联] 发起语音喊话 收流超时 deviceId: {}, channelId: {},端口:{}, SSRC: {}", platform.getServerGBId(), channel.getGbDeviceId(), ssrcInfo.getPort(), ssrcInfo.getSsrc());
|
log.info("[国标级联] 发起语音喊话 收流超时 deviceId: {}, channelId: {},端口:{}, SSRC: {}", platform.getServerGBId(), channel.getGbDeviceId(), ssrcInfo.getPort(), ssrcInfo.getSsrc());
|
||||||
// 点播超时回复BYE 同时释放ssrc以及此次点播的资源
|
// 点播超时回复BYE 同时释放ssrc以及此次点播的资源
|
||||||
try {
|
try {
|
||||||
commanderForPlatform.streamByeCmd(platform, channel, ssrcInfo.getStream(), null, null);
|
commanderForPlatform.streamByeCmd(platform, channel, ssrcInfo.getApp(), ssrcInfo.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[点播超时], 发送BYE失败 {}", e.getMessage());
|
log.error("[点播超时], 发送BYE失败 {}", e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
timeoutCallback.run(1, "收流超时");
|
timeoutCallback.run(1, "收流超时");
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||||
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
mediaServerService.closeRTPServer(mediaServerItem, ssrcInfo.getStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
try {
|
try {
|
||||||
log.warn("[Invite 200OK] 更新ssrc失败,停止喊话 {}/{}", platform.getServerGBId(), channel.getGbDeviceId());
|
log.warn("[Invite 200OK] 更新ssrc失败,停止喊话 {}/{}", platform.getServerGBId(), channel.getGbDeviceId());
|
||||||
commanderForPlatform.streamByeCmd(platform, channel, ssrcInfo.getStream(), null, null);
|
commanderForPlatform.streamByeCmd(platform, channel, ssrcInfo.getApp(), ssrcInfo.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[命令发送失败] 停止播放, 发送BYE: {}", e.getMessage());
|
log.error("[命令发送失败] 停止播放, 发送BYE: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -647,7 +647,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
// 释放ssrc
|
// 释放ssrc
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||||
|
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
|
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(),
|
callback.run(InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(),
|
||||||
"下级自定义了ssrc,重新设置收流信息失败", null);
|
"下级自定义了ssrc,重新设置收流信息失败", null);
|
||||||
|
@ -687,12 +687,13 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
if (ssrcInResponse != null) {
|
if (ssrcInResponse != null) {
|
||||||
// 单端口
|
// 单端口
|
||||||
// 重新订阅流上线
|
// 重新订阅流上线
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(inviteInfo.getStream());
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(ssrcInfo.getApp(), inviteInfo.getStream());
|
||||||
sessionManager.removeByStream(inviteInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), inviteInfo.getStream());
|
||||||
inviteStreamService.updateInviteInfoForSSRC(inviteInfo, ssrcInResponse);
|
inviteStreamService.updateInviteInfoForSSRC(inviteInfo, ssrcInResponse);
|
||||||
|
|
||||||
ssrcTransaction.setPlatformId(platform.getServerGBId());
|
ssrcTransaction.setPlatformId(platform.getServerGBId());
|
||||||
ssrcTransaction.setChannelId(channel.getGbId());
|
ssrcTransaction.setChannelId(channel.getGbId());
|
||||||
|
ssrcTransaction.setApp(ssrcInfo.getApp());
|
||||||
ssrcTransaction.setStream(inviteInfo.getStream());
|
ssrcTransaction.setStream(inviteInfo.getStream());
|
||||||
ssrcTransaction.setSsrc(ssrcInResponse);
|
ssrcTransaction.setSsrc(ssrcInResponse);
|
||||||
ssrcTransaction.setMediaServerId(mediaServerItem.getId());
|
ssrcTransaction.setMediaServerId(mediaServerItem.getId());
|
||||||
|
@ -744,7 +745,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
// 释放ssrc
|
// 释放ssrc
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||||
|
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
|
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(),
|
callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(),
|
||||||
InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null);
|
InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null);
|
||||||
|
@ -755,11 +756,11 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void stopBroadcast(Platform platform, CommonGBChannel channel, String stream, boolean sendBye, MediaServer mediaServerItem) {
|
public void stopBroadcast(Platform platform, CommonGBChannel channel, String app, String stream, boolean sendBye, MediaServer mediaServerItem) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (sendBye) {
|
if (sendBye) {
|
||||||
commanderForPlatform.streamByeCmd(platform, channel, stream, null, null);
|
commanderForPlatform.streamByeCmd(platform, channel, app, stream, null, null);
|
||||||
}
|
}
|
||||||
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
||||||
log.warn("[消息发送失败] 停止语音对讲, 平台:{},通道:{}", platform.getId(), channel.getGbDeviceId() );
|
log.warn("[消息发送失败] 停止语音对讲, 平台:{},通道:{}", platform.getId(), channel.getGbDeviceId() );
|
||||||
|
@ -771,7 +772,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), inviteInfo.getSsrcInfo().getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), inviteInfo.getSsrcInfo().getSsrc());
|
||||||
inviteStreamService.removeInviteInfo(inviteInfo);
|
inviteStreamService.removeInviteInfo(inviteInfo);
|
||||||
}
|
}
|
||||||
sessionManager.removeByStream(stream);
|
sessionManager.removeByStream(app, stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
DeviceChannel channel = deviceChannelService.getOneById(sendRtpInfo.getChannelId());
|
DeviceChannel channel = deviceChannelService.getOneById(sendRtpInfo.getChannelId());
|
||||||
try {
|
try {
|
||||||
if (device != null && channel != null) {
|
if (device != null && channel != null) {
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), event.getStream(), sendRtpInfo.getCallId());
|
cmder.streamByeCmd(device, channel.getDeviceId(), event.getApp(), event.getStream(), sendRtpInfo.getCallId(), null);
|
||||||
if (sendRtpInfo.getPlayType().equals(InviteStreamType.BROADCAST)
|
if (sendRtpInfo.getPlayType().equals(InviteStreamType.BROADCAST)
|
||||||
|| sendRtpInfo.getPlayType().equals(InviteStreamType.TALK)) {
|
|| sendRtpInfo.getPlayType().equals(InviteStreamType.TALK)) {
|
||||||
AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(channel.getId());
|
AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(channel.getId());
|
||||||
|
@ -405,14 +405,14 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
}
|
}
|
||||||
inviteStreamService.call(InviteSessionType.PLAY, channel.getId(), null, code, msg, null);
|
inviteStreamService.call(InviteSessionType.PLAY, channel.getId(), null, code, msg, null);
|
||||||
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(streamId);
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream("rtp", streamId);
|
||||||
if (ssrcTransaction != null) {
|
if (ssrcTransaction != null) {
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), streamId, null);
|
cmder.streamByeCmd(device, channel.getDeviceId(),"rtp", streamId, null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[点播超时], 发送BYE失败 {}", e.getMessage());
|
log.error("[点播超时], 发送BYE失败 {}", e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
sessionManager.removeByStream(streamId);
|
sessionManager.removeByStream("rtp", streamId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -450,7 +450,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
log.info("[点播失败]{}:{} deviceId: {}, channelId:{}",event.statusCode, event.msg, device.getDeviceId(), channel.getDeviceId());
|
log.info("[点播失败]{}:{} deviceId: {}, channelId:{}",event.statusCode, event.msg, device.getDeviceId(), channel.getDeviceId());
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
|
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.run(event.statusCode, event.msg, null);
|
callback.run(event.statusCode, event.msg, null);
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||||
log.error("[命令发送失败] 点播消息: {}", e.getMessage());
|
log.error("[命令发送失败] 点播消息: {}", e.getMessage());
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getCode(),
|
callback.run(InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getCode(),
|
||||||
InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getMsg(), null);
|
InviteErrorCode.ERROR_FOR_SIP_SENDING_FAILED.getMsg(), null);
|
||||||
|
@ -513,13 +513,13 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
timeoutCallback.run();
|
timeoutCallback.run();
|
||||||
// 点播超时回复BYE 同时释放ssrc以及此次点播的资源
|
// 点播超时回复BYE 同时释放ssrc以及此次点播的资源
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), stream, null);
|
cmder.streamByeCmd(device, channel.getDeviceId(), null, null, callId, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[语音对讲]超时, 发送BYE失败 {}", e.getMessage());
|
log.error("[语音对讲]超时, 发送BYE失败 {}", e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
timeoutCallback.run();
|
timeoutCallback.run();
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
||||||
sessionManager.removeByStream(sendRtpInfo.getStream());
|
sessionManager.removeByStream(sendRtpInfo.getApp(), sendRtpInfo.getStream());
|
||||||
}
|
}
|
||||||
}, userSetting.getPlayTimeout());
|
}, userSetting.getPlayTimeout());
|
||||||
|
|
||||||
|
@ -528,7 +528,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (localPort == null || localPort <= 0) {
|
if (localPort == null || localPort <= 0) {
|
||||||
timeoutCallback.run();
|
timeoutCallback.run();
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
||||||
sessionManager.removeByStream(sendRtpInfo.getStream());
|
sessionManager.removeByStream(sendRtpInfo.getApp(), sendRtpInfo.getStream());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendRtpInfo.setPort(localPort);
|
sendRtpInfo.setPort(localPort);
|
||||||
|
@ -563,7 +563,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
sendRtpInfo.setCallId(response.getCallIdHeader().getCallId());
|
sendRtpInfo.setCallId(response.getCallIdHeader().getCallId());
|
||||||
sendRtpServerService.update(sendRtpInfo);
|
sendRtpServerService.update(sendRtpInfo);
|
||||||
|
|
||||||
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), sendRtpInfo.getChannelId(), "talk",
|
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), sendRtpInfo.getChannelId(), "talk", sendRtpInfo.getApp(),
|
||||||
sendRtpInfo.getStream(), sendRtpInfo.getSsrc(), sendRtpInfo.getMediaServerId(),
|
sendRtpInfo.getStream(), sendRtpInfo.getSsrc(), sendRtpInfo.getMediaServerId(),
|
||||||
response, InviteSessionType.TALK);
|
response, InviteSessionType.TALK);
|
||||||
|
|
||||||
|
@ -580,7 +580,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
mediaServerService.closeRTPServer(mediaServerItem, sendRtpInfo.getStream());
|
mediaServerService.closeRTPServer(mediaServerItem, sendRtpInfo.getStream());
|
||||||
// 释放ssrc
|
// 释放ssrc
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
||||||
sessionManager.removeByStream(sendRtpInfo.getStream());
|
sessionManager.removeByStream(sendRtpInfo.getApp(), sendRtpInfo.getStream());
|
||||||
errorEvent.response(event);
|
errorEvent.response(event);
|
||||||
}, userSetting.getPlayTimeout().longValue());
|
}, userSetting.getPlayTimeout().longValue());
|
||||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||||
|
@ -591,7 +591,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
// 释放ssrc
|
// 释放ssrc
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpInfo.getSsrc());
|
||||||
|
|
||||||
sessionManager.removeByStream(sendRtpInfo.getStream());
|
sessionManager.removeByStream(sendRtpInfo.getApp(), sendRtpInfo.getStream());
|
||||||
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult();
|
SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult();
|
||||||
eventResult.type = SipSubscribe.EventResultType.cmdSendFailEvent;
|
eventResult.type = SipSubscribe.EventResultType.cmdSendFailEvent;
|
||||||
eventResult.statusCode = -1;
|
eventResult.statusCode = -1;
|
||||||
|
@ -634,7 +634,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
// 主动连接失败,结束流程, 清理数据
|
// 主动连接失败,结束流程, 清理数据
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(),
|
callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(),
|
||||||
InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null);
|
InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null);
|
||||||
inviteStreamService.call(InviteSessionType.BROADCAST, channel.getId(), null,
|
inviteStreamService.call(InviteSessionType.BROADCAST, channel.getId(), null,
|
||||||
|
@ -645,7 +645,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
log.error("[TCP主动连接对方] deviceId: {}, channelId: {}, 解析200OK的SDP信息失败", device.getDeviceId(), channel.getDeviceId(), e);
|
log.error("[TCP主动连接对方] deviceId: {}, channelId: {}, 解析200OK的SDP信息失败", device.getDeviceId(), channel.getDeviceId(), e);
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
|
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
|
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(),
|
callback.run(InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getCode(),
|
||||||
InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null);
|
InviteErrorCode.ERROR_FOR_SDP_PARSING_EXCEPTIONS.getMsg(), null);
|
||||||
|
@ -789,14 +789,14 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
}
|
}
|
||||||
inviteStreamService.call(InviteSessionType.PLAYBACK, channel.getId(), null, code, msg, null);
|
inviteStreamService.call(InviteSessionType.PLAYBACK, channel.getId(), null, code, msg, null);
|
||||||
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAYBACK, channel.getId());
|
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAYBACK, channel.getId());
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(stream);
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream("rtp", stream);
|
||||||
if (ssrcTransaction != null) {
|
if (ssrcTransaction != null) {
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), stream, null);
|
cmder.streamByeCmd(device, channel.getDeviceId(),"rtp", stream, null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[录像回放] 发送BYE失败 {}", e.getMessage());
|
log.error("[录像回放] 发送BYE失败 {}", e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
sessionManager.removeByStream(stream);
|
sessionManager.removeByStream("rtp", stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -835,7 +835,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
}
|
}
|
||||||
|
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
inviteStreamService.removeInviteInfo(inviteInfo);
|
inviteStreamService.removeInviteInfo(inviteInfo);
|
||||||
}, userSetting.getPlayTimeout().longValue());
|
}, userSetting.getPlayTimeout().longValue());
|
||||||
} catch (InvalidArgumentException | SipException | ParseException e) {
|
} catch (InvalidArgumentException | SipException | ParseException e) {
|
||||||
|
@ -844,7 +844,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
callback.run(InviteErrorCode.FAIL.getCode(), e.getMessage(), null);
|
callback.run(InviteErrorCode.FAIL.getCode(), e.getMessage(), null);
|
||||||
}
|
}
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
inviteStreamService.removeInviteInfo(inviteInfo);
|
inviteStreamService.removeInviteInfo(inviteInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -890,7 +890,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
try {
|
try {
|
||||||
log.warn("[Invite 200OK] 更新ssrc失败,停止点播 {}/{}", device.getDeviceId(), channel.getDeviceId());
|
log.warn("[Invite 200OK] 更新ssrc失败,停止点播 {}/{}", device.getDeviceId(), channel.getDeviceId());
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), ssrcInfo.getStream(), null, null);
|
cmder.streamByeCmd(device, channel.getDeviceId(), ssrcInfo.getApp(), ssrcInfo.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[命令发送失败] 停止播放, 发送BYE: {}", e.getMessage());
|
log.error("[命令发送失败] 停止播放, 发送BYE: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -898,7 +898,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
// 释放ssrc
|
// 释放ssrc
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||||
|
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
|
|
||||||
callback.run(InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(),
|
callback.run(InviteErrorCode.ERROR_FOR_RESET_SSRC.getCode(),
|
||||||
"下级自定义了ssrc,重新设置收流信息失败", null);
|
"下级自定义了ssrc,重新设置收流信息失败", null);
|
||||||
|
@ -924,13 +924,15 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (ssrcInResponse != null) {
|
if (ssrcInResponse != null) {
|
||||||
// 单端口
|
// 单端口
|
||||||
// 重新订阅流上线
|
// 重新订阅流上线
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(inviteInfo.getStream());
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream("rtp", inviteInfo.getStream());
|
||||||
sessionManager.removeByStream(inviteInfo.getStream());
|
sessionManager.removeByStream("rtp", inviteInfo.getStream());
|
||||||
inviteStreamService.updateInviteInfoForSSRC(inviteInfo, ssrcInResponse);
|
inviteStreamService.updateInviteInfoForSSRC(inviteInfo, ssrcInResponse);
|
||||||
ssrcTransaction.setDeviceId(device.getDeviceId());
|
ssrcTransaction.setDeviceId(device.getDeviceId());
|
||||||
ssrcTransaction.setChannelId(ssrcTransaction.getChannelId());
|
ssrcTransaction.setChannelId(ssrcTransaction.getChannelId());
|
||||||
ssrcTransaction.setCallId(ssrcTransaction.getCallId());
|
ssrcTransaction.setCallId(ssrcTransaction.getCallId());
|
||||||
ssrcTransaction.setSsrc(ssrcInResponse);
|
ssrcTransaction.setSsrc(ssrcInResponse);
|
||||||
|
ssrcTransaction.setApp("rtp");
|
||||||
|
ssrcTransaction.setStream(inviteInfo.getStream());
|
||||||
ssrcTransaction.setMediaServerId(mediaServerItem.getId());
|
ssrcTransaction.setMediaServerId(mediaServerItem.getId());
|
||||||
ssrcTransaction.setSipTransactionInfo(new SipTransactionInfo((SIPResponse) responseEvent.getResponse()));
|
ssrcTransaction.setSipTransactionInfo(new SipTransactionInfo((SIPResponse) responseEvent.getResponse()));
|
||||||
ssrcTransaction.setType(inviteSessionType);
|
ssrcTransaction.setType(inviteSessionType);
|
||||||
|
@ -993,14 +995,14 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
inviteStreamService.call(InviteSessionType.DOWNLOAD, channel.getId(), null, code, msg, null);
|
inviteStreamService.call(InviteSessionType.DOWNLOAD, channel.getId(), null, code, msg, null);
|
||||||
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.DOWNLOAD, channel.getId());
|
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.DOWNLOAD, channel.getId());
|
||||||
if (result != null && result.getSsrcInfo() != null) {
|
if (result != null && result.getSsrcInfo() != null) {
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(result.getSsrcInfo().getStream());
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(result.getSsrcInfo().getApp(), result.getSsrcInfo().getStream());
|
||||||
if (ssrcTransaction != null) {
|
if (ssrcTransaction != null) {
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), ssrcTransaction.getStream(), null);
|
cmder.streamByeCmd(device, channel.getDeviceId(), ssrcTransaction.getApp(), ssrcTransaction.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[录像下载] 发送BYE失败 {}", e.getMessage());
|
log.error("[录像下载] 发送BYE失败 {}", e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
sessionManager.removeByStream(ssrcTransaction.getStream());
|
sessionManager.removeByStream(ssrcTransaction.getApp(), ssrcTransaction.getStream());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1034,7 +1036,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
// 对方返回错误
|
// 对方返回错误
|
||||||
callback.run(InviteErrorCode.FAIL.getCode(), String.format("录像下载失败, 错误码: %s, %s", eventResult.statusCode, eventResult.msg), null);
|
callback.run(InviteErrorCode.FAIL.getCode(), String.format("录像下载失败, 错误码: %s, %s", eventResult.statusCode, eventResult.msg), null);
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
inviteStreamService.removeInviteInfo(inviteInfo);
|
inviteStreamService.removeInviteInfo(inviteInfo);
|
||||||
}, eventResult ->{
|
}, eventResult ->{
|
||||||
// 处理收到200ok后的TCP主动连接以及SSRC不一致的问题
|
// 处理收到200ok后的TCP主动连接以及SSRC不一致的问题
|
||||||
|
@ -1066,7 +1068,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
log.error("[命令发送失败] 录像下载: {}", e.getMessage());
|
log.error("[命令发送失败] 录像下载: {}", e.getMessage());
|
||||||
callback.run(InviteErrorCode.FAIL.getCode(),e.getMessage(), null);
|
callback.run(InviteErrorCode.FAIL.getCode(),e.getMessage(), null);
|
||||||
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
receiveRtpServerService.closeRTPServer(mediaServerItem, ssrcInfo);
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
inviteStreamService.removeInviteInfo(inviteInfo);
|
inviteStreamService.removeInviteInfo(inviteInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1202,8 +1204,8 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, deviceChannel.getDeviceId(),
|
cmder.streamByeCmd(device, deviceChannel.getDeviceId(), ssrcTransaction.getApp(),
|
||||||
ssrcTransaction.getStream(), null);
|
ssrcTransaction.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException |
|
} catch (InvalidArgumentException | ParseException | SipException |
|
||||||
SsrcTransactionNotFoundException e) {
|
SsrcTransactionNotFoundException e) {
|
||||||
log.error("[zlm离线]为正在使用此zlm的设备, 发送BYE失败 {}", e.getMessage());
|
log.error("[zlm离线]为正在使用此zlm的设备, 发送BYE失败 {}", e.getMessage());
|
||||||
|
@ -1537,10 +1539,10 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
|
|
||||||
ssrcFactory.releaseSsrc(mediaServerId, sendRtpInfo.getSsrc());
|
ssrcFactory.releaseSsrc(mediaServerId, sendRtpInfo.getSsrc());
|
||||||
|
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(sendRtpInfo.getStream());
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(sendRtpInfo.getApp(), sendRtpInfo.getStream());
|
||||||
if (ssrcTransaction != null) {
|
if (ssrcTransaction != null) {
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), sendRtpInfo.getStream(), null);
|
cmder.streamByeCmd(device, channel.getDeviceId(), sendRtpInfo.getApp(), sendRtpInfo.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
log.info("[语音对讲] 停止消息发送失败,可能已经停止");
|
log.info("[语音对讲] 停止消息发送失败,可能已经停止");
|
||||||
}
|
}
|
||||||
|
@ -1607,7 +1609,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (InviteSessionStatus.ok == inviteInfo.getStatus()) {
|
if (InviteSessionStatus.ok == inviteInfo.getStatus()) {
|
||||||
try {
|
try {
|
||||||
log.info("[停止点播/回放/下载] {}/{}", device.getDeviceId(), channel.getDeviceId());
|
log.info("[停止点播/回放/下载] {}/{}", device.getDeviceId(), channel.getDeviceId());
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), inviteInfo.getStream(), null, null);
|
cmder.streamByeCmd(device, channel.getDeviceId(), "rtp", inviteInfo.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
||||||
log.error("[命令发送失败] 停止点播/回放/下载, 发送BYE: {}", e.getMessage());
|
log.error("[命令发送失败] 停止点播/回放/下载, 发送BYE: {}", e.getMessage());
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage());
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "命令发送失败: " + e.getMessage());
|
||||||
|
@ -1639,7 +1641,7 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
if (InviteSessionStatus.ok == inviteInfo.getStatus()) {
|
if (InviteSessionStatus.ok == inviteInfo.getStatus()) {
|
||||||
try {
|
try {
|
||||||
log.info("[停止点播/回放/下载] {}/{}", device.getDeviceId(), channel.getDeviceId());
|
log.info("[停止点播/回放/下载] {}/{}", device.getDeviceId(), channel.getDeviceId());
|
||||||
cmder.streamByeCmd(device, channel.getDeviceId(), inviteInfo.getStream(), null, null);
|
cmder.streamByeCmd(device, channel.getDeviceId(), "rtp", inviteInfo.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) {
|
||||||
log.warn("[命令发送失败] 停止点播/回放/下载, 发送BYE: {}", e.getMessage());
|
log.warn("[命令发送失败] 停止点播/回放/下载, 发送BYE: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,15 +27,15 @@ public class SipInviteSessionManager {
|
||||||
*/
|
*/
|
||||||
public void put(SsrcTransaction ssrcTransaction){
|
public void put(SsrcTransaction ssrcTransaction){
|
||||||
redisTemplate.opsForHash().put(VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId()
|
redisTemplate.opsForHash().put(VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId()
|
||||||
, ssrcTransaction.getStream(), ssrcTransaction);
|
, ssrcTransaction.getApp() + ssrcTransaction.getStream(), ssrcTransaction);
|
||||||
|
|
||||||
redisTemplate.opsForHash().put(VideoManagerConstants.SIP_INVITE_SESSION_CALL_ID + userSetting.getServerId()
|
redisTemplate.opsForHash().put(VideoManagerConstants.SIP_INVITE_SESSION_CALL_ID + userSetting.getServerId()
|
||||||
, ssrcTransaction.getCallId(), ssrcTransaction);
|
, ssrcTransaction.getCallId(), ssrcTransaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SsrcTransaction getSsrcTransactionByStream(String stream){
|
public SsrcTransaction getSsrcTransactionByStream(String app, String stream){
|
||||||
String key = VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId();
|
String key = VideoManagerConstants.SIP_INVITE_SESSION_STREAM + userSetting.getServerId();
|
||||||
return (SsrcTransaction)redisTemplate.opsForHash().get(key, stream);
|
return (SsrcTransaction)redisTemplate.opsForHash().get(key, app + stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SsrcTransaction getSsrcTransactionByCallId(String callId){
|
public SsrcTransaction getSsrcTransactionByCallId(String callId){
|
||||||
|
@ -56,8 +56,8 @@ public class SipInviteSessionManager {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeByStream(String stream) {
|
public void removeByStream(String app, String stream) {
|
||||||
SsrcTransaction ssrcTransaction = getSsrcTransactionByStream(stream);
|
SsrcTransaction ssrcTransaction = getSsrcTransactionByStream(app, stream);
|
||||||
if (ssrcTransaction == null ) {
|
if (ssrcTransaction == null ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,13 +129,10 @@ public interface ISIPCommander {
|
||||||
/**
|
/**
|
||||||
* 视频流停止
|
* 视频流停止
|
||||||
*/
|
*/
|
||||||
void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
|
void streamByeCmd(Device device, String channelId, String app, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
|
||||||
|
|
||||||
void talkStreamCmd(MediaServer mediaServerItem, SendRtpInfo sendRtpItem, Device device, DeviceChannel channelId, String callId, HookSubscribe.Event event, HookSubscribe.Event eventForPush, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent, Long timeout) throws InvalidArgumentException, SipException, ParseException;
|
void talkStreamCmd(MediaServer mediaServerItem, SendRtpInfo sendRtpItem, Device device, DeviceChannel channelId, String callId, HookSubscribe.Event event, HookSubscribe.Event eventForPush, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent, Long timeout) throws InvalidArgumentException, SipException, ParseException;
|
||||||
|
|
||||||
|
|
||||||
void streamByeCmd(Device device, String channelId, String stream, String callId) throws InvalidArgumentException, ParseException, SipException, SsrcTransactionNotFoundException;
|
|
||||||
|
|
||||||
void streamByeCmd(Device device, String channelId, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
|
void streamByeCmd(Device device, String channelId, SipTransactionInfo sipTransactionInfo, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -144,7 +144,7 @@ public interface ISIPCommanderForPlatform {
|
||||||
|
|
||||||
void streamByeCmd(Platform platform, SendRtpInfo sendRtpItem, CommonGBChannel channel) throws SipException, InvalidArgumentException, ParseException;
|
void streamByeCmd(Platform platform, SendRtpInfo sendRtpItem, CommonGBChannel channel) throws SipException, InvalidArgumentException, ParseException;
|
||||||
|
|
||||||
void streamByeCmd(Platform platform, CommonGBChannel channel, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
|
void streamByeCmd(Platform platform, CommonGBChannel channel, String app, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
|
||||||
|
|
||||||
void broadcastInviteCmd(Platform platform, CommonGBChannel channel, String sourceId, MediaServer mediaServerItem,
|
void broadcastInviteCmd(Platform platform, CommonGBChannel channel, String sourceId, MediaServer mediaServerItem,
|
||||||
SSRCInfo ssrcInfo, HookSubscribe.Event event, SipSubscribe.Event okEvent,
|
SSRCInfo ssrcInfo, HookSubscribe.Event event, SipSubscribe.Event okEvent,
|
||||||
|
|
|
@ -332,14 +332,15 @@ public class SIPCommander implements ISIPCommander {
|
||||||
|
|
||||||
Request request = headerProvider.createInviteRequest(device, channel.getDeviceId(), content.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null, ssrcInfo.getSsrc(),sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
|
Request request = headerProvider.createInviteRequest(device, channel.getDeviceId(), content.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null, ssrcInfo.getSsrc(),sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()));
|
||||||
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, (e -> {
|
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, (e -> {
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||||
errorEvent.response(e);
|
errorEvent.response(e);
|
||||||
}), e -> {
|
}), e -> {
|
||||||
ResponseEvent responseEvent = (ResponseEvent) e.event;
|
ResponseEvent responseEvent = (ResponseEvent) e.event;
|
||||||
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
||||||
String callId = response.getCallIdHeader().getCallId();
|
String callId = response.getCallIdHeader().getCallId();
|
||||||
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), channel.getId(), callId, stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), response,
|
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), channel.getId(),
|
||||||
|
callId,ssrcInfo.getApp(), ssrcInfo.getStream(), ssrcInfo.getSsrc(), mediaServerItem.getId(), response,
|
||||||
InviteSessionType.PLAY);
|
InviteSessionType.PLAY);
|
||||||
sessionManager.put(ssrcTransaction);
|
sessionManager.put(ssrcTransaction);
|
||||||
okEvent.response(e);
|
okEvent.response(e);
|
||||||
|
@ -435,7 +436,9 @@ public class SIPCommander implements ISIPCommander {
|
||||||
ResponseEvent responseEvent = (ResponseEvent) event.event;
|
ResponseEvent responseEvent = (ResponseEvent) event.event;
|
||||||
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
||||||
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(),
|
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(),
|
||||||
channel.getId(), sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),device.getTransport()).getCallId(), ssrcInfo.getStream(), ssrcInfo.getSsrc(), mediaServerItem.getId(), response, InviteSessionType.PLAYBACK);
|
channel.getId(), sipSender.getNewCallIdHeader(sipLayer.getLocalIp(device.getLocalIp()),
|
||||||
|
device.getTransport()).getCallId(), ssrcInfo.getApp(), ssrcInfo.getStream(), ssrcInfo.getSsrc(),
|
||||||
|
mediaServerItem.getId(), response, InviteSessionType.PLAYBACK);
|
||||||
sessionManager.put(ssrcTransaction);
|
sessionManager.put(ssrcTransaction);
|
||||||
okEvent.response(event);
|
okEvent.response(event);
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
@ -526,7 +529,9 @@ public class SIPCommander implements ISIPCommander {
|
||||||
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
||||||
String contentString =new String(response.getRawContent());
|
String contentString =new String(response.getRawContent());
|
||||||
String ssrc = SipUtils.getSsrcFromSdp(contentString);
|
String ssrc = SipUtils.getSsrcFromSdp(contentString);
|
||||||
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), channel.getId(), response.getCallIdHeader().getCallId(), ssrcInfo.getStream(), ssrc, mediaServerItem.getId(), response, InviteSessionType.DOWNLOAD);
|
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), channel.getId(),
|
||||||
|
response.getCallIdHeader().getCallId(), ssrcInfo.getApp(), ssrcInfo.getStream(), ssrc,
|
||||||
|
mediaServerItem.getId(), response, InviteSessionType.DOWNLOAD);
|
||||||
sessionManager.put(ssrcTransaction);
|
sessionManager.put(ssrcTransaction);
|
||||||
okEvent.response(event);
|
okEvent.response(event);
|
||||||
}, timeout);
|
}, timeout);
|
||||||
|
@ -586,32 +591,24 @@ public class SIPCommander implements ISIPCommander {
|
||||||
Request request = headerProvider.createInviteRequest(device, channel.getDeviceId(), content.toString(),
|
Request request = headerProvider.createInviteRequest(device, channel.getDeviceId(), content.toString(),
|
||||||
SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null, sendRtpItem.getSsrc(), callIdHeader);
|
SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), null, sendRtpItem.getSsrc(), callIdHeader);
|
||||||
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, (e -> {
|
sipSender.transmitRequest(sipLayer.getLocalIp(device.getLocalIp()), request, (e -> {
|
||||||
sessionManager.removeByStream(sendRtpItem.getStream());
|
sessionManager.removeByStream(sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc());
|
||||||
errorEvent.response(e);
|
errorEvent.response(e);
|
||||||
}), e -> {
|
}), e -> {
|
||||||
// 这里为例避免一个通道的点播只有一个callID这个参数使用一个固定值
|
// 这里为例避免一个通道的点播只有一个callID这个参数使用一个固定值
|
||||||
ResponseEvent responseEvent = (ResponseEvent) e.event;
|
ResponseEvent responseEvent = (ResponseEvent) e.event;
|
||||||
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
||||||
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), channel.getId(), "talk", stream, sendRtpItem.getSsrc(), mediaServerItem.getId(), response, InviteSessionType.TALK);
|
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), channel.getId(), "talk",sendRtpItem.getApp(), stream, sendRtpItem.getSsrc(), mediaServerItem.getId(), response, InviteSessionType.TALK);
|
||||||
sessionManager.put(ssrcTransaction);
|
sessionManager.put(ssrcTransaction);
|
||||||
okEvent.response(e);
|
okEvent.response(e);
|
||||||
}, timeout);
|
}, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 视频流停止, 不使用回调
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void streamByeCmd(Device device, String channelId, String stream, String callId) throws InvalidArgumentException, ParseException, SipException, SsrcTransactionNotFoundException {
|
|
||||||
streamByeCmd(device, channelId, stream, callId, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 视频流停止
|
* 视频流停止
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void streamByeCmd(Device device, String channelId, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
|
public void streamByeCmd(Device device, String channelId, String app, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
log.warn("[发送BYE] device为null");
|
log.warn("[发送BYE] device为null");
|
||||||
return;
|
return;
|
||||||
|
@ -620,7 +617,7 @@ public class SIPCommander implements ISIPCommander {
|
||||||
if (callId != null) {
|
if (callId != null) {
|
||||||
ssrcTransaction = sessionManager.getSsrcTransactionByCallId(callId);
|
ssrcTransaction = sessionManager.getSsrcTransactionByCallId(callId);
|
||||||
}else if (stream != null) {
|
}else if (stream != null) {
|
||||||
ssrcTransaction = sessionManager.getSsrcTransactionByStream(stream);
|
ssrcTransaction = sessionManager.getSsrcTransactionByStream(app, stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ssrcTransaction == null) {
|
if (ssrcTransaction == null) {
|
||||||
|
@ -1362,7 +1359,7 @@ public class SIPCommander implements ISIPCommander {
|
||||||
@Override
|
@Override
|
||||||
public void playbackControlCmd(Device device, DeviceChannel channel, String stream, String content, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException {
|
public void playbackControlCmd(Device device, DeviceChannel channel, String stream, String content, SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) throws SipException, InvalidArgumentException, ParseException {
|
||||||
|
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(stream);
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream("rtp", stream);
|
||||||
if (ssrcTransaction == null) {
|
if (ssrcTransaction == null) {
|
||||||
log.info("[回放控制]未找到视频流信息,设备:{}, 流ID: {}", device.getDeviceId(), stream);
|
log.info("[回放控制]未找到视频流信息,设备:{}, 流ID: {}", device.getDeviceId(), stream);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
||||||
import com.genersoft.iot.vmp.gb28181.SipLayer;
|
import com.genersoft.iot.vmp.gb28181.SipLayer;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.CommonGBChannelMapper;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.SipInviteSessionManager;
|
import com.genersoft.iot.vmp.gb28181.session.SipInviteSessionManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
import com.genersoft.iot.vmp.gb28181.transmit.SIPSender;
|
||||||
|
@ -644,13 +643,13 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void streamByeCmd(Platform platform, CommonGBChannel channel, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
|
public void streamByeCmd(Platform platform, CommonGBChannel channel, String app, String stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException {
|
||||||
|
|
||||||
SsrcTransaction ssrcTransaction = null;
|
SsrcTransaction ssrcTransaction = null;
|
||||||
if (callId != null) {
|
if (callId != null) {
|
||||||
ssrcTransaction = sessionManager.getSsrcTransactionByCallId(callId);
|
ssrcTransaction = sessionManager.getSsrcTransactionByCallId(callId);
|
||||||
}else if (stream != null) {
|
}else if (stream != null) {
|
||||||
ssrcTransaction = sessionManager.getSsrcTransactionByStream(stream);
|
ssrcTransaction = sessionManager.getSsrcTransactionByStream(app, stream);
|
||||||
}
|
}
|
||||||
if (ssrcTransaction == null) {
|
if (ssrcTransaction == null) {
|
||||||
throw new SsrcTransactionNotFoundException(platform.getServerGBId(), channel.getGbDeviceId(), callId, stream);
|
throw new SsrcTransactionNotFoundException(platform.getServerGBId(), channel.getGbDeviceId(), callId, stream);
|
||||||
|
@ -658,7 +657,7 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
||||||
|
|
||||||
mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
|
mediaServerService.releaseSsrc(ssrcTransaction.getMediaServerId(), ssrcTransaction.getSsrc());
|
||||||
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
|
mediaServerService.closeRTPServer(ssrcTransaction.getMediaServerId(), ssrcTransaction.getStream());
|
||||||
sessionManager.removeByStream(ssrcTransaction.getStream());
|
sessionManager.removeByStream(ssrcTransaction.getApp(), ssrcTransaction.getStream());
|
||||||
|
|
||||||
Request byteRequest = headerProviderPlatformProvider.createByteRequest(platform, channel.getGbDeviceId(), ssrcTransaction.getSipTransactionInfo());
|
Request byteRequest = headerProviderPlatformProvider.createByteRequest(platform, channel.getGbDeviceId(), ssrcTransaction.getSipTransactionInfo());
|
||||||
sipSender.transmitRequest(sipLayer.getLocalIp(platform.getDeviceIp()), byteRequest, null, okEvent);
|
sipSender.transmitRequest(sipLayer.getLocalIp(platform.getDeviceIp()), byteRequest, null, okEvent);
|
||||||
|
@ -743,14 +742,15 @@ public class SIPCommanderForPlatform implements ISIPCommanderForPlatform {
|
||||||
content.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), ssrcInfo.getSsrc(),
|
content.toString(), SipUtils.getNewViaTag(), SipUtils.getNewFromTag(), ssrcInfo.getSsrc(),
|
||||||
callIdHeader);
|
callIdHeader);
|
||||||
sipSender.transmitRequest(sipLayer.getLocalIp(platform.getDeviceIp()), request, (e -> {
|
sipSender.transmitRequest(sipLayer.getLocalIp(platform.getDeviceIp()), request, (e -> {
|
||||||
sessionManager.removeByStream(ssrcInfo.getStream());
|
sessionManager.removeByStream(ssrcInfo.getApp(), ssrcInfo.getStream());
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcInfo.getSsrc());
|
||||||
subscribe.removeSubscribe(hook);
|
subscribe.removeSubscribe(hook);
|
||||||
errorEvent.response(e);
|
errorEvent.response(e);
|
||||||
}), e -> {
|
}), e -> {
|
||||||
ResponseEvent responseEvent = (ResponseEvent) e.event;
|
ResponseEvent responseEvent = (ResponseEvent) e.event;
|
||||||
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
SIPResponse response = (SIPResponse) responseEvent.getResponse();
|
||||||
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForPlatform(platform.getServerGBId(), channel.getGbId(), callIdHeader.getCallId(), stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), response, InviteSessionType.BROADCAST);
|
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForPlatform(platform.getServerGBId(), channel.getGbId(),
|
||||||
|
callIdHeader.getCallId(), ssrcInfo.getApp(), stream, ssrcInfo.getSsrc(), mediaServerItem.getId(), response, InviteSessionType.BROADCAST);
|
||||||
sessionManager.put(ssrcTransaction);
|
sessionManager.put(ssrcTransaction);
|
||||||
okEvent.response(e);
|
okEvent.response(e);
|
||||||
});
|
});
|
||||||
|
|
|
@ -169,7 +169,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
log.info("[停止点播] {}/{}", sendRtpItem.getTargetId(), sendRtpItem.getChannelId());
|
log.info("[停止点播] {}/{}", sendRtpItem.getTargetId(), sendRtpItem.getChannelId());
|
||||||
cmder.streamByeCmd(device, deviceChannel.getDeviceId(), streamId, null);
|
cmder.streamByeCmd(device, deviceChannel.getDeviceId(), sendRtpItem.getApp(), sendRtpItem.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException |
|
} catch (InvalidArgumentException | ParseException | SipException |
|
||||||
SsrcTransactionNotFoundException e) {
|
SsrcTransactionNotFoundException e) {
|
||||||
log.error("[收到bye] {} 无其它观看者,通知设备停止推流, 发送BYE失败 {}",streamId, e.getMessage());
|
log.error("[收到bye] {} 无其它观看者,通知设备停止推流, 发送BYE失败 {}",streamId, e.getMessage());
|
||||||
|
@ -196,7 +196,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String mediaServerId = ssrcTransaction.getMediaServerId();
|
String mediaServerId = ssrcTransaction.getMediaServerId();
|
||||||
platformService.stopBroadcast(platform, channel, ssrcTransaction.getStream(), false,
|
platformService.stopBroadcast(platform, channel, ssrcTransaction.getApp(), ssrcTransaction.getStream(), false,
|
||||||
mediaServerService.getOne(mediaServerId));
|
mediaServerService.getOne(mediaServerId));
|
||||||
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
|
DeviceChannel deviceChannel = deviceChannelService.getOneForSourceById(channel.getGbId());
|
||||||
Device device = deviceService.getDevice(channel.getDataDeviceId());
|
Device device = deviceService.getDevice(channel.getDataDeviceId());
|
||||||
|
|
|
@ -624,7 +624,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
|
||||||
audioBroadcastCatch.setStatus(AudioBroadcastCatchStatus.Ok);
|
audioBroadcastCatch.setStatus(AudioBroadcastCatchStatus.Ok);
|
||||||
audioBroadcastCatch.setSipTransactionInfoByRequest(sipResponse);
|
audioBroadcastCatch.setSipTransactionInfoByRequest(sipResponse);
|
||||||
audioBroadcastManager.update(audioBroadcastCatch);
|
audioBroadcastManager.update(audioBroadcastCatch);
|
||||||
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), sendRtpItem.getChannelId(), request.getCallIdHeader().getCallId(), sendRtpItem.getStream(), sendRtpItem.getSsrc(), sendRtpItem.getMediaServerId(), sipResponse, InviteSessionType.BROADCAST);
|
SsrcTransaction ssrcTransaction = SsrcTransaction.buildForDevice(device.getDeviceId(), sendRtpItem.getChannelId(),
|
||||||
|
request.getCallIdHeader().getCallId(), sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc(), sendRtpItem.getMediaServerId(), sipResponse, InviteSessionType.BROADCAST);
|
||||||
sessionManager.put(ssrcTransaction);
|
sessionManager.put(ssrcTransaction);
|
||||||
// 开启发流,大华在收到200OK后就会开始建立连接
|
// 开启发流,大华在收到200OK后就会开始建立连接
|
||||||
if (!device.isBroadcastPushAfterAck()) {
|
if (!device.isBroadcastPushAfterAck()) {
|
||||||
|
|
|
@ -151,7 +151,7 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
log.info("[国标级联] 语音喊话 设备正在使用中 platform: {}, channel: {}",
|
log.info("[国标级联] 语音喊话 设备正在使用中 platform: {}, channel: {}",
|
||||||
platform.getServerGBId(), channel.getGbDeviceId());
|
platform.getServerGBId(), channel.getGbDeviceId());
|
||||||
// 查看语音通道已经建立且已经占用 回复BYE
|
// 查看语音通道已经建立且已经占用 回复BYE
|
||||||
platformService.stopBroadcast(platform, channel, hookData.getStream(), true, hookData.getMediaServer());
|
platformService.stopBroadcast(platform, channel, hookData.getApp(), hookData.getStream(), true, hookData.getMediaServer());
|
||||||
}else {
|
}else {
|
||||||
// 查看语音通道已经建立但是未占用
|
// 查看语音通道已经建立但是未占用
|
||||||
broadcastCatch.setApp(hookData.getApp());
|
broadcastCatch.setApp(hookData.getApp());
|
||||||
|
|
|
@ -197,7 +197,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
||||||
} else {
|
} else {
|
||||||
rtpServerPort = mediaServer.getRtpProxyPort();
|
rtpServerPort = mediaServer.getRtpProxyPort();
|
||||||
}
|
}
|
||||||
return new SSRCInfo(rtpServerPort, ssrc, streamId, null);
|
return new SSRCInfo(rtpServerPort, ssrc, "rtp", streamId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,12 +7,14 @@ public class SSRCInfo {
|
||||||
|
|
||||||
private int port;
|
private int port;
|
||||||
private String ssrc;
|
private String ssrc;
|
||||||
|
private String app;
|
||||||
private String Stream;
|
private String Stream;
|
||||||
private String timeOutTaskKey;
|
private String timeOutTaskKey;
|
||||||
|
|
||||||
public SSRCInfo(int port, String ssrc, String stream, String timeOutTaskKey) {
|
public SSRCInfo(int port, String ssrc, String app, String stream, String timeOutTaskKey) {
|
||||||
this.port = port;
|
this.port = port;
|
||||||
this.ssrc = ssrc;
|
this.ssrc = ssrc;
|
||||||
|
this.app = app;
|
||||||
this.Stream = stream;
|
this.Stream = stream;
|
||||||
this.timeOutTaskKey = timeOutTaskKey;
|
this.timeOutTaskKey = timeOutTaskKey;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class MediaServiceImpl implements IMediaService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置音频信息及录制信息
|
// 设置音频信息及录制信息
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(stream);
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByStream(app, stream);
|
||||||
if (ssrcTransaction != null ) {
|
if (ssrcTransaction != null ) {
|
||||||
|
|
||||||
// 为录制国标模拟一个鉴权信息, 方便后续写入录像文件时使用
|
// 为录制国标模拟一个鉴权信息, 方便后续写入录像文件时使用
|
||||||
|
|
|
@ -117,11 +117,11 @@ public class RtpServerServiceImpl implements IReceiveRtpServerService {
|
||||||
// 设置流超时的定时任务
|
// 设置流超时的定时任务
|
||||||
String timeOutTaskKey = UUID.randomUUID().toString();
|
String timeOutTaskKey = UUID.randomUUID().toString();
|
||||||
|
|
||||||
SSRCInfo ssrcInfo = new SSRCInfo(rtpServerPort, ssrc, streamId, timeOutTaskKey);
|
SSRCInfo ssrcInfo = new SSRCInfo(rtpServerPort, ssrc, "rtp", streamId, timeOutTaskKey);
|
||||||
OpenRTPServerResult openRTPServerResult = new OpenRTPServerResult();
|
OpenRTPServerResult openRTPServerResult = new OpenRTPServerResult();
|
||||||
openRTPServerResult.setSsrcInfo(ssrcInfo);
|
openRTPServerResult.setSsrcInfo(ssrcInfo);
|
||||||
|
|
||||||
Hook rtpHook = Hook.getInstance(HookType.on_media_arrival, "rtp", streamId, rtpServerParam.getMediaServerItem().getId());
|
Hook rtpHook = Hook.getInstance(HookType.on_media_arrival, ssrcInfo.getApp(), streamId, rtpServerParam.getMediaServerItem().getId());
|
||||||
dynamicTask.startDelay(timeOutTaskKey, () -> {
|
dynamicTask.startDelay(timeOutTaskKey, () -> {
|
||||||
// 收流超时
|
// 收流超时
|
||||||
// 释放ssrc
|
// 释放ssrc
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class ApiStreamController {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
cmder.streamByeCmd(device, code, inviteInfo.getStream(), null);
|
cmder.streamByeCmd(device, code, "rtp", inviteInfo.getStream(), null, null);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
} catch (InvalidArgumentException | ParseException | SipException | SsrcTransactionNotFoundException e) {
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("error","发送BYE失败:" + e.getMessage());
|
result.put("error","发送BYE失败:" + e.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue