| | |
| | | import com.genersoft.iot.vmp.conf.DynamicTask; |
| | | import com.genersoft.iot.vmp.conf.SipConfig; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.session.AudioBroadcastManager; |
| | | import com.genersoft.iot.vmp.gb28181.session.SSRCFactory; |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| | | import com.genersoft.iot.vmp.media.bean.MediaInfo; |
| | | import com.genersoft.iot.vmp.media.bean.MediaServer; |
| | | import com.genersoft.iot.vmp.media.event.hook.Hook; |
| | | import com.genersoft.iot.vmp.media.event.hook.HookSubscribe; |
| | | import com.genersoft.iot.vmp.media.event.hook.HookType; |
| | | import com.genersoft.iot.vmp.media.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IPlayService; |
| | | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | | import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; |
| | | import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| | | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| | | import com.genersoft.iot.vmp.service.*; |
| | | import com.genersoft.iot.vmp.service.bean.ErrorCallback; |
| | | import com.genersoft.iot.vmp.service.bean.InviteErrorCode; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| | | import com.genersoft.iot.vmp.service.redisMsg.RedisPushStreamResponseListener; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.InitializingBean; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.sdp.*; |
| | |
| | | import javax.sip.message.Response; |
| | | import java.text.ParseException; |
| | | import java.time.Instant; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.Random; |
| | | import java.util.Vector; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * SIP命令类型: INVITE请求 |
| | |
| | | private IRedisRpcService redisRpcService; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<Object, Object> redisTemplate; |
| | | |
| | | @Autowired |
| | | private SSRCFactory ssrcFactory; |
| | | |
| | | @Autowired |
| | |
| | | private AudioBroadcastManager audioBroadcastManager; |
| | | |
| | | @Autowired |
| | | private ZLMServerFactory zlmServerFactory; |
| | | |
| | | @Autowired |
| | | private IMediaServerService mediaServerService; |
| | | |
| | | @Autowired |
| | | private ZlmHttpHookSubscribe zlmHttpHookSubscribe; |
| | | private HookSubscribe hookSubscribe; |
| | | |
| | | @Autowired |
| | | private SIPProcessorObserver sipProcessorObserver; |
| | |
| | | |
| | | @Autowired |
| | | private SendRtpPortManager sendRtpPortManager; |
| | | |
| | | @Autowired |
| | | private RedisPushStreamResponseListener redisPushStreamResponseListener; |
| | | |
| | | |
| | | @Override |
| | |
| | | GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId); |
| | | PlatformCatalog catalog = storager.getCatalog(requesterId, channelId); |
| | | |
| | | MediaServerItem mediaServerItem = null; |
| | | MediaServer mediaServerItem = null; |
| | | StreamPushItem streamPushItem = null; |
| | | StreamProxyItem proxyByAppAndStream = null; |
| | | // 不是通道可能是直播流 |
| | |
| | | return; |
| | | } |
| | | String username = sdp.getOrigin().getUsername(); |
| | | String addressStr = sdp.getConnection().getAddress(); |
| | | |
| | | String addressStr; |
| | | if(StringUtils.isEmpty(platform.getSendStreamIp())){ |
| | | addressStr = sdp.getConnection().getAddress(); |
| | | }else { |
| | | addressStr = platform.getSendStreamIp(); |
| | | } |
| | | |
| | | Device device = null; |
| | | // 通过 channel 和 gbStream 是否为null 值判断来源是直播流合适国标 |
| | |
| | | } else { |
| | | streamTypeStr = "UDP"; |
| | | } |
| | | logger.info("[上级Invite] {}, 平台:{}, 通道:{}, 收流地址:{}:{},收流方式:{}, ssrc:{}", sessionName, username, channelId, addressStr, port, streamTypeStr, ssrc); |
| | | SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, |
| | | logger.info("[上级Invite] {}, 平台:{}, 通道:{}, 收流地址:{}:{},收流方式:{}, ssrc:{}", |
| | | sessionName, username, channelId, addressStr, port, streamTypeStr, ssrc); |
| | | SendRtpItem sendRtpItem = mediaServerService.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, |
| | | device.getDeviceId(), channelId, mediaTransmissionTCP, platform.isRtcp()); |
| | | |
| | | if (tcpActive != null) { |
| | |
| | | Long finalStopTime = stopTime; |
| | | ErrorCallback<Object> hookEvent = (code, msg, data) -> { |
| | | StreamInfo streamInfo = (StreamInfo)data; |
| | | MediaServerItem mediaServerItemInUSe = mediaServerService.getOne(streamInfo.getMediaServerId()); |
| | | MediaServer mediaServerItemInUSe = mediaServerService.getOne(streamInfo.getMediaServerId()); |
| | | logger.info("[上级Invite]下级已经开始推流。 回复200OK(SDP), {}/{}", streamInfo.getApp(), streamInfo.getStream()); |
| | | // * 0 等待设备推流上来 |
| | | // * 1 下级已经推流,等待上级平台回复ack |
| | |
| | | responseSdpAck(request, content.toString(), platform); |
| | | // tcp主动模式,回复sdp后开启监听 |
| | | if (sendRtpItem.isTcpActive()) { |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | Map<String, Object> param = new HashMap<>(12); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app",sendRtpItem.getApp()); |
| | | param.put("stream",sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | if (!sendRtpItem.isTcpActive()) { |
| | | param.put("dst_url",sendRtpItem.getIp()); |
| | | param.put("dst_port", sendRtpItem.getPort()); |
| | | } |
| | | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| | | param.put("is_udp", is_Udp); |
| | | param.put("src_port", localPort); |
| | | param.put("pt", sendRtpItem.getPt()); |
| | | param.put("use_ps", sendRtpItem.isUsePs() ? "1" : "0"); |
| | | param.put("only_audio", sendRtpItem.isOnlyAudio() ? "1" : "0"); |
| | | if (!sendRtpItem.isTcp()) { |
| | | // 开启rtcp保活 |
| | | param.put("udp_rtcp_timeout", sendRtpItem.isRtcp()? "1":"0"); |
| | | } |
| | | JSONObject startSendRtpStreamResult = zlmServerFactory.startSendRtpPassive(mediaInfo, param); |
| | | if (startSendRtpStreamResult != null) { |
| | | startSendRtpStreamHand(evt, sendRtpItem, null, startSendRtpStreamResult, param, callIdHeader); |
| | | } |
| | | MediaServer mediaServer = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | try { |
| | | mediaServerService.startSendRtpPassive(mediaServer, sendRtpItem, 5); |
| | | redisCatchStorage.sendPlatformStartPlayMsg(sendRtpItem, platform); |
| | | }catch (ControllerException e) {} |
| | | } |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 回复SdpAck", e); |
| | | } |
| | | }; |
| | | ErrorCallback<Object> errorEvent = ((statusCode, msg, data) -> { |
| | | logger.info("[上级Invite] {}, 失败, 平台:{}, 通道:{}, code: {}, msg;{}", sessionName, username, channelId, statusCode, msg); |
| | | // 未知错误。直接转发设备点播的错误 |
| | | try { |
| | | if (statusCode > 0) { |
| | | Response response = getMessageFactory().createResponse(statusCode, evt.getRequest()); |
| | | sipSender.transmitRequest(request.getLocalAddress().getHostAddress(), response); |
| | | } |
| | | Response response = getMessageFactory().createResponse(statusCode, evt.getRequest()); |
| | | sipSender.transmitRequest(request.getLocalAddress().getHostAddress(), response); |
| | | } catch (ParseException | SipException e) { |
| | | logger.error("未处理的异常 ", e); |
| | | } |
| | |
| | | String startTimeStr = DateUtil.urlFormatter.format(start); |
| | | String endTimeStr = DateUtil.urlFormatter.format(end); |
| | | String stream = device.getDeviceId() + "_" + channelId + "_" + startTimeStr + "_" + endTimeStr; |
| | | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null, device.isSsrcCheck(), true, 0,false, false, device.getStreamModeForParam()); |
| | | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, stream, null, device.isSsrcCheck(), true, 0,false,!channel.getHasAudio(), false, device.getStreamModeForParam()); |
| | | sendRtpItem.setStream(stream); |
| | | // 写入redis, 超时时回复 |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | |
| | | } |
| | | |
| | | sendRtpItem.setPlayType(InviteStreamType.DOWNLOAD); |
| | | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false, false, device.getStreamModeForParam()); |
| | | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, null, device.isSsrcCheck(), true, 0, false,!channel.getHasAudio(), false, device.getStreamModeForParam()); |
| | | sendRtpItem.setStream(ssrcInfo.getStream()); |
| | | // 写入redis, 超时时回复 |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | |
| | | sendRtpItem.setOnlyAudio(false); |
| | | sendRtpItem.setStatus(0); |
| | | sendRtpItem.setSessionName(sessionName); |
| | | |
| | | // 清理可能存在的缓存避免用到旧的数据 |
| | | List<SendRtpItem> sendRtpItemList = redisCatchStorage.querySendRTPServer(platform.getServerGBId(), channelId, gbStream.getStream()); |
| | | if (!sendRtpItemList.isEmpty()) { |
| | | for (SendRtpItem rtpItem : sendRtpItemList) { |
| | | redisCatchStorage.deleteSendRTPServer(rtpItem); |
| | | } |
| | | } |
| | | if ("push".equals(gbStream.getStreamType())) { |
| | | sendRtpItem.setPlayType(InviteStreamType.PUSH); |
| | | if (streamPushItem != null) { |
| | | // 从redis查询是否正在接收这个推流 |
| | | OnStreamChangedHookParam pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream()); |
| | | StreamPushItem pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream()); |
| | | if (pushListItem != null) { |
| | | sendRtpItem.setServerId(pushListItem.getSeverId()); |
| | | sendRtpItem.setServerId(pushListItem.getServerId()); |
| | | sendRtpItem.setMediaServerId(pushListItem.getMediaServerId()); |
| | | |
| | | StreamPushItem transform = streamPushService.transform(pushListItem); |
| | | transform.setSelf(userSetting.getServerId().equals(pushListItem.getSeverId())); |
| | | pushListItem.setSelf(userSetting.getServerId().equals(pushListItem.getServerId())); |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | // 开始推流 |
| | | sendPushStream(sendRtpItem, mediaServerItem, platform, request); |
| | | }else { |
| | |
| | | /** |
| | | * 安排推流 |
| | | */ |
| | | private void sendProxyStream(SendRtpItem sendRtpItem, MediaServerItem mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (streamReady != null && streamReady) { |
| | | private void sendProxyStream(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | MediaInfo mediaInfo = mediaServerService.getMediaInfo(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | |
| | | if (mediaInfo != null) { |
| | | |
| | | // 自平台内容 |
| | | int localPort = sendRtpPortManager.getNextPort(mediaServerItem); |
| | | if (localPort == 0) { |
| | |
| | | } |
| | | } |
| | | |
| | | private void sendPushStream(SendRtpItem sendRtpItem, MediaServerItem mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | private void sendPushStream(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | // 推流 |
| | | if (sendRtpItem.getServerId().equals(userSetting.getServerId())) { |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (streamReady != null && streamReady) { |
| | | MediaInfo mediaInfo = mediaServerService.getMediaInfo(mediaServerItem, sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (mediaInfo != null ) { |
| | | // 自平台内容 |
| | | int localPort = sendRtpPortManager.getNextPort(mediaServerItem); |
| | | if (localPort == 0) { |
| | |
| | | /** |
| | | * 通知流上线 |
| | | */ |
| | | private void notifyProxyStreamOnline(SendRtpItem sendRtpItem, MediaServerItem mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | private void notifyProxyStreamOnline(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | // TODO 控制启用以使设备上线 |
| | | logger.info("[ app={}, stream={} ]通道未推流,启用流后开始推流", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | // 监听流上线 |
| | | HookSubscribeForStreamChange hookSubscribe = HookSubscribeFactory.on_stream_changed(sendRtpItem.getApp(), sendRtpItem.getStream(), true, "rtsp", mediaServerItem.getId()); |
| | | zlmHttpHookSubscribe.addSubscribe(hookSubscribe, (mediaServerItemInUSe, hookParam) -> { |
| | | OnStreamChangedHookParam streamChangedHookParam = (OnStreamChangedHookParam)hookParam; |
| | | logger.info("[上级点播]拉流代理已经就绪, {}/{}", streamChangedHookParam.getApp(), streamChangedHookParam.getStream()); |
| | | Hook hook = Hook.getInstance(HookType.on_media_arrival, sendRtpItem.getApp(), sendRtpItem.getStream(), mediaServerItem.getId()); |
| | | hookSubscribe.addSubscribe(hook, (hookData)->{ |
| | | logger.info("[上级点播]拉流代理已经就绪, {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | dynamicTask.stop(sendRtpItem.getCallId()); |
| | | sendProxyStream(sendRtpItem, mediaServerItem, platform, request); |
| | | }); |
| | | dynamicTask.startDelay(sendRtpItem.getCallId(), () -> { |
| | | logger.info("[ app={}, stream={} ] 等待拉流代理流超时", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | zlmHttpHookSubscribe.removeSubscribe(hookSubscribe); |
| | | hookSubscribe.removeSubscribe(hook); |
| | | }, userSetting.getPlatformPlayTimeout()); |
| | | boolean start = streamProxyService.start(sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (!start) { |
| | |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] invite 通道未推流: {}", e.getMessage()); |
| | | } |
| | | zlmHttpHookSubscribe.removeSubscribe(hookSubscribe); |
| | | hookSubscribe.removeSubscribe(hook); |
| | | dynamicTask.stop(sendRtpItem.getCallId()); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 通知流上线 |
| | | */ |
| | | private void notifyPushStreamOnline(SendRtpItem sendRtpItem, MediaServerItem mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | private void notifyPushStreamOnline(SendRtpItem sendRtpItem, MediaServer mediaServerItem, ParentPlatform platform, SIPRequest request) { |
| | | // 发送redis消息以使设备上线,流上线后被 |
| | | logger.info("[ app={}, stream={} ]通道未推流,发送redis信息控制设备开始推流", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(1, |
| | |
| | | redisCatchStorage.sendStreamPushRequestedMsg(messageForPushChannel); |
| | | // 设置超时 |
| | | dynamicTask.startDelay(sendRtpItem.getCallId(), () -> { |
| | | redisRpcService.stopWaitePushStreamOnline(sendRtpItem); |
| | | logger.info("[ app={}, stream={} ] 等待设备开始推流超时", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | try { |
| | | responseAck(request, Response.REQUEST_TIMEOUT); // 超时 |
| | |
| | | } |
| | | }, userSetting.getPlatformPlayTimeout()); |
| | | // |
| | | redisRpcService.waitePushStreamOnline(sendRtpItem, (sendRtpItemFromRedis) -> { |
| | | long key = redisRpcService.waitePushStreamOnline(sendRtpItem, (sendRtpItemKey) -> { |
| | | dynamicTask.stop(sendRtpItem.getCallId()); |
| | | if (sendRtpItemKey == null) { |
| | | logger.warn("[级联点播] 等待推流得到结果未空: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | try { |
| | | responseAck(request, Response.BUSY_HERE); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("未处理的异常 ", e); |
| | | } |
| | | return; |
| | | } |
| | | SendRtpItem sendRtpItemFromRedis = (SendRtpItem)redisTemplate.opsForValue().get(sendRtpItemKey); |
| | | if (sendRtpItemFromRedis == null) { |
| | | logger.warn("[级联点播] 等待推流, 未找到redis中缓存的发流信息: {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | try { |
| | | responseAck(request, Response.BUSY_HERE); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("未处理的异常 ", e); |
| | | } |
| | | return; |
| | | } |
| | | if (sendRtpItemFromRedis.getServerId().equals(userSetting.getServerId())) { |
| | | |
| | | logger.info("[级联点播] 等待的推流在本平台上线 {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | int localPort = sendRtpPortManager.getNextPort(mediaServerItem); |
| | | if (localPort == 0) { |
| | | logger.warn("上级点时创建sendRTPItem失败,可能是服务器端口资源不足"); |
| | | try { |
| | | responseAck(request, Response.BUSY_HERE); |
| | | } catch (SipException e) { |
| | | logger.error("未处理的异常 ", e); |
| | | } catch (InvalidArgumentException e) { |
| | | logger.error("未处理的异常 ", e); |
| | | } catch (ParseException e) { |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("未处理的异常 ", e); |
| | | } |
| | | return; |
| | |
| | | // 其他平台内容 |
| | | otherWvpPushStream(sendRtpItemFromRedis, request, platform); |
| | | } |
| | | |
| | | }); |
| | | // 添加回复的拒绝或者错误的通知 |
| | | // redis消息例如: PUBLISH VM_MSG_STREAM_PUSH_RESPONSE '{"code":1,"msg":"失败","app":"1","stream":"2"}' |
| | | redisPushStreamResponseListener.addEvent(sendRtpItem.getApp(), sendRtpItem.getStream(), response -> { |
| | | if (response.getCode() != 0) { |
| | | dynamicTask.stop(sendRtpItem.getCallId()); |
| | | redisRpcService.stopWaitePushStreamOnline(sendRtpItem); |
| | | redisRpcService.removeCallback(key); |
| | | try { |
| | | responseAck(request, Response.TEMPORARILY_UNAVAILABLE, response.getMsg()); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[命令发送失败] 国标级联 点播回复: {}", e.getMessage()); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | |
| | | * 来自其他wvp的推流 |
| | | */ |
| | | private void otherWvpPushStream(SendRtpItem sendRtpItem, SIPRequest request, ParentPlatform platform) { |
| | | logger.info("[级联点播]直播流来自其他平台,发送redis消息"); |
| | | sendRtpItem = redisRpcService.getSendRtpItem(sendRtpItem); |
| | | logger.info("[级联点播] 来自其他wvp的推流 {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | sendRtpItem = redisRpcService.getSendRtpItem(sendRtpItem.getRedisKey()); |
| | | if (sendRtpItem == null) { |
| | | return; |
| | | } |
| | | // 写入redis, 超时时回复 |
| | | sendRtpItem.setStatus(1); |
| | | SIPResponse response = sendStreamAck(request, sendRtpItem, platform); |
| | |
| | | logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}, {}", requesterId, addressStr, port, gb28181Sdp.getSsrc(), |
| | | mediaTransmissionTCP ? (tcpActive ? "TCP主动" : "TCP被动") : "UDP"); |
| | | |
| | | MediaServerItem mediaServerItem = broadcastCatch.getMediaServerItem(); |
| | | MediaServer mediaServerItem = broadcastCatch.getMediaServerItem(); |
| | | if (mediaServerItem == null) { |
| | | logger.warn("未找到语音喊话使用的zlm"); |
| | | try { |
| | |
| | | mediaTransmissionTCP ? (tcpActive ? "TCP主动" : "TCP被动") : "UDP", sdp.getSessionName().getValue()); |
| | | CallIdHeader callIdHeader = (CallIdHeader) request.getHeader(CallIdHeader.NAME); |
| | | |
| | | SendRtpItem sendRtpItem = zlmServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, gb28181Sdp.getSsrc(), requesterId, |
| | | SendRtpItem sendRtpItem = mediaServerService.createSendRtpItem(mediaServerItem, addressStr, port, gb28181Sdp.getSsrc(), requesterId, |
| | | device.getDeviceId(), broadcastCatch.getChannelId(), |
| | | mediaTransmissionTCP, false); |
| | | |
| | |
| | | |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | |
| | | Boolean streamReady = zlmServerFactory.isStreamReady(mediaServerItem, broadcastCatch.getApp(), broadcastCatch.getStream()); |
| | | Boolean streamReady = mediaServerService.isStreamReady(mediaServerItem, broadcastCatch.getApp(), broadcastCatch.getStream()); |
| | | if (streamReady) { |
| | | sendOk(device, sendRtpItem, sdp, request, mediaServerItem, mediaTransmissionTCP, gb28181Sdp.getSsrc()); |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | SIPResponse sendOk(Device device, SendRtpItem sendRtpItem, SessionDescription sdp, SIPRequest request, MediaServerItem mediaServerItem, boolean mediaTransmissionTCP, String ssrc) { |
| | | SIPResponse sendOk(Device device, SendRtpItem sendRtpItem, SessionDescription sdp, SIPRequest request, MediaServer mediaServerItem, boolean mediaTransmissionTCP, String ssrc) { |
| | | SIPResponse sipResponse = null; |
| | | try { |
| | | sendRtpItem.setStatus(2); |