Merge branch '648540858:master' into develop-add-api-key
| | |
| | | |
| | | # é弿ºçå
容 |
| | | - [X] ONVIF设å¤çæ¥å
¥ï¼æ¯æç¹æï¼äºå°æ§å¶ï¼å½æ 级èç¹æï¼èªå¨ç¹æãå¨[ç¥è¯æç](https://t.zsxq.com/10WAnH2MP)æ¾äºè¯ç¨å®è£
å
以åä½¿ç¨æç¨ï¼æ²¡æä½¿ç¨æ¶é´éå¶ï¼éè¦æºç å¯ä»¥æçç§ä¿¡ææè
é®ç®±èç³»ã |
| | | - [X] æ¯æå½æ 28181-2022åè®®ï¼æ¯æå·¡èªè½¨è¿¹æ¥è¯¢ï¼PTZç²¾åæ§å¶ï¼åå¨å¡æ ¼å¼åï¼è®¾å¤è½¯ä»¶å级ï¼OSDé
ç½®ï¼h265+aacï¼æ¯æè¾
ç æµï¼å½ååæ¾çãå
·ä½çåè½å表å¯å¨[ç¥è¯æç](https://t.zsxq.com/18GXkpkqs)æ¥çï¼éè¦æºç åæµè¯å¯ä»¥å¨æçç§ä¿¡èç³»æè
åé®ä»¶ç»æ |
| | | |
| | | |
| | | # ææåè®® |
| | |
| | | |
| | | # ææ¯æ¯æ |
| | | |
| | | [ç¥è¯æç](https://t.zsxq.com/0d8VAD3Dm)䏿 åè¡¨ï¼ |
| | | [ç¥è¯æç](https://t.zsxq.com/0d8VAD3Dm)䏿 å表ï¼ï¼ |
| | | - [使ç¨å
¥é¨ç³»åä¸ï¼WVP-PROè½åä»ä¹](https://t.zsxq.com/0dLguVoSp) |
| | | |
| | | æå¿ææ¯æ¯æï¼è¯·åéé®ä»¶å°648540858@qq.com |
| | |
| | | [ydpd](https://github.com/ydpd) [szy833](https://github.com/szy833) [ydwxb](https://github.com/ydwxb) [Albertzhu666](https://github.com/Albertzhu666) |
| | | [mk1990](https://github.com/mk1990) [SaltFish001](https://github.com/SaltFish001) |
| | | |
| | | åæ¶æè°¢JetBrains坹弿ºé¡¹ç®çæ¯æï¼æ¬é¡¹ç®ä½¿ç¨IntelliJ IDEAå¼åä¸è°è¯ï¼ |
| | | |
| | | ffmpeg -re -i 123.mp3 -acodec pcm_alaw -ar 8000 -ac 1 -f rtsp rtsp://192.168.1.3:30554/broadcast/34020000001320000101_34020000001310000001 |
| | | |
| | | ffmpeg -re -i 123.mp3 -acodec pcm_alaw -ar 8000 -ac 1 -f rtsp rtsp://192.168.1.3:30554/talk/34020000001320000011_34020000001370000001 |
| | | |
| | | |
| | | |
| | | ffmpeg -re -i 123.mp3 -acodec pcm_alaw -ar 8000 -ac 1 -f rtsp rtsp://192.168.1.3:30554/talk/34020000001320000101_34020000001310000001 |
| | | |
| | |  |
| | |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.time.Instant; |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | } |
| | | } |
| | | // scheduleWithFixedDelay å¿
é¡»çå¾
ä¸ä¸ä¸ªä»»å¡ç»ææå¼å§è®¡æ¶periodï¼ cycleForCatalog表示æ§è¡çé´é |
| | | future = threadPoolTaskScheduler.scheduleAtFixedRate(task, cycleForCatalog); |
| | | |
| | | future = threadPoolTaskScheduler.scheduleAtFixedRate(task, new Date(System.currentTimeMillis() + cycleForCatalog), cycleForCatalog); |
| | | if (future != null){ |
| | | futureMap.put(key, future); |
| | | runnableMap.put(key, task); |
| | |
| | | * äºå°ç±»å |
| | | */ |
| | | @Schema(description = "äºå°ç±»å") |
| | | private int PTZType; |
| | | private int ptzType; |
| | | |
| | | /** |
| | | * äºå°ç±»åæè¿°å符串 |
| | | */ |
| | | @Schema(description = "äºå°ç±»åæè¿°å符串") |
| | | private String PTZTypeText; |
| | | private String ptzTypeText; |
| | | |
| | | /** |
| | | * å建æ¶é´ |
| | |
| | | this.deviceId = deviceId; |
| | | } |
| | | |
| | | public void setPTZType(int PTZType) { |
| | | this.PTZType = PTZType; |
| | | switch (PTZType) { |
| | | public void setPtzType(int ptzType) { |
| | | this.ptzType = ptzType; |
| | | switch (ptzType) { |
| | | case 0: |
| | | this.PTZTypeText = "æªç¥"; |
| | | this.ptzTypeText = "æªç¥"; |
| | | break; |
| | | case 1: |
| | | this.PTZTypeText = "çæº"; |
| | | this.ptzTypeText = "çæº"; |
| | | break; |
| | | case 2: |
| | | this.PTZTypeText = "åç"; |
| | | this.ptzTypeText = "åç"; |
| | | break; |
| | | case 3: |
| | | this.PTZTypeText = "åºå®æªæº"; |
| | | this.ptzTypeText = "åºå®æªæº"; |
| | | break; |
| | | case 4: |
| | | this.PTZTypeText = "饿§æªæº"; |
| | | this.ptzTypeText = "饿§æªæº"; |
| | | break; |
| | | } |
| | | } |
| | |
| | | this.password = password; |
| | | } |
| | | |
| | | public int getPTZType() { |
| | | return PTZType; |
| | | public int getPtzType() { |
| | | return ptzType; |
| | | } |
| | | |
| | | public String getPTZTypeText() { |
| | | return PTZTypeText; |
| | | public String getPtzTypeText() { |
| | | return ptzTypeText; |
| | | } |
| | | |
| | | public void setPTZTypeText(String PTZTypeText) { |
| | | this.PTZTypeText = PTZTypeText; |
| | | public void setPtzTypeText(String ptzTypeText) { |
| | | this.ptzTypeText = ptzTypeText; |
| | | } |
| | | |
| | | public boolean isStatus() { |
| | |
| | | @Schema(description = "æ¯å¦ä½ä¸ºæ¶æ¯éé") |
| | | private boolean autoPushChannel; |
| | | |
| | | @Schema(description = "ç¹æåå¤200OKä½¿ç¨æ¬¡IP") |
| | | private String sendStreamIp; |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | |
| | | public void setAutoPushChannel(boolean autoPushChannel) { |
| | | this.autoPushChannel = autoPushChannel; |
| | | } |
| | | |
| | | public String getSendStreamIp() { |
| | | return sendStreamIp; |
| | | } |
| | | |
| | | public void setSendStreamIp(String sendStreamIp) { |
| | | this.sendStreamIp = sendStreamIp; |
| | | } |
| | | } |
| | |
| | | public void setReceiveStream(String receiveStream) { |
| | | this.receiveStream = receiveStream; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "SendRtpItem{" + |
| | | "ip='" + ip + '\'' + |
| | | ", port=" + port + |
| | | ", ssrc='" + ssrc + '\'' + |
| | | ", platformId='" + platformId + '\'' + |
| | | ", deviceId='" + deviceId + '\'' + |
| | | ", app='" + app + '\'' + |
| | | ", channelId='" + channelId + '\'' + |
| | | ", status=" + status + |
| | | ", stream='" + stream + '\'' + |
| | | ", tcp=" + tcp + |
| | | ", tcpActive=" + tcpActive + |
| | | ", localPort=" + localPort + |
| | | ", mediaServerId='" + mediaServerId + '\'' + |
| | | ", serverId='" + serverId + '\'' + |
| | | ", CallId='" + CallId + '\'' + |
| | | ", fromTag='" + fromTag + '\'' + |
| | | ", toTag='" + toTag + '\'' + |
| | | ", pt=" + pt + |
| | | ", usePs=" + usePs + |
| | | ", onlyAudio=" + onlyAudio + |
| | | ", rtcp=" + rtcp + |
| | | ", playType=" + playType + |
| | | ", receiveStream='" + receiveStream + '\'' + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | return platforms; |
| | | } |
| | | |
| | | public List<String> getAllMobilePositionSubscribePlatform() { |
| | | List<String> platforms = new ArrayList<>(); |
| | | if(!mobilePositionMap.isEmpty()) { |
| | | for (String key : mobilePositionMap.keySet()) { |
| | | platforms.add(mobilePositionMap.get(key).getId()); |
| | | } |
| | | } |
| | | return platforms; |
| | | } |
| | | |
| | | public void removeAllSubscribe(String platformId) { |
| | | removeMobilePositionSubscribe(platformId); |
| | | removeCatalogSubscribe(platformId); |
| | |
| | | import com.genersoft.iot.vmp.gb28181.event.device.RequestTimeoutEvent; |
| | | import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition.MobilePositionEvent; |
| | | import com.genersoft.iot.vmp.media.zlm.event.ZLMOfflineEvent; |
| | | import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | } |
| | | |
| | | |
| | | public void mobilePositionEventPublish(MobilePosition mobilePosition) { |
| | | MobilePositionEvent event = new MobilePositionEvent(this); |
| | | event.setMobilePosition(mobilePosition); |
| | | applicationEventPublisher.publishEvent(event); |
| | | } |
| | | |
| | | |
| | | public void catalogEventPublishForStream(String platformId, List<GbStream> gbStreams, String type) { |
| | | CatalogEvent outEvent = new CatalogEvent(this); |
| | | outEvent.setGbStreams(gbStreams); |
New file |
| | |
| | | package com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import org.springframework.context.ApplicationEvent; |
| | | |
| | | public class MobilePositionEvent extends ApplicationEvent { |
| | | public MobilePositionEvent(Object source) { |
| | | super(source); |
| | | } |
| | | |
| | | private MobilePosition mobilePosition; |
| | | |
| | | public MobilePosition getMobilePosition() { |
| | | return mobilePosition; |
| | | } |
| | | |
| | | public void setMobilePosition(MobilePosition mobilePosition) { |
| | | this.mobilePosition = mobilePosition; |
| | | } |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.gb28181.event.subscribe.mobilePosition; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| | | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationListener; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.sip.InvalidArgumentException; |
| | | import javax.sip.SipException; |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç§»å¨ä½ç½®éç¥æ¶æ¯è½¬å |
| | | */ |
| | | @Component |
| | | public class MobilePositionEventLister implements ApplicationListener<MobilePositionEvent> { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(MobilePositionEventLister.class); |
| | | |
| | | @Autowired |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private SIPCommanderFroPlatform sipCommanderFroPlatform; |
| | | |
| | | @Autowired |
| | | private SubscribeHolder subscribeHolder; |
| | | |
| | | @Override |
| | | public void onApplicationEvent(MobilePositionEvent event) { |
| | | // è·åæç¨è®¢é
|
| | | List<String> platforms = subscribeHolder.getAllMobilePositionSubscribePlatform(); |
| | | if (platforms.isEmpty()) { |
| | | return; |
| | | } |
| | | List<ParentPlatform> parentPlatformsForGB = storager.queryPlatFormListForGBWithGBId(event.getMobilePosition().getChannelId(), platforms); |
| | | |
| | | for (ParentPlatform platform : parentPlatformsForGB) { |
| | | logger.info("[åä¸çº§åéMobilePosition] ééï¼{}ï¼å¹³å°ï¼{}ï¼ ä½ç½®ï¼ {}:{}", event.getMobilePosition().getChannelId(), |
| | | platform.getServerGBId(), event.getMobilePosition().getLongitude(), event.getMobilePosition().getLatitude()); |
| | | SubscribeInfo subscribe = subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()); |
| | | try { |
| | | sipCommanderFroPlatform.sendNotifyMobilePosition(platform, GPSMsgInfo.getInstance(event.getMobilePosition()), |
| | | subscribe); |
| | | } catch (InvalidArgumentException | ParseException | NoSuchFieldException | SipException | |
| | | IllegalAccessException e) { |
| | | logger.error("[å½ä»¤åé失败] 彿 级è Catalogéç¥: {}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | ssrcTransaction.setType(type); |
| | | |
| | | redisTemplate.opsForValue().set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() |
| | | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); |
| | | + ":" + deviceId + ":" + channelId + ":" + callId + ":" + stream, ssrcTransaction); |
| | | } |
| | | |
| | | public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ |
| | |
| | | if (ObjectUtils.isEmpty(stream)) { |
| | | stream ="*"; |
| | | } |
| | | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; |
| | | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream; |
| | | List<Object> scanResult = RedisUtil.scan(redisTemplate, key); |
| | | if (scanResult.size() == 0) { |
| | | return null; |
| | |
| | | if (ObjectUtils.isEmpty(callId)) { |
| | | return null; |
| | | } |
| | | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_" + callId+ "_*"; |
| | | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:" + callId+ ":*"; |
| | | List<Object> scanResult = RedisUtil.scan(redisTemplate, key); |
| | | if (!scanResult.isEmpty()) { |
| | | return (SsrcTransaction)redisTemplate.opsForValue().get(scanResult.get(0)); |
| | | }else { |
| | | key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_*_*_play_*"; |
| | | key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":*:*:play:*"; |
| | | scanResult = RedisUtil.scan(redisTemplate, key); |
| | | if (scanResult.isEmpty()) { |
| | | return null; |
| | |
| | | if (ObjectUtils.isEmpty(stream)) { |
| | | stream ="*"; |
| | | } |
| | | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; |
| | | String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" + deviceId + ":" + channelId + ":" + callId+ ":" + stream; |
| | | List<Object> scanResult = RedisUtil.scan(redisTemplate, key); |
| | | if (scanResult.size() == 0) { |
| | | return null; |
| | |
| | | return; |
| | | } |
| | | for (SsrcTransaction ssrcTransaction : ssrcTransactionList) { |
| | | redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" |
| | | + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); |
| | | redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" |
| | | + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream()); |
| | | } |
| | | } |
| | | |
| | |
| | | if (ssrcTransaction == null ) { |
| | | return; |
| | | } |
| | | redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" |
| | | + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); |
| | | redisTemplate.delete(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + ":" |
| | | + deviceId + ":" + channelId + ":" + ssrcTransaction.getCallId() + ":" + ssrcTransaction.getStream()); |
| | | } |
| | | |
| | | |
| | |
| | | /** |
| | | * çå®ä½æ§å¶å½ä»¤ |
| | | * |
| | | * @param device è§é¢è®¾å¤ |
| | | * @param channelId ééidï¼éééåæ¯è®¾å¤æ¬èº« |
| | | * @param enabled çå®ä½ä½¿è½ï¼1 = å¼å¯ï¼0 = å
³é |
| | | * @param resetTime èªå¨å½ä½æ¶é´é´éï¼å¼å¯çå®ä½æ¶ä½¿ç¨ï¼åä½:ç§(s) |
| | | * @param presetIndex è°ç¨é¢ç½®ä½ç¼å·ï¼å¼å¯çå®ä½æ¶ä½¿ç¨ï¼åå¼èå´0~255 |
| | | */ |
| | | void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; |
| | | void homePositionCmd(Device device, String channelId, Boolean enabled, Integer resetTime, Integer presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException; |
| | | |
| | | /** |
| | | * 设å¤é
ç½®å½ä»¤ |
| | |
| | | * @param presetIndex è°ç¨é¢ç½®ä½ç¼å·ï¼å¼å¯çå®ä½æ¶ä½¿ç¨ï¼åå¼èå´0~255
|
| | | */
|
| | | @Override
|
| | | public void homePositionCmd(Device device, String channelId, String enabled, String resetTime, String presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
| | | public void homePositionCmd(Device device, String channelId, Boolean enabled, Integer resetTime, Integer presetIndex, SipSubscribe.Event errorEvent,SipSubscribe.Event okEvent) throws InvalidArgumentException, SipException, ParseException {
|
| | |
|
| | | StringBuffer cmdXml = new StringBuffer(200);
|
| | | String charset = device.getCharset();
|
| | |
| | | cmdXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n");
|
| | | }
|
| | | cmdXml.append("<HomePosition>\r\n");
|
| | | if (NumericUtil.isInteger(enabled) && (!enabled.equals("0"))) {
|
| | | if (enabled) {
|
| | | cmdXml.append("<Enabled>1</Enabled>\r\n");
|
| | | if (NumericUtil.isInteger(resetTime)) {
|
| | | cmdXml.append("<ResetTime>" + resetTime + "</ResetTime>\r\n");
|
| | | } else {
|
| | | cmdXml.append("<ResetTime>0</ResetTime>\r\n");
|
| | | }
|
| | | if (NumericUtil.isInteger(presetIndex)) {
|
| | | cmdXml.append("<PresetIndex>" + presetIndex + "</PresetIndex>\r\n");
|
| | | } else {
|
| | | cmdXml.append("<PresetIndex>0</PresetIndex>\r\n");
|
| | | }
|
| | | } else {
|
| | | cmdXml.append("<Enabled>0</Enabled>\r\n");
|
| | | }
|
| | |
| | | }else { |
| | | catalogXml.append("<Password></Password>\r\n"); |
| | | } |
| | | if (!ObjectUtils.isEmpty(channel.getPTZType())) { |
| | | catalogXml.append("<PTZType>" + channel.getPTZType() + "</PTZType>\r\n"); |
| | | if (!ObjectUtils.isEmpty(channel.getPtzType())) { |
| | | catalogXml.append("<PTZType>" + channel.getPtzType() + "</PTZType>\r\n"); |
| | | }else { |
| | | catalogXml.append("<PTZType></PTZType>\r\n"); |
| | | } |
| | |
| | | |
| | | if (parentPlatform != null) { |
| | | Map<String, Object> param = getSendRtpParam(sendRtpItem); |
| | | if (mediaInfo == null) { |
| | | if (!userSetting.getServerId().equals(sendRtpItem.getServerId())) { |
| | | RequestPushStreamMsg requestPushStreamMsg = RequestPushStreamMsg.getInstance( |
| | | sendRtpItem.getMediaServerId(), sendRtpItem.getApp(), sendRtpItem.getStream(), |
| | | sendRtpItem.getIp(), sendRtpItem.getPort(), sendRtpItem.getSsrc(), sendRtpItem.isTcp(), |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.*; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.RequestStopPushStreamMsg; |
| | | import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import gov.nist.javax.sip.message.SIPRequest; |
| | |
| | | @Autowired |
| | | private UserSetting userSetting; |
| | | |
| | | @Autowired |
| | | private IStreamPushService pushService; |
| | | |
| | | @Autowired |
| | | private RedisGbPlayMsgListener redisGbPlayMsgListener; |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | | // æ·»å æ¶æ¯å¤çç订é
|
| | |
| | | |
| | | // æ¶æµç«¯åéç忢 |
| | | if (sendRtpItem != null){ |
| | | logger.info("[æ¶å°bye] æ¥èª{}ï¼åæ¢ééï¼{}, ç±»åï¼ {}", sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getPlayType()); |
| | | logger.info("[æ¶å°bye] æ¥èª{}ï¼åæ¢ééï¼{}, ç±»åï¼ {}, callId: {}", sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getPlayType(), callIdHeader.getCallId()); |
| | | |
| | | String streamId = sendRtpItem.getStream(); |
| | | Map<String, Object> param = new HashMap<>(); |
| | |
| | | param.put("app",sendRtpItem.getApp()); |
| | | param.put("stream",streamId); |
| | | param.put("ssrc",sendRtpItem.getSsrc()); |
| | | logger.info("[æ¶å°bye] åæ¢æ¨æµï¼{}", streamId); |
| | | logger.info("[æ¶å°bye] åæ¢æ¨æµï¼{}, åªä½èç¹ï¼ {}", streamId, sendRtpItem.getMediaServerId()); |
| | | |
| | | if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) { |
| | | // æ¥è¯¢è¿è·¯æµæ¯å¦æ¯æ¬å¹³å°ç |
| | | StreamPushItem push = pushService.getPush(sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | if (push!= null && !push.isSelf()) { |
| | | // 䏿¯æ¬å¹³å°çå°±åéredisæ¶æ¯è®©å
¶ä»wvp忢念 |
| | | ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); |
| | | if (platform != null) { |
| | | RequestStopPushStreamMsg streamMsg = RequestStopPushStreamMsg.getInstance(sendRtpItem, platform.getName(), platform.getId()); |
| | | redisGbPlayMsgListener.sendMsgForStopSendRtpStream(sendRtpItem.getServerId(), streamMsg); |
| | | } |
| | | }else { |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), |
| | | callIdHeader.getCallId(), null); |
| | |
| | | if (userSetting.getUseCustomSsrcForParentInvite()) { |
| | | mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc()); |
| | | } |
| | | if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) { |
| | | |
| | | ParentPlatform platform = platformService.queryPlatformByServerGBId(sendRtpItem.getPlatformId()); |
| | | if (platform != null) { |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, |
| | |
| | | logger.info("[ä¸çº§å¹³å°åæ¢è§ç] æªæ¾å°å¹³å°{}çä¿¡æ¯ï¼åéredisæ¶æ¯å¤±è´¥", sendRtpItem.getPlatformId()); |
| | | } |
| | | } |
| | | |
| | | }else { |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), |
| | | callIdHeader.getCallId(), null); |
| | | zlmServerFactory.stopSendRtpStream(mediaInfo, param); |
| | | if (userSetting.getUseCustomSsrcForParentInvite()) { |
| | | mediaServerService.releaseSsrc(mediaInfo.getId(), sendRtpItem.getSsrc()); |
| | | } |
| | | } |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | if (mediaInfo != null) { |
| | | AudioBroadcastCatch audioBroadcastCatch = audioBroadcastManager.get(sendRtpItem.getDeviceId(), sendRtpItem.getChannelId()); |
| | | if (audioBroadcastCatch != null && audioBroadcastCatch.getSipTransactionInfo().getCallId().equals(callIdHeader.getCallId())) { |
| | | // æ¥èªä¸çº§å¹³å°çåæ¢å¯¹è®² |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | // å¯è½æ¯è®¾å¤åéç忢 |
| | | SsrcTransaction ssrcTransaction = streamSession.getSsrcTransactionByCallId(callIdHeader.getCallId()); |
| | |
| | | import gov.nist.javax.sdp.fields.URIField; |
| | | import gov.nist.javax.sip.message.SIPRequest; |
| | | import gov.nist.javax.sip.message.SIPResponse; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | // * 2 æ¨æµä¸ |
| | | sendRtpItem.setStatus(1); |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | |
| | | String sdpIp = mediaServerItemInUSe.getSdpIp(); |
| | | if (!ObjectUtils.isEmpty(platform.getSendStreamIp())) { |
| | | sdpIp = platform.getSendStreamIp(); |
| | | } |
| | | StringBuffer content = new StringBuffer(200); |
| | | content.append("v=0\r\n"); |
| | | content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItemInUSe.getSdpIp() + "\r\n"); |
| | | content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); |
| | | content.append("s=" + sessionName + "\r\n"); |
| | | content.append("c=IN IP4 " + mediaServerItemInUSe.getSdpIp() + "\r\n"); |
| | | content.append("c=IN IP4 " + sdpIp + "\r\n"); |
| | | if ("Playback".equalsIgnoreCase(sessionName)) { |
| | | content.append("t=" + finalStartTime + " " + finalStopTime + "\r\n"); |
| | | } else { |
| | |
| | | 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()); |
| | | sendRtpItem.setStream(stream); |
| | | // åå
¥redisï¼ è¶
æ¶æ¶åå¤ |
| | | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| | | playService.playBack(mediaServerItem, ssrcInfo, device.getDeviceId(), channelId, DateUtil.formatter.format(start), |
| | |
| | | } |
| | | |
| | | if ("push".equals(gbStream.getStreamType())) { |
| | | if (streamPushItem != null && streamPushItem.isPushIng()) { |
| | | if (streamPushItem != null) { |
| | | // ä»redisæ¥è¯¢æ¯å¦æ£å¨æ¥æ¶è¿ä¸ªæ¨æµ |
| | | OnStreamChangedHookParam pushListItem = redisCatchStorage.getPushListItem(gbStream.getApp(), gbStream.getStream()); |
| | | if (pushListItem != null) { |
| | | StreamPushItem transform = streamPushService.transform(pushListItem); |
| | | transform.setSelf(userSetting.getServerId().equals(pushListItem.getSeverId())); |
| | | // æ¨æµç¶æ |
| | | pushStream(evt, request, gbStream, streamPushItem, platform, callIdHeader, mediaServerItem, port, tcpActive, |
| | | pushStream(evt, request, gbStream, transform, platform, callIdHeader, mediaServerItem, port, tcpActive, |
| | | mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); |
| | | } else { |
| | | // æªæ¨æµ æèµ· |
| | | notifyStreamOnline(evt, request, gbStream, streamPushItem, platform, callIdHeader, mediaServerItem, port, tcpActive, |
| | | mediaTransmissionTCP, channelId, addressStr, ssrc, requesterId); |
| | | } |
| | | } |
| | | } else if ("proxy".equals(gbStream.getStreamType())) { |
| | | if (null != proxyByAppAndStream) { |
| | |
| | | |
| | | public SIPResponse sendStreamAck(MediaServerItem mediaServerItem, SIPRequest request, SendRtpItem sendRtpItem, ParentPlatform platform, RequestEvent evt) { |
| | | |
| | | String sdpIp = mediaServerItem.getSdpIp(); |
| | | if (!ObjectUtils.isEmpty(platform.getSendStreamIp())) { |
| | | sdpIp = platform.getSendStreamIp(); |
| | | } |
| | | StringBuffer content = new StringBuffer(200); |
| | | content.append("v=0\r\n"); |
| | | content.append("o=" + sendRtpItem.getChannelId() + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); |
| | | content.append("o=" + sendRtpItem.getChannelId() + " 0 0 IN IP4 " + sdpIp + "\r\n"); |
| | | content.append("s=Play\r\n"); |
| | | content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); |
| | | content.append("c=IN IP4 " + sdpIp + "\r\n"); |
| | | content.append("t=0 0\r\n"); |
| | | // éä¸¥æ ¼æ¨¡å¼ç«¯å£ä¸ç»ä¸, å¢å å
¼å®¹æ§ï¼ä¿®æ¹ä¸ºä¸ä¸ªä¸ä¸º0çç«¯å£ |
| | | int localPort = sendRtpItem.getLocalPort(); |
| | |
| | | Media media = mediaDescription.getMedia(); |
| | | |
| | | Vector mediaFormats = media.getMediaFormats(false); |
| | | if (mediaFormats.contains("8")) { |
| | | // if (mediaFormats.contains("8")) { |
| | | port = media.getMediaPort(); |
| | | String protocol = media.getProtocol(); |
| | | // åºåTCPåæµè¿æ¯udpï¼ å½åé»è®¤udp |
| | |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | // } |
| | | } |
| | | if (port == -1) { |
| | | logger.info("䏿¯æçåªä½æ ¼å¼ï¼è¿å415"); |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.conf.CivilCodeFileConf; |
| | | import com.genersoft.iot.vmp.conf.SipConfig; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | |
| | | @Autowired |
| | | private NotifyRequestForCatalogProcessor notifyRequestForCatalogProcessor; |
| | | |
| | | @Autowired |
| | | private CivilCodeFileConf civilCodeFileConf; |
| | | |
| | | private ConcurrentLinkedQueue<HandlerCatchData> taskQueue = new ConcurrentLinkedQueue<>(); |
| | | |
| | | @Qualifier("taskExecutor") |
| | |
| | | @Override |
| | | public void process(RequestEvent evt) { |
| | | try { |
| | | |
| | | if (taskQueue.size() >= userSetting.getMaxNotifyCountQueue()) { |
| | | responseAck((SIPRequest) evt.getRequest(), Response.BUSY_HERE, null, null); |
| | | logger.error("[notify] å¾
å¤çæ¶æ¯éå已满 {}ï¼è¿å486 BUSY_HEREï¼æ¶æ¯ä¸åå¤ç", userSetting.getMaxNotifyCountQueue()); |
| | |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); |
| | | |
| | | storager.updateChannelPosition(deviceChannel); |
| | | // åå
³èäºè¯¥ééå¹¶ä¸å¼å¯ç§»å¨ä½ç½®è®¢é
çä¸çº§å¹³å°åéç§»å¨ä½ç½®è®¢é
æ¶æ¯ |
| | | |
| | | |
| | | // åéredisæ¶æ¯ã éç¥ä½ç½®ä¿¡æ¯çåå |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); |
| | | jsonObject.put("serial", deviceId); |
| | | jsonObject.put("code", channelId); |
| | | jsonObject.put("longitude", mobilePosition.getLongitude()); |
| | | jsonObject.put("latitude", mobilePosition.getLatitude()); |
| | | jsonObject.put("altitude", mobilePosition.getAltitude()); |
| | | jsonObject.put("direction", mobilePosition.getDirection()); |
| | | jsonObject.put("speed", mobilePosition.getSpeed()); |
| | | redisCatchStorage.sendMobilePositionMsg(jsonObject); |
| | | } catch (DocumentException e) { |
| | | logger.error("æªå¤ççå¼å¸¸ ", e); |
| | | } |
| | |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); |
| | | } |
| | | |
| | | storager.updateChannelPosition(deviceChannel); |
| | | // åéredisæ¶æ¯ã éç¥ä½ç½®ä¿¡æ¯çåå |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); |
| | | jsonObject.put("serial", deviceChannel.getDeviceId()); |
| | | jsonObject.put("code", deviceChannel.getChannelId()); |
| | | jsonObject.put("longitude", mobilePosition.getLongitude()); |
| | | jsonObject.put("latitude", mobilePosition.getLatitude()); |
| | | jsonObject.put("altitude", mobilePosition.getAltitude()); |
| | | jsonObject.put("direction", mobilePosition.getDirection()); |
| | | jsonObject.put("speed", mobilePosition.getSpeed()); |
| | | redisCatchStorage.sendMobilePositionMsg(jsonObject); |
| | | |
| | | } |
| | | // TODO: éè¦å®ç°å卿¥è¦ä¿¡æ¯ãæ¥è¦åç±» |
| | | |
| | | // åå¤200 OK |
| | | if (redisCatchStorage.deviceIsOnline(deviceId)) { |
| | |
| | | HomePositionRequest homePosition = loadElement(rootElement, HomePositionRequest.class); |
| | | //è·åæ´ä¸ªæ¶æ¯ä¸»ä½ï¼æä»¬åªéè¦ä¿®æ¹è¯·æ±å¤´å³å¯ |
| | | HomePositionRequest.HomePosition info = homePosition.getHomePosition(); |
| | | cmder.homePositionCmd(device, channelId, info.getEnabled(), info.getResetTime(), info.getPresetIndex(), |
| | | cmder.homePositionCmd(device, channelId, !"0".equals(info.getEnabled()), Integer.parseInt(info.getResetTime()), Integer.parseInt(info.getPresetIndex()), |
| | | errorResult -> onError(request, errorResult), |
| | | okResult -> onOk(request, okResult)); |
| | | } catch (Exception e) { |
| | |
| | | @Autowired |
| | | private ThreadPoolTaskExecutor taskExecutor; |
| | | |
| | | @Autowired |
| | | private EventPublisher eventPublisher; |
| | | |
| | | |
| | | @Override |
| | | public void afterPropertiesSet() throws Exception { |
| | |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | storager.updateChannelPosition(deviceChannel); |
| | | |
| | | // åéredisæ¶æ¯ã éç¥ä½ç½®ä¿¡æ¯çåå |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); |
| | | jsonObject.put("serial", deviceChannel.getDeviceId()); |
| | | jsonObject.put("code", deviceChannel.getChannelId()); |
| | | jsonObject.put("longitude", mobilePosition.getLongitude()); |
| | | jsonObject.put("latitude", mobilePosition.getLatitude()); |
| | | jsonObject.put("altitude", mobilePosition.getAltitude()); |
| | | jsonObject.put("direction", mobilePosition.getDirection()); |
| | | jsonObject.put("speed", mobilePosition.getSpeed()); |
| | | redisCatchStorage.sendMobilePositionMsg(jsonObject); |
| | | deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); |
| | | } |
| | | } |
| | | if (!ObjectUtils.isEmpty(deviceAlarm.getDeviceId())) { |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| | |
| | | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | @Autowired |
| | | private EventPublisher eventPublisher; |
| | | |
| | | private ConcurrentLinkedQueue<SipMsgInfo> taskQueue = new ConcurrentLinkedQueue<>(); |
| | | |
| | |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | storager.updateChannelPosition(deviceChannel); |
| | | |
| | | // åéredisæ¶æ¯ã éç¥ä½ç½®ä¿¡æ¯çåå |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); |
| | | jsonObject.put("serial", deviceChannel.getDeviceId()); |
| | | jsonObject.put("code", deviceChannel.getChannelId()); |
| | | jsonObject.put("longitude", mobilePosition.getLongitude()); |
| | | jsonObject.put("latitude", mobilePosition.getLatitude()); |
| | | jsonObject.put("altitude", mobilePosition.getAltitude()); |
| | | jsonObject.put("direction", mobilePosition.getDirection()); |
| | | jsonObject.put("speed", mobilePosition.getSpeed()); |
| | | redisCatchStorage.sendMobilePositionMsg(jsonObject); |
| | | deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); |
| | | |
| | | } catch (DocumentException e) { |
| | | logger.error("æªå¤ççå¼å¸¸ ", e); |
| | |
| | | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | |
| | | mobilePosition.setLongitudeGcj02(deviceChannel.getLongitudeGcj02()); |
| | | mobilePosition.setLatitudeGcj02(deviceChannel.getLatitudeGcj02()); |
| | | |
| | | if (userSetting.getSavePositionHistory()) { |
| | | storager.insertMobilePosition(mobilePosition); |
| | | } |
| | | |
| | | storager.updateChannelPosition(deviceChannel); |
| | | deviceChannelService.updateChannelGPS(device, deviceChannel, mobilePosition); |
| | | |
| | | String key = DeferredResultHolder.CALLBACK_CMD_MOBILE_POSITION + device.getDeviceId(); |
| | | RequestMessage msg = new RequestMessage(); |
| | |
| | | msg.setData(mobilePosition); |
| | | resultHolder.invokeAllResult(msg); |
| | | |
| | | // åéredisæ¶æ¯ã éç¥ä½ç½®ä¿¡æ¯çåå |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); |
| | | jsonObject.put("serial", deviceChannel.getDeviceId()); |
| | | jsonObject.put("code", deviceChannel.getChannelId()); |
| | | jsonObject.put("longitude", mobilePosition.getLongitude()); |
| | | jsonObject.put("latitude", mobilePosition.getLatitude()); |
| | | jsonObject.put("altitude", mobilePosition.getAltitude()); |
| | | jsonObject.put("direction", mobilePosition.getDirection()); |
| | | jsonObject.put("speed", mobilePosition.getSpeed()); |
| | | redisCatchStorage.sendMobilePositionMsg(jsonObject); |
| | | //åå¤ 200 OK |
| | | try { |
| | | responseAck(request, Response.OK); |
| | |
| | | String ptzTypeFromInfo = XmlUtil.getText(info, "PTZType"); |
| | | if(!ObjectUtils.isEmpty(ptzTypeFromInfo)){ |
| | | try { |
| | | deviceChannel.setPTZType(Integer.parseInt(ptzTypeFromInfo)); |
| | | deviceChannel.setPtzType(Integer.parseInt(ptzTypeFromInfo)); |
| | | }catch (NumberFormatException e){ |
| | | logger.warn("[xmlè§£æ] ä»ééæ°æ®infoä¸è·åPTZTypeå¤±è´¥ï¼ {}", ptzTypeFromInfo); |
| | | } |
| | | } |
| | | } else { |
| | | try { |
| | | deviceChannel.setPTZType(Integer.parseInt(ptzType)); |
| | | deviceChannel.setPtzType(Integer.parseInt(ptzType)); |
| | | }catch (NumberFormatException e){ |
| | | logger.warn("[xmlè§£æ] ä»ééæ°æ®ä¸è·åPTZTypeå¤±è´¥ï¼ {}", ptzType); |
| | | } |
| | |
| | | private AudioBroadcastManager audioBroadcastManager;
|
| | |
|
| | | @Autowired
|
| | | private ZLMServerFactory zlmServerFactory;
|
| | |
|
| | | @Autowired
|
| | | private IPlayService playService;
|
| | |
|
| | | @Autowired
|
| | |
| | | private VideoStreamSessionManager sessionManager;
|
| | |
|
| | | @Autowired
|
| | | private AssistRESTfulUtils assistRESTfulUtils;
|
| | |
|
| | | @Autowired
|
| | | private SSRCFactory ssrcFactory;
|
| | |
|
| | | @Qualifier("taskExecutor")
|
| | |
| | |
|
| | | taskExecutor.execute(() -> {
|
| | | List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_keepalive);
|
| | | if (subscribes != null && subscribes.size() > 0) {
|
| | | if (subscribes != null && !subscribes.isEmpty()) {
|
| | | for (ZlmHttpHookSubscribe.Event subscribe : subscribes) {
|
| | | subscribe.response(null, param);
|
| | | }
|
| | |
| | | @PostMapping(value = "/on_play", produces = "application/json;charset=UTF-8")
|
| | | public HookResult onPlay(@RequestBody OnPlayHookParam param) {
|
| | | if (logger.isDebugEnabled()) {
|
| | | logger.debug("[ZLM HOOK] ææ¾é´æï¼{}->{}" + param.getMediaServerId(), param);
|
| | | logger.debug("[ZLM HOOK] ææ¾é´æï¼{}->{}", param.getMediaServerId(), param);
|
| | | }
|
| | | String mediaServerId = param.getMediaServerId();
|
| | |
|
| | |
| | | taskExecutor.execute(() -> {
|
| | | ZlmHttpHookSubscribe.Event subscribe = this.subscribe.sendNotify(HookType.on_publish, json);
|
| | | if (subscribe != null) {
|
| | | if (mediaInfo != null) {
|
| | | subscribe.response(mediaInfo, param);
|
| | | } else {
|
| | | new HookResultForOnPublish(1, "zlm not register");
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | |
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByStream(param.getStream());
|
| | | if (!sendRtpItems.isEmpty()) {
|
| | | for (SendRtpItem sendRtpItem : sendRtpItems) {
|
| | | if (sendRtpItem != null && sendRtpItem.getApp().equals(param.getApp())) {
|
| | | if (sendRtpItem == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (sendRtpItem.getApp().equals(param.getApp())) {
|
| | | logger.info(sendRtpItem.toString());
|
| | | if (userSetting.getServerId().equals(sendRtpItem.getServerId())) {
|
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0,
|
| | | sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(),
|
| | | sendRtpItem.getPlatformId(), null, userSetting.getServerId(), param.getMediaServerId());
|
| | | // éç¥å
¶ä»wvp忢念
|
| | | redisCatchStorage.sendPushStreamClose(messageForPushChannel);
|
| | | }else {
|
| | | String platformId = sendRtpItem.getPlatformId();
|
| | | ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId);
|
| | | Device device = deviceService.getDevice(platformId);
|
| | |
| | | SsrcTransactionNotFoundException e) {
|
| | | logger.error("[å½ä»¤åé失败] åéBYE: {}", e.getMessage());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | | // æ¶å°æ 人è§çè¯´ææµä¹æ²¡æå¨å¾ä¸çº§æ¨é
|
| | | if (redisCatchStorage.isChannelSendingRTP(inviteInfo.getChannelId())) {
|
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId(
|
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChannelId(
|
| | | inviteInfo.getChannelId());
|
| | | if (sendRtpItems.size() > 0) {
|
| | | if (!sendRtpItems.isEmpty()) {
|
| | | for (SendRtpItem sendRtpItem : sendRtpItems) {
|
| | | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(sendRtpItem.getPlatformId());
|
| | | try {
|
| | |
| | | logger.info("[ZLM HOOK] zlm å¯å¨ " + zlmServerConfig.getGeneralMediaServerId());
|
| | | taskExecutor.execute(() -> {
|
| | | List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_server_started);
|
| | | if (subscribes != null && subscribes.size() > 0) {
|
| | | if (subscribes != null && !subscribes.isEmpty()) {
|
| | | for (ZlmHttpHookSubscribe.Event subscribe : subscribes) {
|
| | | subscribe.response(null, zlmServerConfig);
|
| | | }
|
| | |
| | | */
|
| | | @ResponseBody
|
| | | @PostMapping(value = "/on_rtp_server_timeout", produces = "application/json;charset=UTF-8")
|
| | | public HookResult onRtpServerTimeout(HttpServletRequest request, @RequestBody OnRtpServerTimeoutHookParam
|
| | | public HookResult onRtpServerTimeout(@RequestBody OnRtpServerTimeoutHookParam
|
| | | param) {
|
| | | logger.info("[ZLM HOOK] rtpServeræ¶æµè¶
æ¶ï¼{}->{}({})", param.getMediaServerId(), param.getStream_id(), param.getSsrc());
|
| | |
|
| | | taskExecutor.execute(() -> {
|
| | | JSONObject json = (JSONObject) JSON.toJSON(param);
|
| | | List<ZlmHttpHookSubscribe.Event> subscribes = this.subscribe.getSubscribes(HookType.on_rtp_server_timeout);
|
| | | if (subscribes != null && !subscribes.isEmpty()) {
|
| | | for (ZlmHttpHookSubscribe.Event subscribe : subscribes) {
|
| | |
| | | * è°ç¨zlm RESTful API ââ stopSendRtp |
| | | */ |
| | | public Boolean stopSendRtpStream(MediaServerItem mediaServerItem, Map<String, Object>param) { |
| | | if (mediaServerItem == null) { |
| | | logger.error("[忢RTPæ¨æµ] 失败: åªä½èç¹ä¸ºNULL"); |
| | | return false; |
| | | } |
| | | Boolean result = false; |
| | | JSONObject jsonObject = zlmresTfulUtils.stopSendRtp(mediaServerItem, param); |
| | | if (jsonObject == null) { |
| | |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| | | |
| | |
| | | * ä¿®æ¹ééçç æµç±»å |
| | | */ |
| | | void updateChannelStreamIdentification(DeviceChannel channel); |
| | | |
| | | List<DeviceChannel> queryChaneListByDeviceId(String deviceId); |
| | | |
| | | void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition); |
| | | |
| | | void stopPlay(String deviceId, String channelId); |
| | | } |
| | |
| | | |
| | | void getSnap(String deviceId, String channelId, String fileName, ErrorCallback errorCallback); |
| | | |
| | | void stopPlay(Device device, String channelId); |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.service.bean; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | |
| | | public class GPSMsgInfo { |
| | | |
| | | /** |
| | |
| | | |
| | | private boolean stored; |
| | | |
| | | public static GPSMsgInfo getInstance(MobilePosition mobilePosition) { |
| | | GPSMsgInfo gpsMsgInfo = new GPSMsgInfo(); |
| | | gpsMsgInfo.setId(mobilePosition.getChannelId()); |
| | | gpsMsgInfo.setAltitude(mobilePosition.getAltitude() + ""); |
| | | gpsMsgInfo.setLng(mobilePosition.getLongitude()); |
| | | gpsMsgInfo.setLat(mobilePosition.getLatitude()); |
| | | gpsMsgInfo.setSpeed(mobilePosition.getSpeed()); |
| | | gpsMsgInfo.setDirection(mobilePosition.getDirection() + ""); |
| | | gpsMsgInfo.setTime(DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); |
| | | return gpsMsgInfo; |
| | | } |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
New file |
| | |
| | | package com.genersoft.iot.vmp.service.bean; |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | |
| | | |
| | | public class RequestStopPushStreamMsg { |
| | | |
| | | |
| | | private SendRtpItem sendRtpItem; |
| | | |
| | | |
| | | private String platformName; |
| | | |
| | | |
| | | private int platFormIndex; |
| | | |
| | | public SendRtpItem getSendRtpItem() { |
| | | return sendRtpItem; |
| | | } |
| | | |
| | | public void setSendRtpItem(SendRtpItem sendRtpItem) { |
| | | this.sendRtpItem = sendRtpItem; |
| | | } |
| | | |
| | | public String getPlatformName() { |
| | | return platformName; |
| | | } |
| | | |
| | | public void setPlatformName(String platformName) { |
| | | this.platformName = platformName; |
| | | } |
| | | |
| | | |
| | | public int getPlatFormIndex() { |
| | | return platFormIndex; |
| | | } |
| | | |
| | | public void setPlatFormIndex(int platFormIndex) { |
| | | this.platFormIndex = platFormIndex; |
| | | } |
| | | |
| | | public static RequestStopPushStreamMsg getInstance(SendRtpItem sendRtpItem, String platformName, int platFormIndex) { |
| | | RequestStopPushStreamMsg streamMsg = new RequestStopPushStreamMsg(); |
| | | streamMsg.setSendRtpItem(sendRtpItem); |
| | | streamMsg.setPlatformName(platformName); |
| | | streamMsg.setPlatFormIndex(platFormIndex); |
| | | return streamMsg; |
| | | } |
| | | } |
| | |
| | | |
| | | public class WvpRedisMsgCmd { |
| | | |
| | | /** |
| | | * 请æ±è·åæ¨æµä¿¡æ¯ |
| | | */ |
| | | public static final String GET_SEND_ITEM = "GetSendItem"; |
| | | /** |
| | | * è¯·æ±æ¨æµçè¯·æ± |
| | | */ |
| | | public static final String REQUEST_PUSH_STREAM = "RequestPushStream"; |
| | | /** |
| | | * åæ¢æ¨æµçè¯·æ± |
| | | */ |
| | | public static final String REQUEST_STOP_PUSH_STREAM = "RequestStopPushStream"; |
| | | |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.genersoft.iot.vmp.common.InviteInfo; |
| | | import com.genersoft.iot.vmp.common.InviteSessionType; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.service.IInviteStreamService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceMobilePositionMapper; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; |
| | | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| | |
| | | private final static Logger logger = LoggerFactory.getLogger(DeviceChannelServiceImpl.class); |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | private EventPublisher eventPublisher; |
| | | |
| | | @Autowired |
| | | private IInviteStreamService inviteStreamService; |
| | |
| | | |
| | | @Autowired |
| | | private DeviceMapper deviceMapper; |
| | | |
| | | @Autowired |
| | | private DeviceMobilePositionMapper deviceMobilePositionMapper; |
| | | |
| | | @Autowired |
| | | private UserSetting userSetting; |
| | | |
| | | @Autowired |
| | | private IRedisCatchStorage redisCatchStorage; |
| | | |
| | | @Override |
| | | public DeviceChannel updateGps(DeviceChannel deviceChannel, Device device) { |
| | |
| | | public void updateChannel(String deviceId, DeviceChannel channel) { |
| | | String channelId = channel.getChannelId(); |
| | | channel.setDeviceId(deviceId); |
| | | // StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); |
| | | InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); |
| | | if (inviteInfo != null && inviteInfo.getStreamInfo() != null) { |
| | | channel.setStreamId(inviteInfo.getStreamInfo().getStream()); |
| | |
| | | } |
| | | channelMapper.updateChannelStreamIdentification(channel); |
| | | } |
| | | |
| | | @Override |
| | | public List<DeviceChannel> queryChaneListByDeviceId(String deviceId) { |
| | | return channelMapper.queryAllChannels(deviceId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateChannelGPS(Device device, DeviceChannel deviceChannel, MobilePosition mobilePosition) { |
| | | if (userSetting.getSavePositionHistory()) { |
| | | deviceMobilePositionMapper.insertNewPosition(mobilePosition); |
| | | } |
| | | |
| | | if (deviceChannel.getChannelId().equals(deviceChannel.getDeviceId())) { |
| | | deviceChannel.setChannelId(null); |
| | | } |
| | | if (deviceChannel.getGpsTime() == null) { |
| | | deviceChannel.setGpsTime(DateUtil.getNow()); |
| | | } |
| | | |
| | | int updated = channelMapper.updatePosition(deviceChannel); |
| | | if (updated == 0) { |
| | | return; |
| | | } |
| | | |
| | | List<DeviceChannel> deviceChannels = new ArrayList<>(); |
| | | if (deviceChannel.getChannelId() == null) { |
| | | // æç设å¤è¿é䏿¥çdeviceIdä¸ééIdæ¯ä¸æ ·ï¼è¿ç§æ
嵿´æ°è®¾å¤ä¸çå
¨é¨éé |
| | | List<DeviceChannel> deviceChannelsInDb = queryChaneListByDeviceId(device.getDeviceId()); |
| | | deviceChannels.addAll(deviceChannelsInDb); |
| | | }else { |
| | | deviceChannels.add(deviceChannel); |
| | | } |
| | | if (deviceChannels.isEmpty()) { |
| | | return; |
| | | } |
| | | if (deviceChannels.size() > 100) { |
| | | logger.warn("[æ´æ°ééä½ç½®ä¿¡æ¯ååééç¥] 设å¤å¯è½æ¯å¹³å°ï¼ä¸æ¥çä½ç½®ä¿¡æ¯æªæ æééç¼å·ï¼" + |
| | | "å¯¼è´ææééè¢«æ´æ°ä½ç½®ï¼ deviceId:{}", device.getDeviceId()); |
| | | } |
| | | for (DeviceChannel channel : deviceChannels) { |
| | | // åå
³èäºè¯¥ééå¹¶ä¸å¼å¯ç§»å¨ä½ç½®è®¢é
çä¸çº§å¹³å°åéç§»å¨ä½ç½®è®¢é
æ¶æ¯ |
| | | mobilePosition.setChannelId(channel.getChannelId()); |
| | | try { |
| | | eventPublisher.mobilePositionEventPublish(mobilePosition); |
| | | }catch (Exception e) { |
| | | logger.error("[åä¸çº§è½¬åç§»å¨ä½ç½®å¤±è´¥] ", e); |
| | | } |
| | | // åéredisæ¶æ¯ã éç¥ä½ç½®ä¿¡æ¯çåå |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("time", DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(mobilePosition.getTime())); |
| | | jsonObject.put("serial", mobilePosition.getDeviceId()); |
| | | jsonObject.put("code", mobilePosition.getChannelId()); |
| | | jsonObject.put("longitude", mobilePosition.getLongitude()); |
| | | jsonObject.put("latitude", mobilePosition.getLatitude()); |
| | | jsonObject.put("altitude", mobilePosition.getAltitude()); |
| | | jsonObject.put("direction", mobilePosition.getDirection()); |
| | | jsonObject.put("speed", mobilePosition.getSpeed()); |
| | | redisCatchStorage.sendMobilePositionMsg(jsonObject); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void stopPlay(String deviceId, String channelId) { |
| | | channelMapper.stopPlay(deviceId, channelId); |
| | | } |
| | | } |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper; |
| | | import com.genersoft.iot.vmp.utils.CloudRecordUtils; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; |
| | |
| | | |
| | | @Autowired |
| | | private DynamicTask dynamicTask; |
| | | |
| | | @Autowired |
| | | private CloudRecordServiceMapper cloudRecordServiceMapper; |
| | | |
| | | @Autowired |
| | | private ISIPCommanderForPlatform commanderForPlatform; |
| | |
| | | dynamicTask.startDelay(key, ()->{ |
| | | logger.info("[è¯é³å¹¿æ]çå¾
inviteæ¶æ¯è¶
æ¶ï¼{}/{}", device.getDeviceId(), channelId); |
| | | stopAudioBroadcast(device.getDeviceId(), channelId); |
| | | }, 2000); |
| | | }, 10*1000); |
| | | }, eventResultForError -> { |
| | | // åé失败 |
| | | logger.error("è¯é³å¹¿æåéå¤±è´¥ï¼ {}:{}", channelId, eventResultForError.msg); |
| | |
| | | logger.info("è°ç¨ZLMæ¨æµæ¥å£, ç»æï¼ {}", jsonObject); |
| | | logger.info("RTPæ¨æµæå[ {}/{} ]ï¼{}->{}, ", param.get("app"), param.get("stream"), jsonObject.getString("local_port"), |
| | | sendRtpItem.isTcpActive()?"被å¨åæµ": param.get("dst_url") + ":" + param.get("dst_port")); |
| | | if (sendRtpItem.getPlayType() == InviteStreamType.PUSH && correlationInfo instanceof ParentPlatform) { |
| | | ParentPlatform platform = (ParentPlatform)correlationInfo; |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, sendRtpItem.getApp(), sendRtpItem.getStream(), |
| | | sendRtpItem.getChannelId(), platform.getServerGBId(), platform.getName(), userSetting.getServerId(), |
| | | sendRtpItem.getMediaServerId()); |
| | | messageForPushChannel.setPlatFormIndex(platform.getId()); |
| | | redisCatchStorage.sendPlatformStartPlayMsg(messageForPushChannel); |
| | | } |
| | | } else { |
| | | logger.error("RTPæ¨æµå¤±è´¥: {}, åæ°ï¼{}", jsonObject.getString("msg"), JSONObject.toJSONString(param)); |
| | | if (sendRtpItem.isOnlyAudio()) { |
| | |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void stopPlay(Device device, String channelId) { |
| | | InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channelId); |
| | | if (inviteInfo == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "ç¹ææªæ¾å°"); |
| | | } |
| | | if (InviteSessionStatus.ok == inviteInfo.getStatus()) { |
| | | try { |
| | | logger.info("[åæ¢ç¹æ] {}/{}", device.getDeviceId(), channelId); |
| | | cmder.streamByeCmd(device, channelId, inviteInfo.getStream(), null, null); |
| | | } catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) { |
| | | logger.error("[å½ä»¤åé失败] åæ¢ç¹æï¼ åéBYE: {}", e.getMessage()); |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "å½ä»¤åé失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, device.getDeviceId(), channelId); |
| | | storager.stopPlay(device.getDeviceId(), channelId); |
| | | channelService.stopPlay(device.getDeviceId(), channelId); |
| | | if (inviteInfo.getStreamInfo() != null) { |
| | | mediaServerService.closeRTPServer(inviteInfo.getStreamInfo().getMediaServerId(), inviteInfo.getStream()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.conf.DynamicTask; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| | | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| | |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | |
| | | result = zlmresTfulUtils.addStreamProxy(mediaServerItem, param.getApp(), param.getStream(), param.getUrl().trim(), |
| | | param.isEnableAudio(), param.isEnableMp4(), param.getRtpType()); |
| | | } |
| | | System.out.println("addStreamProxyToZlm===="); |
| | | System.out.println(result); |
| | | if (result != null && result.getInteger("code") == 0) { |
| | | JSONObject data = result.getJSONObject("data"); |
| | | if (data == null) { |
| | |
| | | case WvpRedisMsgCmd.REQUEST_PUSH_STREAM: |
| | | RequestPushStreamMsg param = JSON.to(RequestPushStreamMsg.class, wvpRedisMsg.getContent()); |
| | | requestPushStreamMsgHand(param, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial()); |
| | | |
| | | break; |
| | | case WvpRedisMsgCmd.REQUEST_STOP_PUSH_STREAM: |
| | | RequestStopPushStreamMsg streamMsg = JSON.to(RequestStopPushStreamMsg.class, wvpRedisMsg.getContent()); |
| | | requestStopPushStreamMsgHand(streamMsg, wvpRedisMsg.getFromId(), wvpRedisMsg.getSerial()); |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| | | } |
| | | |
| | | /** |
| | | * åéè¯·æ±æ¨æµçæ¶æ¯ |
| | | */ |
| | | public void sendMsgForStopSendRtpStream(String serverId, RequestStopPushStreamMsg streamMsg) { |
| | | String key = UUID.randomUUID().toString(); |
| | | WvpRedisMsg redisMsg = WvpRedisMsg.getRequestInstance(userSetting.getServerId(), serverId, |
| | | WvpRedisMsgCmd.REQUEST_STOP_PUSH_STREAM, key, JSON.toJSONString(streamMsg)); |
| | | |
| | | JSONObject jsonObject = (JSONObject)JSON.toJSON(redisMsg); |
| | | logger.info("[REDIS 请æ±å
¶ä»å¹³å°åæ¢æ¨æµ] {}: {}", serverId, jsonObject); |
| | | redisTemplate.convertAndSend(WVP_PUSH_STREAM_KEY, jsonObject); |
| | | } |
| | | |
| | | private SendRtpItem querySendRTPServer(String platformGbId, String channelId, String streamId, String callId) { |
| | | if (platformGbId == null) { |
| | | platformGbId = "*"; |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å¤çæ¶å°çè¯·æ±æ¨æµçè¯·æ± |
| | | */ |
| | | private void requestStopPushStreamMsgHand(RequestStopPushStreamMsg streamMsg, String fromId, String serial) { |
| | | SendRtpItem sendRtpItem = streamMsg.getSendRtpItem(); |
| | | if (sendRtpItem == null) { |
| | | logger.info("[REDIS æ§è¡å
¶ä»å¹³å°ç请æ±åæ¢æ¨æµ] å¤±è´¥ï¼ sendRtpItem为NULL"); |
| | | return; |
| | | } |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | if (mediaInfo == null) { |
| | | // TODO åå¤é误 |
| | | return; |
| | | } |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app",sendRtpItem.getApp()); |
| | | param.put("stream",sendRtpItem.getStream()); |
| | | param.put("ssrc", sendRtpItem.getSsrc()); |
| | | |
| | | if (zlmServerFactory.stopSendRtpStream(mediaInfo, param)) { |
| | | logger.info("[REDIS æ§è¡å
¶ä»å¹³å°ç请æ±åæ¢æ¨æµ] æåï¼ {}/{}", sendRtpItem.getApp(), sendRtpItem.getStream()); |
| | | // åéredisæ¶æ¯ |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, |
| | | sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(), |
| | | sendRtpItem.getPlatformId(), streamMsg.getPlatformName(), userSetting.getServerId(), sendRtpItem.getMediaServerId()); |
| | | messageForPushChannel.setPlatFormIndex(streamMsg.getPlatFormIndex()); |
| | | redisCatchStorage.sendPlatformStopPlayMsg(messageForPushChannel); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamType; |
| | | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.IStreamPushService; |
| | |
| | | import javax.sip.InvalidArgumentException; |
| | | import javax.sip.SipException; |
| | | import java.text.ParseException; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | |
| | | MessageForPushChannel pushChannel = JSON.parseObject(message.getBody(), MessageForPushChannel.class); |
| | | StreamPushItem push = streamPushService.getPush(pushChannel.getApp(), pushChannel.getStream()); |
| | | if (push != null) { |
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChnnelId( |
| | | List<SendRtpItem> sendRtpItems = redisCatchStorage.querySendRTPServerByChannelId( |
| | | push.getGbId()); |
| | | if (!sendRtpItems.isEmpty()) { |
| | | for (SendRtpItem sendRtpItem : sendRtpItems) { |
| | |
| | | commanderFroPlatform.streamByeCmd(parentPlatform, sendRtpItem); |
| | | } catch (SipException | InvalidArgumentException | ParseException e) { |
| | | logger.error("[å½ä»¤åé失败] 彿 级è åéBYE: {}", e.getMessage()); |
| | | } |
| | | } |
| | | if (push.isSelf()) { |
| | | // 忢åä¸çº§æ¨æµ |
| | | String streamId = sendRtpItem.getStream(); |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("vhost","__defaultVhost__"); |
| | | param.put("app",sendRtpItem.getApp()); |
| | | param.put("stream",streamId); |
| | | param.put("ssrc",sendRtpItem.getSsrc()); |
| | | logger.info("[REDISæ¶æ¯-æ¨æµç»æ] 忢åä¸çº§æ¨æµï¼{}", streamId); |
| | | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| | | redisCatchStorage.deleteSendRTPServer(sendRtpItem.getPlatformId(), sendRtpItem.getChannelId(), sendRtpItem.getCallId(), sendRtpItem.getStream()); |
| | | zlmServerFactory.stopSendRtpStream(mediaInfo, param); |
| | | if (InviteStreamType.PUSH == sendRtpItem.getPlayType()) { |
| | | MessageForPushChannel messageForPushChannel = MessageForPushChannel.getInstance(0, |
| | | sendRtpItem.getApp(), sendRtpItem.getStream(), sendRtpItem.getChannelId(), |
| | | sendRtpItem.getPlatformId(), parentPlatform.getName(), userSetting.getServerId(), sendRtpItem.getMediaServerId()); |
| | | messageForPushChannel.setPlatFormIndex(parentPlatform.getId()); |
| | | redisCatchStorage.sendPlatformStopPlayMsg(messageForPushChannel); |
| | | } |
| | | } |
| | | } |
| | |
| | | streamPushItemForSave.add(streamPushItem); |
| | | allGBId.put(streamPushItem.getGbId(), streamPushItem); |
| | | } else { |
| | | if (allGBId.containsKey(streamPushItem.getGbId())) { |
| | | if (allGBId.containsKey(streamPushItem.getGbId()) |
| | | && (!allGBId.get(streamPushItem.getGbId()).getApp().equals(streamPushItem.getApp()) || !allGBId.get(streamPushItem.getGbId()).getStream().equals(streamPushItem.getStream()))) { |
| | | GbStream gbStream = allGBId.get(streamPushItem.getGbId()); |
| | | logger.warn("[REDISæ¶æ¯-æ¨æµè®¾å¤åè¡¨æ´æ°-UPDATE] 彿 ç¼å·éå¤: {}, å·²åé
ç»{}/{}", |
| | | streamPushItem.getGbId(), gbStream.getApp(), gbStream.getStream()); |
| | |
| | | package com.genersoft.iot.vmp.service.redisMsg; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Override |
| | | public void onMessage(Message message, byte[] bytes) { |
| | | boolean isEmpty = taskQueue.isEmpty(); |
| | | taskQueue.offer(message); |
| | | if (isEmpty) { |
| | | taskExecutor.execute(() -> { |
| | | while (!taskQueue.isEmpty()) { |
| | | Message msg = taskQueue.poll(); |
| | | try { |
| | | JSONObject steamMsgJson = JSON.parseObject(msg.getBody(), JSONObject.class); |
| | | if (steamMsgJson == null) { |
| | | logger.warn("[æ¶å°redis æµåå]æ¶æ¯è§£æå¤±è´¥"); |
| | | continue; |
| | | } |
| | | String serverId = steamMsgJson.getString("serverId"); |
| | | |
| | | if (userSetting.getServerId().equals(serverId)) { |
| | | // èªå·±åéçæ¶æ¯å¿½ç¥å³å¯ |
| | | continue; |
| | | } |
| | | logger.info("[æ¶å°redis æµåå]ï¼ {}", new String(message.getBody())); |
| | | String app = steamMsgJson.getString("app"); |
| | | String stream = steamMsgJson.getString("stream"); |
| | | boolean register = steamMsgJson.getBoolean("register"); |
| | | String mediaServerId = steamMsgJson.getString("mediaServerId"); |
| | | OnStreamChangedHookParam onStreamChangedHookParam = new OnStreamChangedHookParam(); |
| | | onStreamChangedHookParam.setSeverId(serverId); |
| | | onStreamChangedHookParam.setApp(app); |
| | | onStreamChangedHookParam.setStream(stream); |
| | | onStreamChangedHookParam.setRegist(register); |
| | | onStreamChangedHookParam.setMediaServerId(mediaServerId); |
| | | onStreamChangedHookParam.setCreateStamp(System.currentTimeMillis()/1000); |
| | | onStreamChangedHookParam.setAliveSecond(0L); |
| | | onStreamChangedHookParam.setTotalReaderCount("0"); |
| | | onStreamChangedHookParam.setOriginType(0); |
| | | onStreamChangedHookParam.setOriginTypeStr("0"); |
| | | onStreamChangedHookParam.setOriginTypeStr("unknown"); |
| | | if (register) { |
| | | zlmMediaListManager.addPush(onStreamChangedHookParam); |
| | | }else { |
| | | zlmMediaListManager.removeMedia(app, stream); |
| | | } |
| | | }catch (Exception e) { |
| | | logger.warn("[REDISæ¶æ¯-æµåå] åç°æªå¤ççå¼å¸¸, \r\n{}", JSON.toJSONString(message)); |
| | | logger.error("[REDISæ¶æ¯-æµåå] å¼å¸¸å
å®¹ï¼ ", e); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | // boolean isEmpty = taskQueue.isEmpty(); |
| | | // taskQueue.offer(message); |
| | | // if (isEmpty) { |
| | | // taskExecutor.execute(() -> { |
| | | // while (!taskQueue.isEmpty()) { |
| | | // Message msg = taskQueue.poll(); |
| | | // try { |
| | | // JSONObject steamMsgJson = JSON.parseObject(msg.getBody(), JSONObject.class); |
| | | // if (steamMsgJson == null) { |
| | | // logger.warn("[æ¶å°redis æµåå]æ¶æ¯è§£æå¤±è´¥"); |
| | | // continue; |
| | | // } |
| | | // String serverId = steamMsgJson.getString("serverId"); |
| | | // |
| | | // if (userSetting.getServerId().equals(serverId)) { |
| | | // // èªå·±åéçæ¶æ¯å¿½ç¥å³å¯ |
| | | // continue; |
| | | // } |
| | | // logger.info("[æ¶å°redis æµåå]ï¼ {}", new String(message.getBody())); |
| | | // String app = steamMsgJson.getString("app"); |
| | | // String stream = steamMsgJson.getString("stream"); |
| | | // boolean register = steamMsgJson.getBoolean("register"); |
| | | // String mediaServerId = steamMsgJson.getString("mediaServerId"); |
| | | // OnStreamChangedHookParam onStreamChangedHookParam = new OnStreamChangedHookParam(); |
| | | // onStreamChangedHookParam.setSeverId(serverId); |
| | | // onStreamChangedHookParam.setApp(app); |
| | | // onStreamChangedHookParam.setStream(stream); |
| | | // onStreamChangedHookParam.setRegist(register); |
| | | // onStreamChangedHookParam.setMediaServerId(mediaServerId); |
| | | // onStreamChangedHookParam.setCreateStamp(System.currentTimeMillis()/1000); |
| | | // onStreamChangedHookParam.setAliveSecond(0L); |
| | | // onStreamChangedHookParam.setTotalReaderCount("0"); |
| | | // onStreamChangedHookParam.setOriginType(0); |
| | | // onStreamChangedHookParam.setOriginTypeStr("0"); |
| | | // onStreamChangedHookParam.setOriginTypeStr("unknown"); |
| | | // if (register) { |
| | | // zlmMediaListManager.addPush(onStreamChangedHookParam); |
| | | // }else { |
| | | // zlmMediaListManager.removeMedia(app, stream); |
| | | // } |
| | | // }catch (Exception e) { |
| | | // logger.warn("[REDISæ¶æ¯-æµåå] åç°æªå¤ççå¼å¸¸, \r\n{}", JSON.toJSONString(message)); |
| | | // logger.error("[REDISæ¶æ¯-æµåå] å¼å¸¸å
å®¹ï¼ ", e); |
| | | // } |
| | | // } |
| | | // }); |
| | | // } |
| | | } |
| | | } |
| | |
| | | */ |
| | | void sendStreamPushRequestedMsgForStatus(); |
| | | |
| | | List<SendRtpItem> querySendRTPServerByChnnelId(String channelId); |
| | | List<SendRtpItem> querySendRTPServerByChannelId(String channelId); |
| | | |
| | | List<SendRtpItem> querySendRTPServerByStream(String stream); |
| | | |
| | |
| | | |
| | | void addPushListItem(String app, String stream, OnStreamChangedHookParam param); |
| | | |
| | | OnStreamChangedHookParam getPushListItem(String app, String stream); |
| | | |
| | | void removePushListItem(String app, String stream, String mediaServerId); |
| | | |
| | | void sendPushStreamClose(MessageForPushChannel messageForPushChannel); |
| | | |
| | | } |
| | |
| | | "longitude_wgs84, latitude_wgs84, has_audio, create_time, update_time, business_group_id, gps_time, stream_identification) " + |
| | | "VALUES (#{channelId}, #{deviceId}, #{name}, #{manufacture}, #{model}, #{owner}, #{civilCode}, #{block}," + |
| | | "#{address}, #{parental}, #{parentId}, #{safetyWay}, #{registerWay}, #{certNum}, #{certifiable}, #{errCode}, #{secrecy}, " + |
| | | "#{ipAddress}, #{port}, #{password}, #{PTZType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + |
| | | "#{ipAddress}, #{port}, #{password}, #{ptzType}, #{status}, #{streamId}, #{longitude}, #{latitude}, #{longitudeGcj02}, " + |
| | | "#{latitudeGcj02}, #{longitudeWgs84}, #{latitudeWgs84}, #{hasAudio}, #{createTime}, #{updateTime}, #{businessGroupId}, #{gpsTime}, #{streamIdentification})") |
| | | int add(DeviceChannel channel); |
| | | |
| | |
| | | "<if test='ipAddress != null'>, ip_address=#{ipAddress}</if>" + |
| | | "<if test='port != null'>, port=#{port}</if>" + |
| | | "<if test='password != null'>, password=#{password}</if>" + |
| | | "<if test='PTZType != null'>, custom_ptz_type=#{PTZType}</if>" + |
| | | "<if test='ptzType != null'>, custom_ptz_type=#{ptzType}</if>" + |
| | | "<if test='status != null'>, status=#{status}</if>" + |
| | | "<if test='streamId != null'>, stream_id=#{streamId}</if>" + |
| | | "<if test='hasAudio != null'>, has_audio=#{hasAudio}</if>" + |
| | |
| | | "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," + |
| | | "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " + |
| | | "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " + |
| | | "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " + |
| | | "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.ptzType}, #{item.status}, " + |
| | | "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + |
| | | "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + |
| | | "#{item.businessGroupId}, #{item.gpsTime}, #{item.streamIdentification}) " + |
| | |
| | | "#{item.owner}, #{item.civilCode}, #{item.block},#{item.subCount}," + |
| | | "#{item.address}, #{item.parental}, #{item.parentId}, #{item.safetyWay}, #{item.registerWay}, " + |
| | | "#{item.certNum}, #{item.certifiable}, #{item.errCode}, #{item.secrecy}, " + |
| | | "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.PTZType}, #{item.status}, " + |
| | | "#{item.ipAddress}, #{item.port}, #{item.password}, #{item.ptzType}, #{item.status}, " + |
| | | "#{item.streamId}, #{item.longitude}, #{item.latitude},#{item.longitudeGcj02}, " + |
| | | "#{item.latitudeGcj02},#{item.longitudeWgs84}, #{item.latitudeWgs84}, #{item.hasAudio}, now(), now(), " + |
| | | "#{item.businessGroupId}, #{item.gpsTime}) " + |
| | |
| | | "<if test='item.ipAddress != null'>, ip_address=#{item.ipAddress}</if>" + |
| | | "<if test='item.port != null'>, port=#{item.port}</if>" + |
| | | "<if test='item.password != null'>, password=#{item.password}</if>" + |
| | | "<if test='item.PTZType != null'>, ptz_type=#{item.PTZType}</if>" + |
| | | "<if test='item.ptzType != null'>, ptz_type=#{item.ptzType}</if>" + |
| | | "<if test='item.status != null'>, status=#{item.status}</if>" + |
| | | "<if test='item.streamId != null'>, stream_id=#{item.streamId}</if>" + |
| | | "<if test='item.hasAudio != null'>, has_audio=#{item.hasAudio}</if>" + |
| | |
| | | "WHERE device_id=#{deviceId} " + |
| | | " <if test='channelId != null' > AND channel_id=#{channelId}</if>" + |
| | | " </script>"}) |
| | | void updatePosition(DeviceChannel deviceChannel); |
| | | int updatePosition(DeviceChannel deviceChannel); |
| | | |
| | | @Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0") |
| | | List<DeviceChannel> getAllChannelInPlay(); |
| | |
| | | "charset,"+ |
| | | "ssrc_check,"+ |
| | | "as_message_channel,"+ |
| | | "broadcastPushAfterAck,"+ |
| | | "broadcast_push_after_ack,"+ |
| | | "geo_coord_sys,"+ |
| | | "on_line,"+ |
| | | "media_server_id"+ |
| | |
| | | |
| | | @Insert("INSERT INTO wvp_platform (enable, name, server_gb_id, server_gb_domain, server_ip, server_port,device_gb_id,device_ip,"+ |
| | | "device_port,username,password,expires,keep_timeout,transport,character_set,ptz,rtcp,as_message_channel,auto_push_channel,"+ |
| | | "status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time) " + |
| | | "status,start_offline_push,catalog_id,administrative_division,catalog_group,create_time,update_time,send_stream_ip) " + |
| | | " VALUES (#{enable}, #{name}, #{serverGBId}, #{serverGBDomain}, #{serverIP}, #{serverPort}, #{deviceGBId}, #{deviceIp}, " + |
| | | " #{devicePort}, #{username}, #{password}, #{expires}, #{keepTimeout}, #{transport}, #{characterSet}, #{ptz}, #{rtcp}, #{asMessageChannel}, #{autoPushChannel}, " + |
| | | " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime})") |
| | | " #{status}, #{startOfflinePush}, #{catalogId}, #{administrativeDivision}, #{catalogGroup}, #{createTime}, #{updateTime}, #{sendStreamIp})") |
| | | int addParentPlatform(ParentPlatform parentPlatform); |
| | | |
| | | @Update("UPDATE wvp_platform " + |
| | |
| | | "administrative_division=#{administrativeDivision}, " + |
| | | "create_time=#{createTime}, " + |
| | | "update_time=#{updateTime}, " + |
| | | "send_stream_ip=#{sendStreamIp}, " + |
| | | "catalog_id=#{catalogId} " + |
| | | "WHERE id=#{id}") |
| | | int updateParentPlatform(ParentPlatform parentPlatform); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<SendRtpItem> querySendRTPServerByChnnelId(String channelId) { |
| | | public List<SendRtpItem> querySendRTPServerByChannelId(String channelId) { |
| | | if (channelId == null) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public OnStreamChangedHookParam getPushListItem(String app, String stream) { |
| | | String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream; |
| | | return (OnStreamChangedHookParam)redisTemplate.opsForValue().get(key); |
| | | } |
| | | |
| | | @Override |
| | | public void removePushListItem(String app, String stream, String mediaServerId) { |
| | | String key = VideoManagerConstants.PUSH_STREAM_LIST + app + "_" + stream; |
| | | OnStreamChangedHookParam param = (OnStreamChangedHookParam)redisTemplate.opsForValue().get(key); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void sendPushStreamClose(MessageForPushChannel msg) { |
| | | String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_CLOSE_REQUESTED; |
| | | logger.info("[redisåééç¥] åé 忢åä¸çº§æ¨æµ {}: {}/{}->{}", key, msg.getApp(), msg.getStream(), msg.getPlatFormId()); |
| | | redisTemplate.convertAndSend(key, JSON.toJSON(msg)); |
| | | } |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.vmanager.cloudRecord; |
| | | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.genersoft.iot.vmp.conf.DynamicTask; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.conf.security.JwtUtils; |
| | | import com.genersoft.iot.vmp.media.zlm.SendRtpPortManager; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.service.ICloudRecordService; |
| | | import com.genersoft.iot.vmp.service.IMediaServerService; |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | 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.cmd.impl.SIPCommander; |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | private IVideoManagerStorage storager; |
| | | |
| | | @Autowired |
| | | private SIPCommander cmder; |
| | | private ISIPCommander cmder; |
| | | |
| | | @Autowired |
| | | private DeferredResultHolder resultHolder; |
| | |
| | | @Operation(summary = "çå®ä½æ§å¶", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "deviceId", description = "设å¤å½æ ç¼å·", required = true) |
| | | @Parameter(name = "channelId", description = "éé彿 ç¼å·", required = true) |
| | | @Parameter(name = "enabled", description = "æ¯å¦å¼å¯çå®ä½ 1:å¼å¯,0:å
³é", required = true) |
| | | @Parameter(name = "enabled", description = "æ¯å¦å¼å¯çå®ä½", required = true) |
| | | @Parameter(name = "presetIndex", description = "è°ç¨é¢ç½®ä½ç¼å·") |
| | | @Parameter(name = "resetTime", description = "èªå¨å½ä½æ¶é´é´é") |
| | | @GetMapping("/home_position/{deviceId}/{enabled}") |
| | | public DeferredResult<String> homePositionApi(@PathVariable String deviceId, |
| | | @PathVariable String enabled, |
| | | @RequestParam(required = false) String resetTime, |
| | | @RequestParam(required = false) String presetIndex, |
| | | String channelId) { |
| | | @Parameter(name = "resetTime", description = "èªå¨å½ä½æ¶é´é´é åä½ï¼ç§") |
| | | @GetMapping("/home_position") |
| | | public DeferredResult<String> homePositionApi(String deviceId, String channelId, Boolean enabled, |
| | | @RequestParam(required = false) Integer resetTime, |
| | | @RequestParam(required = false) Integer presetIndex) { |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("æ¥è¦å¤ä½APIè°ç¨"); |
| | | } |
| | |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.common.InviteInfo; |
| | | import com.genersoft.iot.vmp.common.InviteSessionStatus; |
| | | import com.genersoft.iot.vmp.common.InviteSessionType; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| | | import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException; |
| | | import com.genersoft.iot.vmp.conf.security.JwtUtils; |
| | | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| | | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| | |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.*; |
| | | import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; |
| | | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| | | import com.genersoft.iot.vmp.vmanager.bean.StreamContent; |
| | | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| | |
| | | import org.springframework.web.context.request.async.DeferredResult; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.sip.InvalidArgumentException; |
| | | import javax.sip.SipException; |
| | | import java.net.MalformedURLException; |
| | | import java.net.URL; |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | |
| | |
| | | wvpResult.setMsg(msg); |
| | | } |
| | | requestMessage.setData(wvpResult); |
| | | resultHolder.invokeResult(requestMessage); |
| | | // æ¤å¤å¿
须鿾ææè¯·æ± |
| | | resultHolder.invokeAllResult(requestMessage); |
| | | }); |
| | | return result; |
| | | } |
| | |
| | | @Operation(summary = "åæ¢ç¹æ", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "deviceId", description = "设å¤å½æ ç¼å·", required = true) |
| | | @Parameter(name = "channelId", description = "éé彿 ç¼å·", required = true) |
| | | @Parameter(name = "isSubStream", description = "æ¯å¦åç æµï¼true-åç æµï¼false-ä¸»ç æµï¼ï¼é»è®¤ä¸ºfalse", required = true) |
| | | @GetMapping("/stop/{deviceId}/{channelId}") |
| | | public JSONObject playStop(@PathVariable String deviceId, @PathVariable String channelId,boolean isSubStream) { |
| | | public JSONObject playStop(@PathVariable String deviceId, @PathVariable String channelId) { |
| | | |
| | | logger.debug(String.format("设å¤é¢è§/忾忢APIè°ç¨ï¼streamIdï¼%s_%s", deviceId, channelId )); |
| | | |
| | |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "设å¤[" + deviceId + "]ä¸åå¨"); |
| | | } |
| | | |
| | | InviteInfo inviteInfo = inviteStreamService.getInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); |
| | | if (inviteInfo == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "ç¹ææªæ¾å°"); |
| | | } |
| | | if (InviteSessionStatus.ok == inviteInfo.getStatus()) { |
| | | try { |
| | | logger.info("[åæ¢ç¹æ] {}/{}", device.getDeviceId(), channelId); |
| | | cmder.streamByeCmd(device, channelId, inviteInfo.getStream(), null, null); |
| | | } catch (InvalidArgumentException | SipException | ParseException | SsrcTransactionNotFoundException e) { |
| | | logger.error("[å½ä»¤åé失败] åæ¢ç¹æï¼ åéBYE: {}", e.getMessage()); |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "å½ä»¤åé失败: " + e.getMessage()); |
| | | } |
| | | } |
| | | inviteStreamService.removeInviteInfoByDeviceAndChannel(InviteSessionType.PLAY, deviceId, channelId); |
| | | storager.stopPlay(deviceId, channelId); |
| | | |
| | | playService.stopPlay(device, channelId); |
| | | JSONObject json = new JSONObject(); |
| | | json.put("deviceId", deviceId); |
| | | json.put("channelId", channelId); |
| | | json.put("isSubStream", isSubStream); |
| | | return json; |
| | | } |
| | | |
| | |
| | | device-status-notify: true |
| | | # [å¯é] æ¥å¿é
ç½®, ä¸è¬ä¸éè¦æ¹ |
| | | logging: |
| | | config: classpath:logback-spring-local.xml |
| | | config: classpath:logback-spring.xml |
| | | |
| | |
| | | <span v-show="!scope.row.edit">{{ scope.row.location }}</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="ptztype" label="äºå°ç±»å" min-width="100"> |
| | | <el-table-column prop="ptzType" label="äºå°ç±»å" min-width="100"> |
| | | <template v-slot:default="scope"> |
| | | <el-select v-show="scope.row.edit" v-model="scope.row.ptztype" |
| | | <el-select v-show="scope.row.edit" v-model="scope.row.ptzType" |
| | | placeholder="äºå°ç±»å" filterable> |
| | | <el-option |
| | | v-for="(value, key) in ptzTypes" |
| | |
| | | :value="key" |
| | | /> |
| | | </el-select> |
| | | <div v-show="!scope.row.edit">{{ scope.row.ptztypeText }}</div> |
| | | <div v-show="!scope.row.edit">{{ scope.row.ptzTypeText }}</div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å¼å¯é³é¢" min-width="100"> |
| | |
| | | @click="changeSubchannel(scope.row)">æ¥ç |
| | | </el-button> |
| | | <el-divider v-if="scope.row.subCount > 0 || scope.row.parental === 1" direction="vertical"></el-divider> |
| | | <el-button size="medium" v-bind:disabled="device == null || device.online === 0" |
| | | icon="el-icon-video-camera" |
| | | type="text" @click="queryRecords(scope.row)">设å¤å½å |
| | | <!-- <el-button size="medium" v-bind:disabled="device == null || device.online === 0"--> |
| | | <!-- icon="el-icon-video-camera"--> |
| | | <!-- type="text" @click="queryRecords(scope.row)">设å¤å½å--> |
| | | <!-- </el-button>--> |
| | | <!-- <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy"--> |
| | | <!-- type="text" @click="queryCloudRecords(scope.row)">äºç«¯å½å--> |
| | | <!-- </el-button>--> |
| | | <el-dropdown @command="(command)=>{moreClick(command, scope.row)}"> |
| | | <el-button size="medium" type="text" > |
| | | æ´å¤åè½<i class="el-icon-arrow-down el-icon--right"></i> |
| | | </el-button> |
| | | <el-button size="medium" v-bind:disabled="device == null || device.online === 0" icon="el-icon-cloudy" |
| | | type="text" @click="queryCloudRecords(scope.row)">äºç«¯å½å |
| | | </el-button> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <el-dropdown-item command="records" v-bind:disabled="device == null || device.online === 0"> |
| | | 设å¤å½å</el-dropdown-item> |
| | | <el-dropdown-item command="cloudRecords" v-bind:disabled="device == null || device.online === 0" > |
| | | äºç«¯å½å</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | that.total = res.data.data.total; |
| | | that.deviceChannelList = res.data.data.list; |
| | | that.deviceChannelList.forEach(e => { |
| | | e.ptztype = e.ptztype + ""; |
| | | e.ptzType = e.ptzType + ""; |
| | | that.$set(e, "edit", false); |
| | | that.$set(e, "location", ""); |
| | | if (e.longitude && e.latitude) { |
| | |
| | | that.isLoging = false; |
| | | // that.$message.error("请æ±è¶
æ¶"); |
| | | }); |
| | | }, |
| | | moreClick: function (command, itemData) { |
| | | if (command === "records") { |
| | | this.queryRecords(itemData) |
| | | }else if (command === "cloudRecords") { |
| | | this.queryCloudRecords(itemData) |
| | | } |
| | | }, |
| | | queryRecords: function (itemData) { |
| | | let deviceId = this.deviceId; |
| | |
| | | this.total = res.data.data.total; |
| | | this.deviceChannelList = res.data.data.list; |
| | | this.deviceChannelList.forEach(e => { |
| | | e.ptztype = e.ptztype + ""; |
| | | e.ptzType = e.ptzType + ""; |
| | | this.$set(e, "edit", false); |
| | | this.$set(e, "location", ""); |
| | | if (e.longitude && e.latitude) { |
| | |
| | | type = 2; |
| | | } |
| | | console.log(type) |
| | | if (item.basicData.ptztype === 1 ) { // 1-çæº;2-åç;3-åºå®æªæº;4-饿§æªæº |
| | | if (item.basicData.ptzType === 1 ) { // 1-çæº;2-åç;3-åºå®æªæº;4-饿§æªæº |
| | | type = 4; |
| | | }else if (item.basicData.ptztype === 2) { |
| | | }else if (item.basicData.ptzType === 2) { |
| | | type = 5; |
| | | }else if (item.basicData.ptztype === 3 || item.basicData.ptztype === 4) { |
| | | }else if (item.basicData.ptzType === 3 || item.basicData.ptzType === 4) { |
| | | type = 6; |
| | | } |
| | | }else { |
| | |
| | | <el-descriptions-item label="设å¤å½å±" >{{channel.owner}}</el-descriptions-item> |
| | | <el-descriptions-item label="è¡æ¿åºå" >{{channel.civilCode}}</el-descriptions-item> |
| | | <el-descriptions-item label="å®è£
å°å" >{{channel.address}}</el-descriptions-item> |
| | | <el-descriptions-item label="äºå°ç±»å" >{{channel.ptztypeText}}</el-descriptions-item> |
| | | <el-descriptions-item label="äºå°ç±»å" >{{channel.ptzTypeText}}</el-descriptions-item> |
| | | <el-descriptions-item label="ç»çº¬åº¦" >{{channel.longitude}},{{channel.latitude}}</el-descriptions-item> |
| | | <el-descriptions-item label="ç¶æ"> |
| | | <el-tag size="small" v-if="channel.status === 1">å¨çº¿</el-tag> |
| | |
| | | <el-form-item label="æ¬å°ç«¯å£" prop="devicePort"> |
| | | <el-input v-model="platform.devicePort" :disabled="true" type="number"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="SIP认è¯ç¨æ·å" prop="username"> |
| | | <el-input v-model="platform.username"></el-input> |
| | | <el-form-item label="SDPåæµIP" prop="sendStreamIp"> |
| | | <el-input v-model="platform.sendStreamIp"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-col> |
| | |
| | | <el-form ref="platform2" :rules="rules" :model="platform" label-width="160px"> |
| | | <el-form-item label="è¡æ¿åºå" prop="administrativeDivision"> |
| | | <el-input v-model="platform.administrativeDivision" clearable></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="SIP认è¯ç¨æ·å" prop="username"> |
| | | <el-input v-model="platform.username"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="SIP认è¯å¯ç " prop="password"> |
| | | <el-input v-model="platform.password" ></el-input> |
| | |
| | | characterSet: "GB2312", |
| | | startOfflinePush: false, |
| | | catalogGroup: 1, |
| | | administrativeDivision: null, |
| | | administrativeDivision: "", |
| | | sendStreamIp: null, |
| | | }, |
| | | rules: { |
| | | name: [{ required: true, message: "请è¾å
¥å¹³å°åç§°", trigger: "blur" }], |
| | |
| | | that.platform.devicePort = res.data.data.devicePort; |
| | | that.platform.username = res.data.data.username; |
| | | that.platform.password = res.data.data.password; |
| | | that.platform.sendStreamIp = res.data.data.sendStreamIp; |
| | | that.platform.administrativeDivision = res.data.data.username.substr(0, 6); |
| | | } |
| | | |
| | |
| | | this.platform.catalogId = platform.catalogId; |
| | | this.platform.startOfflinePush = platform.startOfflinePush; |
| | | this.platform.catalogGroup = platform.catalogGroup; |
| | | this.platform.sendStreamIp = platform.sendStreamIp; |
| | | this.platform.administrativeDivision = platform.administrativeDivision; |
| | | this.onSubmit_text = "ä¿å"; |
| | | this.saveUrl = "/api/platform/save"; |
| | |
| | | zlmsdpUrl: url,//æµå°å |
| | | simulecast: false, |
| | | useCamera: false, |
| | | audioEnable: false, |
| | | videoEnable: false, |
| | | audioEnable: true, |
| | | videoEnable: true, |
| | | recvOnly: true, |
| | | }) |
| | | webrtcPlayer.on(ZLMRTCClient.Events.WEBRTC_ICE_CANDIDATE_ERROR,(e)=>{// ICE åååºé |
| | |
| | | }, |
| | | getImageByChannel: function (channel) { |
| | | let src = "static/images/gis/camera.png" |
| | | switch (channel.ptztype) { |
| | | switch (channel.ptzType) { |
| | | case 1: |
| | | if (channel.status === 1) { |
| | | src = "static/images/gis/camera1.png" |
| | |
| | | update_time character varying(50), |
| | | as_message_channel bool default false, |
| | | auto_push_channel bool default false, |
| | | send_stream_ip character varying(50), |
| | | constraint uk_platform_unique_server_gb_id unique (server_gb_id) |
| | | ); |
| | | |
| | |
| | | update_time character varying(50), |
| | | as_message_channel bool default false, |
| | | auto_push_channel bool default false, |
| | | send_stream_ip character varying(50), |
| | | constraint uk_platform_unique_server_gb_id unique (server_gb_id) |
| | | ); |
| | | |
| | |
| | | |
| | | alter table wvp_device |
| | | drop switch_primary_sub_stream; |
| | | |
| | | alter table wvp_platform |
| | | add send_stream_ip character varying(50); |
| | |
| | | |
| | | alter table wvp_device |
| | | drop switch_primary_sub_stream; |
| | | |
| | | alter table wvp_platform |
| | | add send_stream_ip character varying(50); |