| | |
| | | // 添加流注销的订阅,注销了后向设备发送bye
|
| | | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey,
|
| | | (MediaServerItem mediaServerItemForEnd, JSONObject jsonForEnd)->{
|
| | | logger.info("[录像]下载结束, 发送BYE");
|
| | | streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream(), callIdHeader.getCallId());
|
| | | ClientTransaction transaction = streamSession.getTransaction(device.getDeviceId(), channelId, ssrcInfo.getStream(), callIdHeader.getCallId());
|
| | | if (transaction != null) {
|
| | | logger.info("[录像]下载结束, 发送BYE");
|
| | | streamByeCmd(device.getDeviceId(), channelId, ssrcInfo.getStream(), callIdHeader.getCallId());
|
| | | }
|
| | | });
|
| | | });
|
| | |
|
| | |
| | | }
|
| | | SIPDialog dialog;
|
| | | if (callId != null) {
|
| | | dialog = streamSession.getDialogByCallId(deviceId, channelId, callId);
|
| | | dialog = streamSession.getDialogByCallId(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), callId);
|
| | | }else {
|
| | | if (stream == null) {
|
| | | if (stream == null && ssrcTransaction == null && ssrcTransaction.getStream() == null) {
|
| | | return;
|
| | | }
|
| | | dialog = streamSession.getDialogByStream(deviceId, channelId, stream);
|
| | | dialog = streamSession.getDialogByStream(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
|
| | | }
|
| | | if (ssrcTransaction != null) {
|
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(ssrcTransaction.getMediaServerId());
|
| | | mediaServerService.releaseSsrc(mediaServerItem.getId(), ssrcTransaction.getSsrc());
|
| | | mediaServerService.closeRTPServer(deviceId, channelId, ssrcTransaction.getStream());
|
| | | streamSession.remove(deviceId, channelId, ssrcTransaction.getStream());
|
| | | mediaServerService.closeRTPServer(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
|
| | | streamSession.remove(ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId(), ssrcTransaction.getStream());
|
| | | }
|
| | |
|
| | | if (dialog == null) {
|
| | | logger.warn("[ {} -> {}]停止视频流的时候发现对话已丢失", deviceId, channelId);
|
| | | logger.warn("[ {} -> {}]停止视频流的时候发现对话已丢失", ssrcTransaction.getDeviceId(), ssrcTransaction.getChannelId());
|
| | | return;
|
| | | }
|
| | | SipStack sipStack = udpSipProvider.getSipStack();
|