添加语音对讲接口
parent
1e67a8dde0
commit
e83e880991
|
@ -1113,33 +1113,28 @@ public class PlayServiceImpl implements IPlayService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean audioBroadcastCmd(Device device, String channelId, MediaServerItem mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException {
|
public boolean audioBroadcastCmd(Device device, DeviceChannel deviceChannel, MediaServerItem mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException {
|
||||||
if (device == null || channelId == null) {
|
if (device == null || deviceChannel == null) {
|
||||||
return false;
|
event.call(-1, "参数不全");
|
||||||
}
|
|
||||||
logger.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), channelId);
|
|
||||||
DeviceChannel deviceChannel = storager.queryChannel(device.getDeviceId(), channelId);
|
|
||||||
if (deviceChannel == null) {
|
|
||||||
logger.warn("开启语音广播的时候未找到通道: {}", channelId);
|
|
||||||
event.call(-1, "开启语音广播的时候未找到通道");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
logger.info("[语音喊话] device: {}, channel: {}", device.getDeviceId(), deviceChannel.getChannelId());
|
||||||
// 查询通道使用状态
|
// 查询通道使用状态
|
||||||
if (audioBroadcastManager.exit(device.getDeviceId(), channelId)) {
|
// if (audioBroadcastManager.exit(device.getDeviceId(), deviceChannel.getChannelId())) {
|
||||||
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null);
|
// SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(device.getDeviceId(), channelId, null, null);
|
||||||
if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
|
// if (sendRtpItem != null && sendRtpItem.isOnlyAudio()) {
|
||||||
// 查询流是否存在,不存在则认为是异常状态
|
// // 查询流是否存在,不存在则认为是异常状态
|
||||||
Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream());
|
// Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream());
|
||||||
if (streamReady) {
|
// if (streamReady) {
|
||||||
logger.warn("语音广播已经开启: {}", channelId);
|
// logger.warn("语音广播已经开启: {}", channelId);
|
||||||
event.call(-1,"语音广播已经开启");
|
// event.call(-1,"语音广播已经开启");
|
||||||
return false;
|
// return false;
|
||||||
} else {
|
// } else {
|
||||||
stopAudioBroadcast(device.getDeviceId(), channelId);
|
// stopAudioBroadcast(device.getDeviceId(), channelId);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
String channelId = deviceChannel.getChannelId();
|
||||||
// 发送通知
|
// 发送通知
|
||||||
cmder.audioBroadcastCmd(device, channelId, eventResultForOk -> {
|
cmder.audioBroadcastCmd(device, channelId, eventResultForOk -> {
|
||||||
// 发送成功
|
// 发送成功
|
||||||
|
|
Loading…
Reference in New Issue