临时提交
parent
d472ed4485
commit
b7e96de36a
|
@ -7,16 +7,49 @@ import lombok.Data;
|
||||||
@Data
|
@Data
|
||||||
public class SsrcTransaction {
|
public class SsrcTransaction {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上级平台的编号
|
||||||
|
*/
|
||||||
private String platformId;
|
private String platformId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通道的数据库ID
|
||||||
|
*/
|
||||||
private Integer channelId;
|
private Integer channelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 会话的CALL ID
|
||||||
|
*/
|
||||||
private String callId;
|
private String callId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联的流ID
|
||||||
|
*/
|
||||||
private String stream;
|
private String stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用的流媒体
|
||||||
|
*/
|
||||||
private String mediaServerId;
|
private String mediaServerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用的SSRC
|
||||||
|
*/
|
||||||
private String ssrc;
|
private String ssrc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事务信息
|
||||||
|
*/
|
||||||
private SipTransactionInfo sipTransactionInfo;
|
private SipTransactionInfo sipTransactionInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
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 stream,
|
||||||
|
|
|
@ -6,12 +6,13 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.RecordInfo;
|
import com.genersoft.iot.vmp.gb28181.bean.RecordInfo;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
||||||
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
import com.genersoft.iot.vmp.service.bean.InviteErrorCode;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
|
@ -56,7 +57,7 @@ public class GBRecordController {
|
||||||
private IPlayService playService;
|
private IPlayService playService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IInviteStreamService inviteStreamService;
|
private IDeviceChannelService channelService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceService deviceService;
|
private IDeviceService deviceService;
|
||||||
|
@ -140,8 +141,18 @@ public class GBRecordController {
|
||||||
requestMessage.setId(uuid);
|
requestMessage.setId(uuid);
|
||||||
requestMessage.setKey(key);
|
requestMessage.setKey(key);
|
||||||
|
|
||||||
|
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||||
|
if (device == null) {
|
||||||
|
log.warn("[开始历史媒体下载] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
playService.download(deviceId, channelId, startTime, endTime, Integer.parseInt(downloadSpeed),
|
DeviceChannel channel = channelService.getOne(deviceId, channelId);
|
||||||
|
if (channel == null) {
|
||||||
|
log.warn("[开始历史媒体下载] 未找到通道 deviceId: {},channelId:{}", deviceId, channelId);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道:" + channelId);
|
||||||
|
}
|
||||||
|
playService.download(device, channel, startTime, endTime, Integer.parseInt(downloadSpeed),
|
||||||
(code, msg, data)->{
|
(code, msg, data)->{
|
||||||
|
|
||||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||||
|
@ -201,7 +212,18 @@ public class GBRecordController {
|
||||||
@Parameter(name = "stream", description = "流ID", required = true)
|
@Parameter(name = "stream", description = "流ID", required = true)
|
||||||
@GetMapping("/download/progress/{deviceId}/{channelId}/{stream}")
|
@GetMapping("/download/progress/{deviceId}/{channelId}/{stream}")
|
||||||
public StreamContent getProgress(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) {
|
public StreamContent getProgress(@PathVariable String deviceId, @PathVariable String channelId, @PathVariable String stream) {
|
||||||
StreamInfo downLoadInfo = playService.getDownLoadInfo(deviceId, channelId, stream);
|
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||||
|
if (device == null) {
|
||||||
|
log.warn("[获取历史媒体下载进度] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
DeviceChannel channel = channelService.getOne(deviceId, channelId);
|
||||||
|
if (channel == null) {
|
||||||
|
log.warn("[获取历史媒体下载进度] 未找到通道 deviceId: {},channelId:{}", deviceId, channelId);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道:" + channelId);
|
||||||
|
}
|
||||||
|
StreamInfo downLoadInfo = playService.getDownLoadInfo(device, channel, stream);
|
||||||
if (downLoadInfo == null) {
|
if (downLoadInfo == null) {
|
||||||
throw new ControllerException(ErrorCode.ERROR404);
|
throw new ControllerException(ErrorCode.ERROR404);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.genersoft.iot.vmp.conf.UserSetting;
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
||||||
|
@ -87,6 +88,9 @@ public class PlayController {
|
||||||
Assert.notNull(channelId, "通道国标编号不可为NULL");
|
Assert.notNull(channelId, "通道国标编号不可为NULL");
|
||||||
// 获取可用的zlm
|
// 获取可用的zlm
|
||||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||||
|
Assert.notNull(deviceId, "设备不存在");
|
||||||
|
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
|
||||||
|
Assert.notNull(channel, "通道不存在");
|
||||||
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
|
MediaServer newMediaServerItem = playService.getNewMediaServerItem(device);
|
||||||
|
|
||||||
RequestMessage requestMessage = new RequestMessage();
|
RequestMessage requestMessage = new RequestMessage();
|
||||||
|
@ -104,8 +108,8 @@ public class PlayController {
|
||||||
wvpResult.setMsg("点播超时");
|
wvpResult.setMsg("点播超时");
|
||||||
requestMessage.setData(wvpResult);
|
requestMessage.setData(wvpResult);
|
||||||
resultHolder.invokeAllResult(requestMessage);
|
resultHolder.invokeAllResult(requestMessage);
|
||||||
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId);
|
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
||||||
deviceChannelService.stopPlay(deviceId, channelId);
|
deviceChannelService.stopPlay(channel.getId());
|
||||||
});
|
});
|
||||||
|
|
||||||
// 录像查询以channelId作为deviceId查询
|
// 录像查询以channelId作为deviceId查询
|
||||||
|
@ -161,11 +165,11 @@ public class PlayController {
|
||||||
}
|
}
|
||||||
|
|
||||||
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||||
if (device == null) {
|
DeviceChannel channel = deviceChannelService.getOne(deviceId, channelId);
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "设备[" + deviceId + "]不存在");
|
Assert.notNull(device, "设备不存在");
|
||||||
}
|
Assert.notNull(channel, "通道不存在");
|
||||||
|
|
||||||
playService.stopPlay(device, channelId);
|
playService.stopPlay(device, channel);
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
json.put("deviceId", deviceId);
|
json.put("deviceId", deviceId);
|
||||||
json.put("channelId", channelId);
|
json.put("channelId", channelId);
|
||||||
|
@ -259,9 +263,8 @@ public class PlayController {
|
||||||
@Operation(summary = "获取截图", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "获取截图", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||||
@Parameter(name = "isSubStream", description = "是否子码流(true-子码流,false-主码流),默认为false", required = true)
|
|
||||||
@GetMapping("/snap")
|
@GetMapping("/snap")
|
||||||
public DeferredResult<String> getSnap(String deviceId, String channelId,boolean isSubStream) {
|
public DeferredResult<String> getSnap(String deviceId, String channelId) {
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
log.debug("获取截图: {}/{}", deviceId, channelId);
|
log.debug("获取截图: {}/{}", deviceId, channelId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ import com.genersoft.iot.vmp.conf.exception.ServiceException;
|
||||||
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
||||||
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
import com.genersoft.iot.vmp.conf.security.JwtUtils;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.service.IDeviceChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
||||||
|
@ -71,6 +73,9 @@ public class PlaybackController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceService deviceService;
|
private IDeviceService deviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDeviceChannelService channelService;
|
||||||
|
|
||||||
@Operation(summary = "开始视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
@Operation(summary = "开始视频回放", security = @SecurityRequirement(name = JwtUtils.HEADER))
|
||||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||||
|
@ -92,8 +97,18 @@ public class PlaybackController {
|
||||||
RequestMessage requestMessage = new RequestMessage();
|
RequestMessage requestMessage = new RequestMessage();
|
||||||
requestMessage.setKey(key);
|
requestMessage.setKey(key);
|
||||||
requestMessage.setId(uuid);
|
requestMessage.setId(uuid);
|
||||||
|
Device device = deviceService.getDeviceByDeviceId(deviceId);
|
||||||
|
if (device == null) {
|
||||||
|
log.warn("[录像回放] 未找到设备 deviceId: {},channelId:{}", deviceId, channelId);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备:" + deviceId);
|
||||||
|
}
|
||||||
|
|
||||||
playService.playBack(deviceId, channelId, startTime, endTime,
|
DeviceChannel channel = channelService.getOne(deviceId, channelId);
|
||||||
|
if (channel == null) {
|
||||||
|
log.warn("[录像回放] 未找到通道 deviceId: {},channelId:{}", deviceId, channelId);
|
||||||
|
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到通道:" + channelId);
|
||||||
|
}
|
||||||
|
playService.playBack(device, channel, startTime, endTime,
|
||||||
(code, msg, data)->{
|
(code, msg, data)->{
|
||||||
|
|
||||||
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
WVPResult<StreamContent> wvpResult = new WVPResult<>();
|
||||||
|
|
|
@ -316,8 +316,8 @@ public interface DeviceChannelMapper {
|
||||||
@Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_db_id=#{deviceId} AND device_id=#{channelId}"})
|
@Update(value = {"UPDATE wvp_device_channel SET stream_id=null WHERE device_db_id=#{deviceId} AND device_id=#{channelId}"})
|
||||||
void stopPlay(@Param("deviceId") int deviceId, @Param("channelId") String channelId);
|
void stopPlay(@Param("deviceId") int deviceId, @Param("channelId") String channelId);
|
||||||
|
|
||||||
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE device_db_id=#{deviceId} AND device_id=#{channelId}"})
|
@Update(value = {"UPDATE wvp_device_channel SET stream_id=#{streamId} WHERE id=#{channelId}"})
|
||||||
void startPlay(@Param("deviceId") int deviceId, @Param("channelId") String channelId, @Param("streamId") String streamId);
|
void startPlay(@Param("channelId") Integer channelId, @Param("streamId") String streamId);
|
||||||
|
|
||||||
|
|
||||||
@Select(value = {" <script>" +
|
@Select(value = {" <script>" +
|
||||||
|
|
|
@ -89,9 +89,7 @@ public interface IDeviceChannelService {
|
||||||
|
|
||||||
void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition);
|
void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition);
|
||||||
|
|
||||||
void startPlay(String deviceId, String channelId, String stream);
|
void startPlay(Integer channelId, String stream);
|
||||||
|
|
||||||
void stopPlay(String deviceId, String channelId);
|
|
||||||
|
|
||||||
void stopPlay(Integer channelId);
|
void stopPlay(Integer channelId);
|
||||||
|
|
||||||
|
|
|
@ -25,27 +25,27 @@ public interface IPlayService {
|
||||||
ErrorCallback<StreamInfo> callback);
|
ErrorCallback<StreamInfo> callback);
|
||||||
SSRCInfo play(MediaServer mediaServerItem, String deviceId, String channelId, String ssrc, ErrorCallback<StreamInfo> callback);
|
SSRCInfo play(MediaServer mediaServerItem, String deviceId, String channelId, String ssrc, ErrorCallback<StreamInfo> callback);
|
||||||
|
|
||||||
StreamInfo onPublishHandlerForPlay(MediaServer mediaServerItem, MediaInfo mediaInfo, String deviceId, String channelId);
|
StreamInfo onPublishHandlerForPlay(MediaServer mediaServerItem, MediaInfo mediaInfo, Device device, DeviceChannel channel);
|
||||||
|
|
||||||
MediaServer getNewMediaServerItem(Device device);
|
MediaServer getNewMediaServerItem(Device device);
|
||||||
|
|
||||||
void playBack(String deviceId, String channelId, String startTime, String endTime, ErrorCallback<StreamInfo> callback);
|
void playBack(Device device, DeviceChannel channel, String startTime, String endTime, ErrorCallback<StreamInfo> callback);
|
||||||
void zlmServerOffline(String mediaServerId);
|
void zlmServerOffline(String mediaServerId);
|
||||||
|
|
||||||
void download(String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
|
void download(Device device, DeviceChannel channel, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
|
||||||
void download(MediaServer mediaServerItem, SSRCInfo ssrcInfo, String deviceId, String channelId, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
|
void download(MediaServer mediaServerItem, SSRCInfo ssrcInfo, Device device, DeviceChannel channel, String startTime, String endTime, int downloadSpeed, ErrorCallback<StreamInfo> callback);
|
||||||
|
|
||||||
StreamInfo getDownLoadInfo(String deviceId, String channelId, String stream);
|
StreamInfo getDownLoadInfo(Device deviceId, DeviceChannel channelId, String stream);
|
||||||
|
|
||||||
void zlmServerOnline(String mediaServerId);
|
void zlmServerOnline(String mediaServerId);
|
||||||
|
|
||||||
AudioBroadcastResult audioBroadcast(Device device, String channelId, Boolean broadcastMode);
|
AudioBroadcastResult audioBroadcast(Device device, String channelId, Boolean broadcastMode);
|
||||||
|
|
||||||
boolean audioBroadcastCmd(Device device, String channelId, MediaServer mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException;
|
boolean audioBroadcastCmd(Device device, DeviceChannel channelId, MediaServer mediaServerItem, String app, String stream, int timeout, boolean isFromPlatform, AudioBroadcastEvent event) throws InvalidArgumentException, ParseException, SipException;
|
||||||
|
|
||||||
boolean audioBroadcastInUse(Device device, String channelId);
|
boolean audioBroadcastInUse(Device device, DeviceChannel channelId);
|
||||||
|
|
||||||
void stopAudioBroadcast(String deviceId, String channelId);
|
void stopAudioBroadcast(Device deviceId, DeviceChannel channelId);
|
||||||
|
|
||||||
void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
void pauseRtp(String streamId) throws ServiceException, InvalidArgumentException, ParseException, SipException;
|
||||||
|
|
||||||
|
@ -55,13 +55,13 @@ public interface IPlayService {
|
||||||
|
|
||||||
void startSendRtpStreamFailHand(SendRtpInfo sendRtpItem, Platform platform, CallIdHeader callIdHeader);
|
void startSendRtpStreamFailHand(SendRtpInfo sendRtpItem, Platform platform, CallIdHeader callIdHeader);
|
||||||
|
|
||||||
void talkCmd(Device device, String channelId, MediaServer mediaServerItem, String stream, AudioBroadcastEvent event);
|
void talkCmd(Device device, DeviceChannel channel, MediaServer mediaServerItem, String stream, AudioBroadcastEvent event);
|
||||||
|
|
||||||
void stopTalk(Device device, String channelId, Boolean streamIsReady);
|
void stopTalk(Device device, DeviceChannel channel, Boolean streamIsReady);
|
||||||
|
|
||||||
void getSnap(String deviceId, String channelId, String fileName, ErrorCallback errorCallback);
|
void getSnap(String deviceId, String channelId, String fileName, ErrorCallback errorCallback);
|
||||||
|
|
||||||
void stopPlay(Device device, String channelId);
|
void stopPlay(Device device, DeviceChannel channel);
|
||||||
|
|
||||||
void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback);
|
void play(CommonGBChannel channel, ErrorCallback<StreamInfo> callback);
|
||||||
|
|
||||||
|
|
|
@ -362,21 +362,8 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startPlay(String deviceId, String channelId, String stream) {
|
public void startPlay(Integer channelId, String stream) {
|
||||||
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
|
channelMapper.startPlay(channelId, stream);
|
||||||
if (device == null) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备: " +deviceId);
|
|
||||||
}
|
|
||||||
channelMapper.startPlay(device.getId(), channelId, stream);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void stopPlay(String deviceId, String channelId) {
|
|
||||||
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
|
|
||||||
if (device == null) {
|
|
||||||
throw new ControllerException(ErrorCode.ERROR100.getCode(), "未找到设备: " +deviceId);
|
|
||||||
}
|
|
||||||
channelMapper.stopPlay(device.getId(), channelId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.genersoft.iot.vmp.gb28181.dao.PlatformChannelMapper;
|
||||||
import com.genersoft.iot.vmp.gb28181.dao.PlatformMapper;
|
import com.genersoft.iot.vmp.gb28181.dao.PlatformMapper;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
import com.genersoft.iot.vmp.gb28181.event.EventPublisher;
|
||||||
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
import com.genersoft.iot.vmp.gb28181.event.SipSubscribe;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
|
import com.genersoft.iot.vmp.gb28181.service.IInviteStreamService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
||||||
|
@ -98,7 +99,7 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
private PlatformChannelMapper platformChannelMapper;
|
private PlatformChannelMapper platformChannelMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EventPublisher eventPublisher;
|
private IGbChannelService channelService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流离开的处理
|
* 流离开的处理
|
||||||
|
@ -112,10 +113,11 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
if (sendRtpItem != null && sendRtpItem.getApp().equals(event.getApp())) {
|
if (sendRtpItem != null && sendRtpItem.getApp().equals(event.getApp())) {
|
||||||
String platformId = sendRtpItem.getPlatformId();
|
String platformId = sendRtpItem.getPlatformId();
|
||||||
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
Platform platform = platformMapper.getParentPlatByServerGBId(platformId);
|
||||||
|
CommonGBChannel channel = channelService.getOne(sendRtpItem.getChannelId());
|
||||||
try {
|
try {
|
||||||
if (platform != null) {
|
if (platform != null && channel != null) {
|
||||||
commanderForPlatform.streamByeCmd(platform, sendRtpItem);
|
commanderForPlatform.streamByeCmd(platform, sendRtpItem, channel);
|
||||||
redisCatchStorage.deleteSendRTPServer(platformId, sendRtpItem.getChannelId(),
|
redisCatchStorage.deleteSendRTPServer(platformId, channel.getGbDeviceId(),
|
||||||
sendRtpItem.getCallId(), sendRtpItem.getStream());
|
sendRtpItem.getCallId(), sendRtpItem.getStream());
|
||||||
}
|
}
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
@ -137,9 +139,10 @@ public class PlatformServiceImpl implements IPlatformService {
|
||||||
if (sendRtpItems != null && !sendRtpItems.isEmpty()) {
|
if (sendRtpItems != null && !sendRtpItems.isEmpty()) {
|
||||||
for (SendRtpInfo sendRtpItem : sendRtpItems) {
|
for (SendRtpInfo sendRtpItem : sendRtpItems) {
|
||||||
Platform platform = platformMapper.getParentPlatByServerGBId(sendRtpItem.getPlatformId());
|
Platform platform = platformMapper.getParentPlatByServerGBId(sendRtpItem.getPlatformId());
|
||||||
|
CommonGBChannel channel = channelService.getOne(sendRtpItem.getChannelId());
|
||||||
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
|
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
|
||||||
try {
|
try {
|
||||||
commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
|
commanderForPlatform.streamByeCmd(platform, sendRtpItem, channel);
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
log.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
log.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,10 @@
|
||||||
package com.genersoft.iot.vmp.gb28181.task;
|
package com.genersoft.iot.vmp.gb28181.task;
|
||||||
|
|
||||||
|
import com.genersoft.iot.vmp.gb28181.bean.CommonGBChannel;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpInfo;
|
import com.genersoft.iot.vmp.gb28181.bean.SendRtpInfo;
|
||||||
|
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
import com.genersoft.iot.vmp.gb28181.session.SSRCFactory;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
|
@ -48,6 +50,9 @@ public class SipRunner implements CommandLineRunner {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPlatformService platformService;
|
private IPlatformService platformService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IGbChannelService channelService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISIPCommanderForPlatform commanderForPlatform;
|
private ISIPCommanderForPlatform commanderForPlatform;
|
||||||
|
|
||||||
|
@ -67,11 +72,11 @@ public class SipRunner implements CommandLineRunner {
|
||||||
// 清理redis
|
// 清理redis
|
||||||
// 清理数据库不存在但是redis中存在的数据
|
// 清理数据库不存在但是redis中存在的数据
|
||||||
List<Device> devicesInDb = deviceService.getAll();
|
List<Device> devicesInDb = deviceService.getAll();
|
||||||
if (devicesInDb.size() == 0) {
|
if (devicesInDb.isEmpty()) {
|
||||||
redisCatchStorage.removeAllDevice();
|
redisCatchStorage.removeAllDevice();
|
||||||
}else {
|
}else {
|
||||||
List<Device> devicesInRedis = redisCatchStorage.getAllDevices();
|
List<Device> devicesInRedis = redisCatchStorage.getAllDevices();
|
||||||
if (devicesInRedis.size() > 0) {
|
if (!devicesInRedis.isEmpty()) {
|
||||||
Map<String, Device> deviceMapInDb = new HashMap<>();
|
Map<String, Device> deviceMapInDb = new HashMap<>();
|
||||||
devicesInDb.parallelStream().forEach(device -> {
|
devicesInDb.parallelStream().forEach(device -> {
|
||||||
deviceMapInDb.put(device.getDeviceId(), device);
|
deviceMapInDb.put(device.getDeviceId(), device);
|
||||||
|
@ -87,18 +92,23 @@ public class SipRunner implements CommandLineRunner {
|
||||||
|
|
||||||
// 查找国标推流
|
// 查找国标推流
|
||||||
List<SendRtpInfo> sendRtpItems = redisCatchStorage.queryAllSendRTPServer();
|
List<SendRtpInfo> sendRtpItems = redisCatchStorage.queryAllSendRTPServer();
|
||||||
if (sendRtpItems.size() > 0) {
|
if (!sendRtpItems.isEmpty()) {
|
||||||
for (SendRtpInfo sendRtpItem : sendRtpItems) {
|
for (SendRtpInfo sendRtpItem : sendRtpItems) {
|
||||||
MediaServer mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
MediaServer mediaServerItem = mediaServerService.getOne(sendRtpItem.getMediaServerId());
|
||||||
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(),sendRtpItem.getChannelId(), sendRtpItem.getCallId(),sendRtpItem.getStream());
|
CommonGBChannel channel = channelService.getOne(sendRtpItem.getChannelId());
|
||||||
|
if (channel == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(),channel.getGbDeviceId(), sendRtpItem.getCallId(),sendRtpItem.getStream());
|
||||||
if (mediaServerItem != null) {
|
if (mediaServerItem != null) {
|
||||||
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
|
ssrcFactory.releaseSsrc(sendRtpItem.getMediaServerId(), sendRtpItem.getSsrc());
|
||||||
boolean stopResult = mediaServerService.initStopSendRtp(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc());
|
boolean stopResult = mediaServerService.initStopSendRtp(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getSsrc());
|
||||||
if (stopResult) {
|
if (stopResult) {
|
||||||
Platform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
|
Platform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId());
|
||||||
|
|
||||||
if (platform != null) {
|
if (platform != null) {
|
||||||
try {
|
try {
|
||||||
commanderForPlatform.streamByeCmd(platform, sendRtpItem.getCallId());
|
commanderForPlatform.streamByeCmd(platform, sendRtpItem, channel);
|
||||||
} catch (InvalidArgumentException | ParseException | SipException e) {
|
} catch (InvalidArgumentException | ParseException | SipException e) {
|
||||||
log.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
log.error("[命令发送失败] 国标级联 发送BYE: {}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,7 +150,7 @@ public interface ISIPCommanderForPlatform {
|
||||||
*/
|
*/
|
||||||
void streamByeCmd(Platform platform, String callId) throws SipException, InvalidArgumentException, ParseException;
|
void streamByeCmd(Platform platform, String callId) throws SipException, InvalidArgumentException, ParseException;
|
||||||
|
|
||||||
void streamByeCmd(Platform platform, SendRtpInfo sendRtpItem) 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 stream, String callId, SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException, SsrcTransactionNotFoundException;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.SipConfig;
|
import com.genersoft.iot.vmp.conf.SipConfig;
|
||||||
import com.genersoft.iot.vmp.gb28181.SipLayer;
|
import com.genersoft.iot.vmp.gb28181.SipLayer;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.Platform;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpInfo;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SipTransactionInfo;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
import com.genersoft.iot.vmp.gb28181.utils.SipUtils;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.utils.GitUtil;
|
import com.genersoft.iot.vmp.utils.GitUtil;
|
||||||
|
@ -269,7 +266,7 @@ public class SIPRequestHeaderPlarformProvider {
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SIPRequest createByeRequest(Platform platform, SendRtpInfo sendRtpItem) throws PeerUnavailableException, ParseException, InvalidArgumentException {
|
public SIPRequest createByeRequest(Platform platform, SendRtpInfo sendRtpItem, CommonGBChannel channel) throws PeerUnavailableException, ParseException, InvalidArgumentException {
|
||||||
|
|
||||||
if (sendRtpItem == null ) {
|
if (sendRtpItem == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -285,7 +282,7 @@ public class SIPRequestHeaderPlarformProvider {
|
||||||
viaHeader.setRPort();
|
viaHeader.setRPort();
|
||||||
viaHeaders.add(viaHeader);
|
viaHeaders.add(viaHeader);
|
||||||
// from
|
// from
|
||||||
SipURI fromSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(sendRtpItem.getChannelId(),
|
SipURI fromSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(channel.getGbDeviceId(),
|
||||||
platform.getDeviceIp() + ":" + platform.getDevicePort());
|
platform.getDeviceIp() + ":" + platform.getDevicePort());
|
||||||
Address fromAddress = SipFactory.getInstance().createAddressFactory().createAddress(fromSipURI);
|
Address fromAddress = SipFactory.getInstance().createAddressFactory().createAddress(fromSipURI);
|
||||||
FromHeader fromHeader = SipFactory.getInstance().createHeaderFactory().createFromHeader(fromAddress, sendRtpItem.getToTag());
|
FromHeader fromHeader = SipFactory.getInstance().createHeaderFactory().createFromHeader(fromAddress, sendRtpItem.getToTag());
|
||||||
|
|
|
@ -627,12 +627,12 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
}
|
}
|
||||||
SendRtpInfo sendRtpItem = redisCatchStorage.querySendRTPServer(platform.getServerGBId(), null, null, callId);
|
SendRtpInfo sendRtpItem = redisCatchStorage.querySendRTPServer(platform.getServerGBId(), null, null, callId);
|
||||||
if (sendRtpItem != null) {
|
if (sendRtpItem != null) {
|
||||||
streamByeCmd(platform, sendRtpItem);
|
streamByeCmd(platform, sendRtpItem, );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void streamByeCmd(Platform platform, SendRtpInfo sendRtpItem) throws SipException, InvalidArgumentException, ParseException {
|
public synchronized void streamByeCmd(Platform platform, SendRtpInfo sendRtpItem, CommonGBChannel channel) throws SipException, InvalidArgumentException, ParseException {
|
||||||
if (sendRtpItem == null ) {
|
if (sendRtpItem == null ) {
|
||||||
log.info("[向上级发送BYE], sendRtpItem 为NULL");
|
log.info("[向上级发送BYE], sendRtpItem 为NULL");
|
||||||
return;
|
return;
|
||||||
|
@ -648,7 +648,7 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform {
|
||||||
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc());
|
mediaServerService.releaseSsrc(mediaServerItem.getId(), sendRtpItem.getSsrc());
|
||||||
mediaServerService.closeRTPServer(mediaServerItem, sendRtpItem.getStream());
|
mediaServerService.closeRTPServer(mediaServerItem, sendRtpItem.getStream());
|
||||||
}
|
}
|
||||||
SIPRequest byeRequest = headerProviderPlatformProvider.createByeRequest(platform, sendRtpItem);
|
SIPRequest byeRequest = headerProviderPlatformProvider.createByeRequest(platform, sendRtpItem, channel);
|
||||||
if (byeRequest == null) {
|
if (byeRequest == null) {
|
||||||
log.warn("[向上级发送bye]:无法创建 byeRequest");
|
log.warn("[向上级发送bye]:无法创建 byeRequest");
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,10 +217,9 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In
|
||||||
case PLAY:
|
case PLAY:
|
||||||
case PLAYBACK:
|
case PLAYBACK:
|
||||||
case DOWNLOAD:
|
case DOWNLOAD:
|
||||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY,
|
InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, channel.getId());
|
||||||
device.getDeviceId(), channel.getDeviceId());
|
|
||||||
if (inviteInfo != null) {
|
if (inviteInfo != null) {
|
||||||
deviceChannelService.stopPlay(ssrcTransaction.getDeviceId(), channel.getDeviceId());
|
deviceChannelService.stopPlay(channel.getId());
|
||||||
inviteStreamService.removeInviteInfo(inviteInfo);
|
inviteStreamService.removeInviteInfo(inviteInfo);
|
||||||
if (inviteInfo.getStreamInfo() != null) {
|
if (inviteInfo.getStreamInfo() != null) {
|
||||||
mediaServerService.closeRTPServer(inviteInfo.getStreamInfo().getMediaServer(), inviteInfo.getStreamInfo().getStream());
|
mediaServerService.closeRTPServer(inviteInfo.getStreamInfo().getMediaServer(), inviteInfo.getStreamInfo().getStream());
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.*;
|
import com.genersoft.iot.vmp.gb28181.bean.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IGbChannelService;
|
import com.genersoft.iot.vmp.gb28181.service.*;
|
||||||
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
|
import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform;
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent;
|
||||||
|
@ -10,9 +10,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag
|
||||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
|
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler;
|
||||||
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
import com.genersoft.iot.vmp.media.bean.MediaServer;
|
||||||
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
import com.genersoft.iot.vmp.media.service.IMediaServerService;
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IDeviceService;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlatformService;
|
|
||||||
import com.genersoft.iot.vmp.gb28181.service.IPlayService;
|
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||||
import gov.nist.javax.sip.message.SIPRequest;
|
import gov.nist.javax.sip.message.SIPRequest;
|
||||||
|
@ -58,6 +55,9 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
@Autowired
|
@Autowired
|
||||||
private IDeviceService deviceService;
|
private IDeviceService deviceService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDeviceChannelService deviceChannelService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPlatformService platformService;
|
private IPlatformService platformService;
|
||||||
|
|
||||||
|
@ -110,10 +110,15 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
responseAck(request, Response.NOT_FOUND, "device not found");
|
responseAck(request, Response.NOT_FOUND, "device not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
DeviceChannel deviceChannel = deviceChannelService.getOneById(channel.getGbId());
|
||||||
|
if (deviceChannel == null) {
|
||||||
|
responseAck(request, Response.NOT_FOUND, "channel not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
responseAck(request, Response.OK);
|
responseAck(request, Response.OK);
|
||||||
|
|
||||||
// 查看语音通道是否已经建立并且已经在使用
|
// 查看语音通道是否已经建立并且已经在使用
|
||||||
if (playService.audioBroadcastInUse(device, targetId)) {
|
if (playService.audioBroadcastInUse(device, deviceChannel)) {
|
||||||
commanderForPlatform.broadcastResultCmd(platform, channel, sn, false,null, null);
|
commanderForPlatform.broadcastResultCmd(platform, channel, sn, false,null, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -129,7 +134,8 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
// 上级平台推流成功
|
// 上级平台推流成功
|
||||||
AudioBroadcastCatch broadcastCatch = audioBroadcastManager.get(channel.getGbId());
|
AudioBroadcastCatch broadcastCatch = audioBroadcastManager.get(channel.getGbId());
|
||||||
if (broadcastCatch != null ) {
|
if (broadcastCatch != null ) {
|
||||||
if (playService.audioBroadcastInUse(device, targetId)) {
|
|
||||||
|
if (playService.audioBroadcastInUse(device, deviceChannel)) {
|
||||||
log.info("[国标级联] 语音喊话 设备正在使用中 platform: {}, channel: {}",
|
log.info("[国标级联] 语音喊话 设备正在使用中 platform: {}, channel: {}",
|
||||||
platform.getServerGBId(), channel.getGbDeviceId());
|
platform.getServerGBId(), channel.getGbDeviceId());
|
||||||
// 查看语音通道已经建立且已经占用 回复BYE
|
// 查看语音通道已经建立且已经占用 回复BYE
|
||||||
|
@ -146,7 +152,7 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
log.warn("[国标级联] 语音喊话 异常,未找到发流信息, channelId: {}, stream: {}", targetId, hookData.getStream());
|
log.warn("[国标级联] 语音喊话 异常,未找到发流信息, channelId: {}, stream: {}", targetId, hookData.getStream());
|
||||||
log.info("[国标级联] 语音喊话 重新开始,channelId: {}, stream: {}", targetId, hookData.getStream());
|
log.info("[国标级联] 语音喊话 重新开始,channelId: {}, stream: {}", targetId, hookData.getStream());
|
||||||
try {
|
try {
|
||||||
playService.audioBroadcastCmd(device, targetId, hookData.getMediaServer(), hookData.getApp(), hookData.getStream(), 60, true, msg -> {
|
playService.audioBroadcastCmd(device, deviceChannel, hookData.getMediaServer(), hookData.getApp(), hookData.getStream(), 60, true, msg -> {
|
||||||
log.info("[语音喊话] 通道建立成功, device: {}, channel: {}", device.getDeviceId(), targetId);
|
log.info("[语音喊话] 通道建立成功, device: {}, channel: {}", device.getDeviceId(), targetId);
|
||||||
});
|
});
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
@ -165,7 +171,7 @@ public class BroadcastNotifyMessageHandler extends SIPRequestProcessorParent imp
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
try {
|
try {
|
||||||
playService.audioBroadcastCmd(device, targetId, hookData.getMediaServer(), hookData.getApp(), hookData.getStream(), 60, true, msg -> {
|
playService.audioBroadcastCmd(device, deviceChannel, hookData.getMediaServer(), hookData.getApp(), hookData.getStream(), 60, true, msg -> {
|
||||||
log.info("[语音喊话] 通道建立成功, device: {}, channel: {}", device.getDeviceId(), targetId);
|
log.info("[语音喊话] 通道建立成功, device: {}, channel: {}", device.getDeviceId(), targetId);
|
||||||
});
|
});
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class MediaStatusNotifyMessageHandler extends SIPRequestProcessorParent i
|
||||||
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByCallId(callIdHeader.getCallId());
|
SsrcTransaction ssrcTransaction = sessionManager.getSsrcTransactionByCallId(callIdHeader.getCallId());
|
||||||
if (ssrcTransaction != null) {
|
if (ssrcTransaction != null) {
|
||||||
log.info("[录像流]推送完毕,关流通知, device: {}, channelId: {}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
|
log.info("[录像流]推送完毕,关流通知, device: {}, channelId: {}", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
|
||||||
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
|
InviteInfo inviteInfo = inviteStreamService.getInviteInfo(InviteSessionType.DOWNLOAD, ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
|
||||||
if (inviteInfo.getStreamInfo() != null) {
|
if (inviteInfo.getStreamInfo() != null) {
|
||||||
inviteInfo.getStreamInfo().setProgress(1);
|
inviteInfo.getStreamInfo().setProgress(1);
|
||||||
inviteStreamService.updateInviteInfo(inviteInfo);
|
inviteStreamService.updateInviteInfo(inviteInfo);
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class ApiStreamController {
|
||||||
resultJSON.put("error","timeout");
|
resultJSON.put("error","timeout");
|
||||||
result.setResult(resultJSON);
|
result.setResult(resultJSON);
|
||||||
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceChannel.getId());
|
inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceChannel.getId());
|
||||||
deviceChannelService.stopPlay(serial, code);
|
deviceChannelService.stopPlay(deviceChannel.getId());
|
||||||
// 清理RTP server
|
// 清理RTP server
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue