| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd.CatalogResponseMessageHandler; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.bean.MediaServer; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.service.IDeviceService; |
| | | import com.genersoft.iot.vmp.service.IInviteStreamService; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.media.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceMapper; |
| | |
| | | |
| | | @Autowired |
| | | private SIPCommander cmder; |
| | | |
| | | @Autowired |
| | | private DynamicTask dynamicTask; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private AudioBroadcastManager audioBroadcastManager; |
| | | |
| | | @Autowired |
| | | private ZLMRESTfulUtils zlmresTfulUtils; |
| | | |
| | | @Override |
| | | public void online(Device device, SipTransactionInfo sipTransactionInfo) { |
| | |
| | | SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(deviceId, audioBroadcastCatch.getChannelId(), null, null); |
| | | if (sendRtpItem != null) { |
| | | redisCatchStorage.deleteSendRTPServer(deviceId, sendRtpItem.getChannelId(), null, null); |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("vhost", "__defaultVhost__"); |
| | | param.put("app", sendRtpItem.getApp()); |
| | | param.put("stream", sendRtpItem.getStream()); |
| | | zlmresTfulUtils.stopSendRtp(mediaInfo, param); |
| | | MediaServer mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | mediaServerService.stopSendRtp(mediaInfo, sendRtpItem.getApp(), sendRtpItem.getStream(), null); |
| | | } |
| | | |
| | | audioBroadcastManager.del(deviceId, audioBroadcastCatch.getChannelId()); |
| | |
| | | int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForCatalog(),30); |
| | | // 设置最小值为30 |
| | | dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, (subscribeCycleForCatalog -1) * 1000); |
| | | |
| | | catalogSubscribeTask.run(); |
| | | return true; |
| | | } |
| | | |
| | |
| | | int subscribeCycleForCatalog = Math.max(device.getSubscribeCycleForMobilePosition(),30); |
| | | // 刷新订阅 |
| | | dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, subscribeCycleForCatalog * 1000); |
| | | mobilePositionSubscribeTask.run(); |
| | | return true; |
| | | } |
| | | |
| | |
| | | removeMobilePositionSubscribe(deviceInStore, result->{ |
| | | // 开启订阅 |
| | | deviceInStore.setSubscribeCycleForMobilePosition(device.getSubscribeCycleForMobilePosition()); |
| | | deviceInStore.setMobilePositionSubmissionInterval(device.getMobilePositionSubmissionInterval()); |
| | | addMobilePositionSubscribe(deviceInStore); |
| | | // 因为是异步执行,需要在这里更新下数据 |
| | | deviceMapper.updateCustom(deviceInStore); |
| | |
| | | }else { |
| | | // 开启订阅 |
| | | deviceInStore.setSubscribeCycleForMobilePosition(device.getSubscribeCycleForMobilePosition()); |
| | | deviceInStore.setMobilePositionSubmissionInterval(device.getMobilePositionSubmissionInterval()); |
| | | addMobilePositionSubscribe(deviceInStore); |
| | | } |
| | | |
| | | }else if (device.getSubscribeCycleForMobilePosition() == 0) { |
| | | // 取消订阅 |
| | | deviceInStore.setSubscribeCycleForMobilePosition(0); |
| | | deviceInStore.setMobilePositionSubmissionInterval(0); |
| | | removeMobilePositionSubscribe(deviceInStore, null); |
| | | } |
| | | } |