| | |
| | | @Autowired |
| | | private SipConfig config; |
| | | |
| | | @Autowired |
| | | private SIPCommander cmder; |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Autowired |
| | | private IDeviceService deviceService; |
| | | |
| | | public static Map<String, AudioBroadcastCatch> data = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * 流离开的处理 |
| | | */ |
| | | @Async("taskExecutor") |
| | | @EventListener |
| | | public void onApplicationEvent(MediaDepartureEvent event) { |
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(event.getStream()); |
| | | if (!sendRtpItems.isEmpty()) { |
| | | for (SendRtpItem sendRtpItem : sendRtpItems) { |
| | | if (sendRtpItem != null && sendRtpItem.getApp().equals(event.getApp())) { |
| | | String platformId = sendRtpItem.getPlatformId(); |
| | | Device device = deviceService.getDevice(platformId); |
| | | try { |
| | | if (device != null) { |
| | | cmder.streamByeCmd(device, sendRtpItem.getChannelId(), event.getStream(), sendRtpItem.getCallId()); |
| | | if (sendRtpItem.getPlayType().equals(InviteStreamType.BROADCAST) |
| | | || sendRtpItem.getPlayType().equals(InviteStreamType.TALK)) { |
| | | AudioBroadcastCatch audioBroadcastCatch = get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | if (audioBroadcastCatch != null) { |
| | | // 来自上级平台的停止对讲 |
| | | logger.info("[停止对讲] 来自上级,平台:{}, 通道:{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | } |
| | | } |
| | | } |
| | | } catch (SipException | InvalidArgumentException | ParseException | |
| | | SsrcTransactionNotFoundException e) { |
| | | logger.error("[命令发送失败] 发送BYE: {}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void update(AudioBroadcastCatch audioBroadcastCatch) { |
| | | if (SipUtils.isFrontEnd(audioBroadcastCatch.getDeviceId())) { |
| | |
| | | mediaArrivalEvent.setStream(hookParam.getStream()); |
| | | mediaArrivalEvent.setMediaServer(mediaServer); |
| | | mediaArrivalEvent.setSchema(hookParam.getSchema()); |
| | | mediaArrivalEvent.setCallId(hookParam.getCallId()); |
| | | return mediaArrivalEvent; |
| | | } |
| | | |
| | |
| | | private MediaServer mediaServer; |
| | | |
| | | private String schema; |
| | | |
| | | private String callId; |
| | | |
| | | public MediaInfo getMediaInfo() { |
| | | return mediaInfo; |
| | |
| | | public void setSchema(String schema) { |
| | | this.schema = schema; |
| | | } |
| | | |
| | | public String getCallId() { |
| | | return callId; |
| | | } |
| | | |
| | | public void setCallId(String callId) { |
| | | this.callId = callId; |
| | | } |
| | | } |
| | |
| | | ResultForOnPublish result = new ResultForOnPublish(); |
| | | result.setEnable_audio(true); |
| | | |
| | | |
| | | // 是否录像 |
| | | if ("rtp".equals(app)) { |
| | | result.setEnable_mp4(userSetting.getRecordSip()); |
| | |
| | | @Async("taskExecutor") |
| | | @EventListener |
| | | public void onApplicationEvent(MediaDepartureEvent event) { |
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(event.getStream()); |
| | | if (!sendRtpItems.isEmpty()) { |
| | | for (SendRtpItem sendRtpItem : sendRtpItems) { |
| | | if (sendRtpItem != null && sendRtpItem.getApp().equals(event.getApp())) { |
| | | String platformId = sendRtpItem.getPlatformId(); |
| | | Device device = deviceService.getDevice(platformId); |
| | | try { |
| | | if (device != null) { |
| | | cmder.streamByeCmd(device, sendRtpItem.getChannelId(), event.getStream(), sendRtpItem.getCallId()); |
| | | if (sendRtpItem.getPlayType().equals(InviteStreamType.BROADCAST) |
| | | || sendRtpItem.getPlayType().equals(InviteStreamType.TALK)) { |
| | | AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | if (audioBroadcastCatch != null) { |
| | | // 来自上级平台的停止对讲 |
| | | logger.info("[停止对讲] 来自上级,平台:{}, 通道:{}", sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | audioBroadcastManager.del(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | } |
| | | } |
| | | } |
| | | } catch (SipException | InvalidArgumentException | ParseException | |
| | | SsrcTransactionNotFoundException e) { |
| | | logger.error("[命令发送失败] 发送BYE: {}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if ("broadcast".equals(event.getApp()) || "talk".equals(event.getApp())) { |
| | | if (event.getStream().indexOf("_") > 0) { |
| | | String[] streamArray = event.getStream().split("_"); |
| | |
| | | redisCatchStorage.sendStreamChangeMsg(type, jsonObject); |
| | | } |
| | | } |
| | | GbStream gbStream = storager.getGbStream(event.getApp(), event.getStream()); |
| | | GbStream gbStream = gbStreamMapper.selectOne(event.getApp(), event.getStream()); |
| | | if (gbStream != null) { |
| | | if (userSetting.isUsePushingAsStatus()) { |
| | | storager.mediaOffline(event.getApp(), event.getStream()); |
| | | streamPushMapper.updatePushStatus(event.getApp(), event.getStream(), false); |
| | | eventPublisher.catalogEventPublishForStream(null, gbStream, CatalogEvent.OFF); |
| | | } |
| | | }else { |
| | | storager.removeMedia(event.getApp(), event.getStream()); |
| | | streamPushMapper.del(event.getApp(), event.getStream()); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | import com.genersoft.iot.vmp.media.event.MediaArrivalEvent; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServer; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| | |
| | | |
| | | void sendPlatformStopPlayMsg(MessageForPushChannel messageForPushChannel); |
| | | |
| | | void addPushListItem(String app, String stream, OnStreamChangedHookParam param); |
| | | void addPushListItem(String app, String stream, MediaArrivalEvent param); |
| | | |
| | | void removePushListItem(String app, String stream, String mediaServerId); |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | import com.genersoft.iot.vmp.media.event.MediaArrivalEvent; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServer; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addPushListItem(String app, String stream, OnStreamChangedHookParam param) { |
| | | public void addPushListItem(String app, String stream, MediaArrivalEvent event) { |
| | | String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream; |
| | | redisTemplate.opsForValue().set(key, param); |
| | | redisTemplate.opsForValue().set(key, event); |
| | | } |
| | | |
| | | @Override |