Commit bb50a243145dba2b3bf5f3bf225c63a092697a16
Committed by
GitHub
Merge branch '648540858:wvp-28181-2.0' into wvp-28181-2.0
Showing
52 changed files
with
1033 additions
and
293 deletions
README.md
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | [](https://github.com/xia-chu/ZLMediaKit/pulls) | 8 | [](https://github.com/xia-chu/ZLMediaKit/pulls) |
| 9 | 9 | ||
| 10 | 10 | ||
| 11 | -WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗像嚗提摰敹縑隞支挽憭恣AT蝛輸絲摨瑯之PCVRVR漣tsp/rtmp蝑蓮像嚗tsp/rtmp蝑瘚蓮像 | 11 | +WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗像嚗提摰敹縑隞支挽憭恣AT蝛輸絲摨瑯之PCVR漣蒂/瘚/瘚蓮隞像 |
| 12 | 12 | ||
| 13 | 瘚鈭LMediaKit-https://github.com/xiongziliang/ZLMediaKit | 13 | 瘚鈭LMediaKit-https://github.com/xiongziliang/ZLMediaKit |
| 14 | 14 | ||
| @@ -31,11 +31,13 @@ WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗 | @@ -31,11 +31,13 @@ WEB VIDEO PLATFORM銝銝芸鈭B28181-2016蝞勗 | ||
| 31 | https://gitee.com/pan648540858/wvp-GB28181-pro.git | 31 | https://gitee.com/pan648540858/wvp-GB28181-pro.git |
| 32 | 32 | ||
| 33 | # | 33 | # |
| 34 | - | ||
| 35 | - | ||
| 36 | - | ||
| 37 | - | ||
| 38 | - | 34 | + |
| 35 | + | ||
| 36 | + | ||
| 37 | + | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + | ||
| 39 | 41 | ||
| 40 | # 1.0 蝖 | 42 | # 1.0 蝖 |
| 41 | 1. 閫; | 43 | 1. 閫; |
| @@ -79,7 +81,7 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | @@ -79,7 +81,7 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | ||
| 79 | - [X] 蝘餃雿蔭憭 | 81 | - [X] 蝘餃雿蔭憭 |
| 80 | - [X] 霅虫辣霈a | 82 | - [X] 霅虫辣霈a |
| 81 | - [X] 霅虫辣憭 | 83 | - [X] 霅虫辣憭 |
| 82 | - - [ ] 霈曉敶恥 | 84 | + - [X] 霈曉敶恥 |
| 83 | - [X] 霈曉敶憭 | 85 | - [X] 霈曉敶憭 |
| 84 | 16. 蝘餃雿蔭霂W蝷綽蔭辣霈曄蔭蝘餃雿蔭摮 | 86 | 16. 蝘餃雿蔭霂W蝷綽蔭辣霈曄蔭蝘餃雿蔭摮 |
| 85 | 87 | ||
| @@ -96,6 +98,9 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | @@ -96,6 +98,9 @@ https://gitee.com/pan648540858/wvp-GB28181-pro.git | ||
| 96 | - [X] 撟喳靽⊥霂 | 98 | - [X] 撟喳靽⊥霂 |
| 97 | - [X] 撟喳餈 | 99 | - [X] 撟喳餈 |
| 98 | - [X] 瘥葵蝥扯像摰敶 | 100 | - [X] 瘥葵蝥扯像摰敶 |
| 101 | + - [X] 敶恥 | ||
| 102 | + - [X] 敶 | ||
| 103 | + - [X] GPS霈a嚗瘚 | ||
| 99 | - [X] 瘛餃TSP閫 | 104 | - [X] 瘛餃TSP閫 |
| 100 | - [X] 瘛餃 | 105 | - [X] 瘛餃 |
| 101 | - [X] 瘛餃TMP閫 | 106 | - [X] 瘛餃TMP閫 |
pom.xml
| @@ -253,10 +253,6 @@ | @@ -253,10 +253,6 @@ | ||
| 253 | <artifactId>spring-boot-starter-test</artifactId> | 253 | <artifactId>spring-boot-starter-test</artifactId> |
| 254 | <!-- <scope>test</scope>--> | 254 | <!-- <scope>test</scope>--> |
| 255 | </dependency> | 255 | </dependency> |
| 256 | - <dependency> | ||
| 257 | - <groupId>org.projectlombok</groupId> | ||
| 258 | - <artifactId>lombok</artifactId> | ||
| 259 | - </dependency> | ||
| 260 | </dependencies> | 256 | </dependencies> |
| 261 | 257 | ||
| 262 | 258 |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -4,11 +4,6 @@ package com.genersoft.iot.vmp.gb28181.bean; | @@ -4,11 +4,6 @@ package com.genersoft.iot.vmp.gb28181.bean; | ||
| 4 | public class Device { | 4 | public class Device { |
| 5 | 5 | ||
| 6 | /** | 6 | /** |
| 7 | - * Id | ||
| 8 | - */ | ||
| 9 | - private int id; | ||
| 10 | - | ||
| 11 | - /** | ||
| 12 | * 设备Id | 7 | * 设备Id |
| 13 | */ | 8 | */ |
| 14 | private String deviceId; | 9 | private String deviceId; |
| @@ -119,13 +114,7 @@ public class Device { | @@ -119,13 +114,7 @@ public class Device { | ||
| 119 | */ | 114 | */ |
| 120 | private int subscribeCycleForCatalog ; | 115 | private int subscribeCycleForCatalog ; |
| 121 | 116 | ||
| 122 | - public int getId() { | ||
| 123 | - return id; | ||
| 124 | - } | ||
| 125 | 117 | ||
| 126 | - public void setId(int id) { | ||
| 127 | - this.id = id; | ||
| 128 | - } | ||
| 129 | 118 | ||
| 130 | public String getDeviceId() { | 119 | public String getDeviceId() { |
| 131 | return deviceId; | 120 | return deviceId; |
| @@ -294,6 +283,4 @@ public class Device { | @@ -294,6 +283,4 @@ public class Device { | ||
| 294 | public void setSubscribeCycleForCatalog(int subscribeCycleForCatalog) { | 283 | public void setSubscribeCycleForCatalog(int subscribeCycleForCatalog) { |
| 295 | this.subscribeCycleForCatalog = subscribeCycleForCatalog; | 284 | this.subscribeCycleForCatalog = subscribeCycleForCatalog; |
| 296 | } | 285 | } |
| 297 | - | ||
| 298 | - | ||
| 299 | } | 286 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/MobilePosition.java
| @@ -8,10 +8,6 @@ package com.genersoft.iot.vmp.gb28181.bean; | @@ -8,10 +8,6 @@ package com.genersoft.iot.vmp.gb28181.bean; | ||
| 8 | 8 | ||
| 9 | public class MobilePosition { | 9 | public class MobilePosition { |
| 10 | /** | 10 | /** |
| 11 | - * Id | ||
| 12 | - */ | ||
| 13 | - private int id; | ||
| 14 | - /** | ||
| 15 | * 设备Id | 11 | * 设备Id |
| 16 | */ | 12 | */ |
| 17 | private String deviceId; | 13 | private String deviceId; |
| @@ -76,13 +72,6 @@ public class MobilePosition { | @@ -76,13 +72,6 @@ public class MobilePosition { | ||
| 76 | */ | 72 | */ |
| 77 | private String cnLat; | 73 | private String cnLat; |
| 78 | 74 | ||
| 79 | - public int getId() { | ||
| 80 | - return id; | ||
| 81 | - } | ||
| 82 | - | ||
| 83 | - public void setId(int id) { | ||
| 84 | - this.id = id; | ||
| 85 | - } | ||
| 86 | 75 | ||
| 87 | public String getDeviceId() { | 76 | public String getDeviceId() { |
| 88 | return deviceId; | 77 | return deviceId; |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java
| @@ -19,7 +19,9 @@ public class RecordItem implements Comparable<RecordItem>{ | @@ -19,7 +19,9 @@ public class RecordItem implements Comparable<RecordItem>{ | ||
| 19 | private String name; | 19 | private String name; |
| 20 | 20 | ||
| 21 | private String filePath; | 21 | private String filePath; |
| 22 | - | 22 | + |
| 23 | + private String fileSize; | ||
| 24 | + | ||
| 23 | private String address; | 25 | private String address; |
| 24 | 26 | ||
| 25 | private String startTime; | 27 | private String startTime; |
| @@ -104,6 +106,14 @@ public class RecordItem implements Comparable<RecordItem>{ | @@ -104,6 +106,14 @@ public class RecordItem implements Comparable<RecordItem>{ | ||
| 104 | this.recorderId = recorderId; | 106 | this.recorderId = recorderId; |
| 105 | } | 107 | } |
| 106 | 108 | ||
| 109 | + public String getFileSize() { | ||
| 110 | + return fileSize; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + public void setFileSize(String fileSize) { | ||
| 114 | + this.fileSize = fileSize; | ||
| 115 | + } | ||
| 116 | + | ||
| 107 | @Override | 117 | @Override |
| 108 | public int compareTo(@NotNull RecordItem recordItem) { | 118 | public int compareTo(@NotNull RecordItem recordItem) { |
| 109 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 119 | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SDPInfo.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.bean; | ||
| 2 | + | ||
| 3 | +import javax.sdp.SessionDescription; | ||
| 4 | + | ||
| 5 | +public class SDPInfo { | ||
| 6 | + private byte[] source; | ||
| 7 | + private SessionDescription sdpSource; | ||
| 8 | + private String sessionName; | ||
| 9 | + private Long startTime; | ||
| 10 | + private Long stopTime; | ||
| 11 | + private String username; | ||
| 12 | + private String address; | ||
| 13 | + private String ssrc; | ||
| 14 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java
| @@ -71,6 +71,16 @@ public class SendRtpItem { | @@ -71,6 +71,16 @@ public class SendRtpItem { | ||
| 71 | */ | 71 | */ |
| 72 | private String mediaServerId; | 72 | private String mediaServerId; |
| 73 | 73 | ||
| 74 | + /** | ||
| 75 | + * invite的callId | ||
| 76 | + */ | ||
| 77 | + private String CallId; | ||
| 78 | + | ||
| 79 | + /** | ||
| 80 | + * 是否是play, false是playback | ||
| 81 | + */ | ||
| 82 | + private boolean isPlay; | ||
| 83 | + | ||
| 74 | public String getIp() { | 84 | public String getIp() { |
| 75 | return ip; | 85 | return ip; |
| 76 | } | 86 | } |
| @@ -174,4 +184,20 @@ public class SendRtpItem { | @@ -174,4 +184,20 @@ public class SendRtpItem { | ||
| 174 | public void setMediaServerId(String mediaServerId) { | 184 | public void setMediaServerId(String mediaServerId) { |
| 175 | this.mediaServerId = mediaServerId; | 185 | this.mediaServerId = mediaServerId; |
| 176 | } | 186 | } |
| 187 | + | ||
| 188 | + public String getCallId() { | ||
| 189 | + return CallId; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + public void setCallId(String callId) { | ||
| 193 | + CallId = callId; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public boolean isPlay() { | ||
| 197 | + return isPlay; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + public void setPlay(boolean play) { | ||
| 201 | + isPlay = play; | ||
| 202 | + } | ||
| 177 | } | 203 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/EventPublisher.java
| 1 | package com.genersoft.iot.vmp.gb28181.event; | 1 | package com.genersoft.iot.vmp.gb28181.event; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 4 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | ||
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 3 | +import com.genersoft.iot.vmp.gb28181.bean.*; |
| 6 | import com.genersoft.iot.vmp.gb28181.event.offline.OfflineEvent; | 4 | import com.genersoft.iot.vmp.gb28181.event.offline.OfflineEvent; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.platformKeepaliveExpire.PlatformKeepaliveExpireEvent; | 5 | import com.genersoft.iot.vmp.gb28181.event.platformKeepaliveExpire.PlatformKeepaliveExpireEvent; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformCycleRegisterEvent; | 6 | import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformCycleRegisterEvent; |
| 9 | import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent; | 7 | import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent; |
| 8 | +import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEvent; | ||
| 10 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 9 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 11 | import com.genersoft.iot.vmp.media.zlm.event.ZLMOfflineEvent; | 10 | import com.genersoft.iot.vmp.media.zlm.event.ZLMOfflineEvent; |
| 12 | import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent; | 11 | import com.genersoft.iot.vmp.media.zlm.event.ZLMOnlineEvent; |
| @@ -15,7 +14,6 @@ import org.springframework.context.ApplicationEventPublisher; | @@ -15,7 +14,6 @@ import org.springframework.context.ApplicationEventPublisher; | ||
| 15 | import org.springframework.scheduling.annotation.Async; | 14 | import org.springframework.scheduling.annotation.Async; |
| 16 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 17 | 16 | ||
| 18 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | ||
| 19 | import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEvent; | 17 | import com.genersoft.iot.vmp.gb28181.event.alarm.AlarmEvent; |
| 20 | import com.genersoft.iot.vmp.gb28181.event.online.OnlineEvent; | 18 | import com.genersoft.iot.vmp.gb28181.event.online.OnlineEvent; |
| 21 | 19 | ||
| @@ -145,4 +143,11 @@ public class EventPublisher { | @@ -145,4 +143,11 @@ public class EventPublisher { | ||
| 145 | gbStreamList.add(gbStream); | 143 | gbStreamList.add(gbStream); |
| 146 | catalogEventPublishForStream(platformId, gbStreamList, type); | 144 | catalogEventPublishForStream(platformId, gbStreamList, type); |
| 147 | } | 145 | } |
| 146 | + | ||
| 147 | + public void recordEndEventPush(RecordInfo recordInfo) { | ||
| 148 | + RecordEndEvent outEvent = new RecordEndEvent(this); | ||
| 149 | + outEvent.setRecordInfo(recordInfo); | ||
| 150 | + applicationEventPublisher.publishEvent(outEvent); | ||
| 151 | + } | ||
| 152 | + | ||
| 148 | } | 153 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java
| @@ -76,10 +76,7 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | @@ -76,10 +76,7 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | ||
| 76 | eventResult.callId = callid; | 76 | eventResult.callId = callid; |
| 77 | eventResult.msg = "注册超时"; | 77 | eventResult.msg = "注册超时"; |
| 78 | eventResult.type = "register timeout"; | 78 | eventResult.type = "register timeout"; |
| 79 | - if (sipSubscribe.getErrorSubscribe(callid) != null) { | ||
| 80 | - sipSubscribe.getErrorSubscribe(callid).response(eventResult); | ||
| 81 | - } | ||
| 82 | - | 79 | + sipSubscribe.getErrorSubscribe(callid).response(eventResult); |
| 83 | } | 80 | } |
| 84 | 81 | ||
| 85 | } | 82 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformCycleRegisterEventLister.java
| @@ -4,7 +4,8 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | @@ -4,7 +4,8 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 6 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 6 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 7 | -import lombok.extern.slf4j.Slf4j; | 7 | +import org.slf4j.Logger; |
| 8 | +import org.slf4j.LoggerFactory; | ||
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.context.ApplicationListener; | 10 | import org.springframework.context.ApplicationListener; |
| 10 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| @@ -12,9 +13,11 @@ import org.springframework.stereotype.Component; | @@ -12,9 +13,11 @@ import org.springframework.stereotype.Component; | ||
| 12 | import java.util.Timer; | 13 | import java.util.Timer; |
| 13 | import java.util.TimerTask; | 14 | import java.util.TimerTask; |
| 14 | 15 | ||
| 15 | -@Slf4j | ||
| 16 | @Component | 16 | @Component |
| 17 | public class PlatformCycleRegisterEventLister implements ApplicationListener<PlatformCycleRegisterEvent> { | 17 | public class PlatformCycleRegisterEventLister implements ApplicationListener<PlatformCycleRegisterEvent> { |
| 18 | + | ||
| 19 | + private final static Logger logger = LoggerFactory.getLogger(PlatformCycleRegisterEventLister.class); | ||
| 20 | + | ||
| 18 | @Autowired | 21 | @Autowired |
| 19 | private IVideoManagerStorager storager; | 22 | private IVideoManagerStorager storager; |
| 20 | @Autowired | 23 | @Autowired |
| @@ -22,10 +25,10 @@ public class PlatformCycleRegisterEventLister implements ApplicationListener<Pla | @@ -22,10 +25,10 @@ public class PlatformCycleRegisterEventLister implements ApplicationListener<Pla | ||
| 22 | 25 | ||
| 23 | @Override | 26 | @Override |
| 24 | public void onApplicationEvent(PlatformCycleRegisterEvent event) { | 27 | public void onApplicationEvent(PlatformCycleRegisterEvent event) { |
| 25 | - log.info("上级平台周期注册事件"); | 28 | + logger.info("上级平台周期注册事件"); |
| 26 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformGbID()); | 29 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformGbID()); |
| 27 | if (parentPlatform == null) { | 30 | if (parentPlatform == null) { |
| 28 | - log.info("[ 平台未注册事件 ] 平台已经删除!!! 平台国标ID:" + event.getPlatformGbID()); | 31 | + logger.info("[ 平台未注册事件 ] 平台已经删除!!! 平台国标ID:" + event.getPlatformGbID()); |
| 29 | return; | 32 | return; |
| 30 | } | 33 | } |
| 31 | Timer timer = new Timer(); | 34 | Timer timer = new Timer(); |
| @@ -36,7 +39,7 @@ public class PlatformCycleRegisterEventLister implements ApplicationListener<Pla | @@ -36,7 +39,7 @@ public class PlatformCycleRegisterEventLister implements ApplicationListener<Pla | ||
| 36 | timer.schedule(new TimerTask() { | 39 | timer.schedule(new TimerTask() { |
| 37 | @Override | 40 | @Override |
| 38 | public void run() { | 41 | public void run() { |
| 39 | - log.info("[平台注册]再次向平台注册,平台国标ID:" + event.getPlatformGbID()); | 42 | + logger.info("[平台注册]再次向平台注册,平台国标ID:" + event.getPlatformGbID()); |
| 40 | sipCommanderFroPlatform.register(parentPlatform, null, okEvent); | 43 | sipCommanderFroPlatform.register(parentPlatform, null, okEvent); |
| 41 | } | 44 | } |
| 42 | }, 15*1000 ,Long.parseLong(parentPlatform.getExpires())* 1000); | 45 | }, 15*1000 ,Long.parseLong(parentPlatform.getExpires())* 1000); |
src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEvent.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.event.record; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; | ||
| 5 | +import org.springframework.context.ApplicationEvent; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @description: 录像查询结束时间 | ||
| 9 | + * @author: pan | ||
| 10 | + * @data: 2022-02-23 | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +public class RecordEndEvent extends ApplicationEvent { | ||
| 14 | + /** | ||
| 15 | + * | ||
| 16 | + */ | ||
| 17 | + private static final long serialVersionUID = 1L; | ||
| 18 | + | ||
| 19 | + public RecordEndEvent(Object source) { | ||
| 20 | + super(source); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + private RecordInfo recordInfo; | ||
| 24 | + | ||
| 25 | + public RecordInfo getRecordInfo() { | ||
| 26 | + return recordInfo; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setRecordInfo(RecordInfo recordInfo) { | ||
| 30 | + this.recordInfo = recordInfo; | ||
| 31 | + } | ||
| 32 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/event/record/RecordEndEventListener.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.event.record; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.RecordItem; | ||
| 5 | +import org.slf4j.Logger; | ||
| 6 | +import org.slf4j.LoggerFactory; | ||
| 7 | +import org.springframework.context.ApplicationListener; | ||
| 8 | +import org.springframework.stereotype.Component; | ||
| 9 | +import org.springframework.web.servlet.mvc.method.annotation.SseEmitter; | ||
| 10 | + | ||
| 11 | +import java.io.IOException; | ||
| 12 | +import java.util.*; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @description: 录像查询结束时间 | ||
| 16 | + * @author: pan | ||
| 17 | + * @data: 2022-02-23 | ||
| 18 | + */ | ||
| 19 | + | ||
| 20 | +@Component | ||
| 21 | +public class RecordEndEventListener implements ApplicationListener<RecordEndEvent> { | ||
| 22 | + | ||
| 23 | + private final static Logger logger = LoggerFactory.getLogger(RecordEndEventListener.class); | ||
| 24 | + | ||
| 25 | + private static Map<String, SseEmitter> sseEmitters = new Hashtable<>(); | ||
| 26 | + | ||
| 27 | + public interface RecordEndEventHandler{ | ||
| 28 | + void handler(RecordInfo recordInfo); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + private Map<String, RecordEndEventHandler> handlerMap = new HashMap<>(); | ||
| 32 | + @Override | ||
| 33 | + public void onApplicationEvent(RecordEndEvent event) { | ||
| 34 | + if (logger.isDebugEnabled()) { | ||
| 35 | + logger.debug("录像查询完成事件触发,deviceId:{}, channelId: {}, 录像数量{}条", event.getRecordInfo().getDeviceId(), | ||
| 36 | + event.getRecordInfo().getChannelId(), event.getRecordInfo().getRecordList().size() ); | ||
| 37 | + } | ||
| 38 | + if (handlerMap.size() > 0) { | ||
| 39 | + for (RecordEndEventHandler recordEndEventHandler : handlerMap.values()) { | ||
| 40 | + recordEndEventHandler.handler(event.getRecordInfo()); | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public void addEndEventHandler(String device, String channelId, RecordEndEventHandler recordEndEventHandler) { | ||
| 47 | + handlerMap.put(device + channelId, recordEndEventHandler); | ||
| 48 | + } | ||
| 49 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/session/SsrcConfig.java
| @@ -81,7 +81,6 @@ public class SsrcConfig { | @@ -81,7 +81,6 @@ public class SsrcConfig { | ||
| 81 | isUsed.remove(sn); | 81 | isUsed.remove(sn); |
| 82 | notUsed.add(sn); | 82 | notUsed.add(sn); |
| 83 | }catch (NullPointerException e){ | 83 | }catch (NullPointerException e){ |
| 84 | - System.out.printf("11111"); | ||
| 85 | } | 84 | } |
| 86 | } | 85 | } |
| 87 | 86 |
src/main/java/com/genersoft/iot/vmp/gb28181/task/GPSSubscribeTask.java
| @@ -36,7 +36,6 @@ public class GPSSubscribeTask implements Runnable{ | @@ -36,7 +36,6 @@ public class GPSSubscribeTask implements Runnable{ | ||
| 36 | 36 | ||
| 37 | SubscribeInfo subscribe = redisCatchStorage.getSubscribe(key); | 37 | SubscribeInfo subscribe = redisCatchStorage.getSubscribe(key); |
| 38 | if (subscribe != null) { | 38 | if (subscribe != null) { |
| 39 | - System.out.println("发送GPS消息"); | ||
| 40 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); | 39 | ParentPlatform parentPlatform = storager.queryParentPlatByServerGBId(platformId); |
| 41 | if (parentPlatform == null || parentPlatform.isStatus()) { | 40 | if (parentPlatform == null || parentPlatform.isStatus()) { |
| 42 | // TODO 暂时只处理视频流的回复,后续增加对国标设备的支持 | 41 | // TODO 暂时只处理视频流的回复,后续增加对国标设备的支持 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/SIPProcessorObserver.java
| @@ -141,7 +141,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | @@ -141,7 +141,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | ||
| 141 | */ | 141 | */ |
| 142 | @Override | 142 | @Override |
| 143 | public void processTimeout(TimeoutEvent timeoutEvent) { | 143 | public void processTimeout(TimeoutEvent timeoutEvent) { |
| 144 | - System.out.println("processTimeout"); | ||
| 145 | if(timeoutProcessor != null) { | 144 | if(timeoutProcessor != null) { |
| 146 | timeoutProcessor.process(timeoutEvent); | 145 | timeoutProcessor.process(timeoutEvent); |
| 147 | } | 146 | } |
| @@ -173,7 +172,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | @@ -173,7 +172,6 @@ public class SIPProcessorObserver implements ISIPProcessorObserver { | ||
| 173 | 172 | ||
| 174 | @Override | 173 | @Override |
| 175 | public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent) { | 174 | public void processDialogTerminated(DialogTerminatedEvent dialogTerminatedEvent) { |
| 176 | - System.out.println("processDialogTerminated"); | ||
| 177 | CallIdHeader callId = dialogTerminatedEvent.getDialog().getCallId(); | 175 | CallIdHeader callId = dialogTerminatedEvent.getDialog().getCallId(); |
| 178 | } | 176 | } |
| 179 | 177 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
| @@ -258,7 +258,7 @@ public interface ISIPCommander { | @@ -258,7 +258,7 @@ public interface ISIPCommander { | ||
| 258 | * @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss | 258 | * @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss |
| 259 | * @param sn | 259 | * @param sn |
| 260 | */ | 260 | */ |
| 261 | - boolean recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn, SipSubscribe.Event errorEvent); | 261 | + boolean recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn, Integer Secrecy, String type, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent); |
| 262 | 262 | ||
| 263 | /** | 263 | /** |
| 264 | * 查询报警信息 | 264 | * 查询报警信息 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommanderForPlatform.java
| @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd; | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.cmd; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 3 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; | 6 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; |
| 6 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 7 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 7 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 8 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| @@ -87,4 +88,12 @@ public interface ISIPCommanderForPlatform { | @@ -87,4 +88,12 @@ public interface ISIPCommanderForPlatform { | ||
| 87 | */ | 88 | */ |
| 88 | boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index); | 89 | boolean sendNotifyForCatalogOther(String type, ParentPlatform parentPlatform, List<DeviceChannel> deviceChannels, SubscribeInfo subscribeInfo, Integer index); |
| 89 | 90 | ||
| 91 | + /** | ||
| 92 | + * 回复recordInfo | ||
| 93 | + * @param deviceChannel 通道信息 | ||
| 94 | + * @param parentPlatform 平台信息 | ||
| 95 | + * @param fromTag fromTag | ||
| 96 | + * @param recordInfo 录像信息 | ||
| 97 | + */ | ||
| 98 | + boolean recordInfo(DeviceChannel deviceChannel, ParentPlatform parentPlatform, String fromTag, RecordInfo recordInfo); | ||
| 90 | } | 99 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -346,8 +346,11 @@ public class SIPCommander implements ISIPCommander { | @@ -346,8 +346,11 @@ public class SIPCommander implements ISIPCommander { | ||
| 346 | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | 346 | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, |
| 347 | (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | 347 | (MediaServerItem mediaServerItemInUse, JSONObject json)->{ |
| 348 | if (userSetup.isWaitTrack() && json.getJSONArray("tracks") == null) return; | 348 | if (userSetup.isWaitTrack() && json.getJSONArray("tracks") == null) return; |
| 349 | - event.response(mediaServerItemInUse, json); | ||
| 350 | - subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey); | 349 | + if (event != null) { |
| 350 | + event.response(mediaServerItemInUse, json); | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | +// subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey); | ||
| 351 | }); | 354 | }); |
| 352 | // | 355 | // |
| 353 | StringBuffer content = new StringBuffer(200); | 356 | StringBuffer content = new StringBuffer(200); |
| @@ -450,13 +453,16 @@ public class SIPCommander implements ISIPCommander { | @@ -450,13 +453,16 @@ public class SIPCommander implements ISIPCommander { | ||
| 450 | subscribeKey.put("app", "rtp"); | 453 | subscribeKey.put("app", "rtp"); |
| 451 | subscribeKey.put("stream", ssrcInfo.getStream()); | 454 | subscribeKey.put("stream", ssrcInfo.getStream()); |
| 452 | subscribeKey.put("regist", true); | 455 | subscribeKey.put("regist", true); |
| 456 | + subscribeKey.put("schema", "rtmp"); | ||
| 453 | subscribeKey.put("mediaServerId", mediaServerItem.getId()); | 457 | subscribeKey.put("mediaServerId", mediaServerItem.getId()); |
| 454 | logger.debug("录像回放添加订阅,订阅内容:" + subscribeKey.toString()); | 458 | logger.debug("录像回放添加订阅,订阅内容:" + subscribeKey.toString()); |
| 455 | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, | 459 | subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey, |
| 456 | (MediaServerItem mediaServerItemInUse, JSONObject json)->{ | 460 | (MediaServerItem mediaServerItemInUse, JSONObject json)->{ |
| 461 | + System.out.println(344444); | ||
| 457 | if (userSetup.isWaitTrack() && json.getJSONArray("tracks") == null) return; | 462 | if (userSetup.isWaitTrack() && json.getJSONArray("tracks") == null) return; |
| 458 | - event.response(mediaServerItemInUse, json); | ||
| 459 | - subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey); | 463 | + if (event != null) { |
| 464 | + event.response(mediaServerItemInUse, json); | ||
| 465 | + } | ||
| 460 | }); | 466 | }); |
| 461 | 467 | ||
| 462 | StringBuffer content = new StringBuffer(200); | 468 | StringBuffer content = new StringBuffer(200); |
| @@ -713,6 +719,7 @@ public class SIPCommander implements ISIPCommander { | @@ -713,6 +719,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 713 | if (ssrcTransaction != null) { | 719 | if (ssrcTransaction != null) { |
| 714 | MediaServerItem mediaServerItem = mediaServerService.getOne(ssrcTransaction.getMediaServerId()); | 720 | MediaServerItem mediaServerItem = mediaServerService.getOne(ssrcTransaction.getMediaServerId()); |
| 715 | mediaServerService.releaseSsrc(mediaServerItem, ssrcTransaction.getSsrc()); | 721 | mediaServerService.releaseSsrc(mediaServerItem, ssrcTransaction.getSsrc()); |
| 722 | + mediaServerService.closeRTPServer(deviceId, channelId, ssrcTransaction.getStream()); | ||
| 716 | streamSession.remove(deviceId, channelId, ssrcTransaction.getStream()); | 723 | streamSession.remove(deviceId, channelId, ssrcTransaction.getStream()); |
| 717 | } | 724 | } |
| 718 | } catch (SipException | ParseException e) { | 725 | } catch (SipException | ParseException e) { |
| @@ -1196,9 +1203,13 @@ public class SIPCommander implements ISIPCommander { | @@ -1196,9 +1203,13 @@ public class SIPCommander implements ISIPCommander { | ||
| 1196 | * @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss | 1203 | * @param endTime 结束时间,格式要求:yyyy-MM-dd HH:mm:ss |
| 1197 | */ | 1204 | */ |
| 1198 | @Override | 1205 | @Override |
| 1199 | - public boolean recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn, SipSubscribe.Event errorEvent) { | ||
| 1200 | - | ||
| 1201 | - | 1206 | + public boolean recordInfoQuery(Device device, String channelId, String startTime, String endTime, int sn, Integer secrecy, String type, SipSubscribe.Event okEvent, SipSubscribe.Event errorEvent) { |
| 1207 | + if (secrecy == null) { | ||
| 1208 | + secrecy = 0; | ||
| 1209 | + } | ||
| 1210 | + if (type == null) { | ||
| 1211 | + type = "all"; | ||
| 1212 | + } | ||
| 1202 | try { | 1213 | try { |
| 1203 | StringBuffer recordInfoXml = new StringBuffer(200); | 1214 | StringBuffer recordInfoXml = new StringBuffer(200); |
| 1204 | recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | 1215 | recordInfoXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); |
| @@ -1206,11 +1217,19 @@ public class SIPCommander implements ISIPCommander { | @@ -1206,11 +1217,19 @@ public class SIPCommander implements ISIPCommander { | ||
| 1206 | recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n"); | 1217 | recordInfoXml.append("<CmdType>RecordInfo</CmdType>\r\n"); |
| 1207 | recordInfoXml.append("<SN>" + sn + "</SN>\r\n"); | 1218 | recordInfoXml.append("<SN>" + sn + "</SN>\r\n"); |
| 1208 | recordInfoXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 1219 | recordInfoXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| 1209 | - recordInfoXml.append("<StartTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(startTime) + "</StartTime>\r\n"); | ||
| 1210 | - recordInfoXml.append("<EndTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(endTime) + "</EndTime>\r\n"); | ||
| 1211 | - recordInfoXml.append("<Secrecy>0</Secrecy>\r\n"); | ||
| 1212 | - // 大华NVR要求必须增加一个值为all的文本元素节点Type | ||
| 1213 | - recordInfoXml.append("<Type>all</Type>\r\n"); | 1220 | + if (startTime != null) { |
| 1221 | + recordInfoXml.append("<StartTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(startTime) + "</StartTime>\r\n"); | ||
| 1222 | + } | ||
| 1223 | + if (endTime != null) { | ||
| 1224 | + recordInfoXml.append("<EndTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(endTime) + "</EndTime>\r\n"); | ||
| 1225 | + } | ||
| 1226 | + if (secrecy != null) { | ||
| 1227 | + recordInfoXml.append("<Secrecy> "+ secrecy + " </Secrecy>\r\n"); | ||
| 1228 | + } | ||
| 1229 | + if (type != null) { | ||
| 1230 | + // 大华NVR要求必须增加一个值为all的文本元素节点Type | ||
| 1231 | + recordInfoXml.append("<Type>" + type+"</Type>\r\n"); | ||
| 1232 | + } | ||
| 1214 | recordInfoXml.append("</Query>\r\n"); | 1233 | recordInfoXml.append("</Query>\r\n"); |
| 1215 | 1234 | ||
| 1216 | String tm = Long.toString(System.currentTimeMillis()); | 1235 | String tm = Long.toString(System.currentTimeMillis()); |
| @@ -1221,7 +1240,7 @@ public class SIPCommander implements ISIPCommander { | @@ -1221,7 +1240,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 1221 | Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), | 1240 | Request request = headerProvider.createMessageRequest(device, recordInfoXml.toString(), |
| 1222 | "z9hG4bK-ViaRecordInfo-" + tm, "fromRec" + tm, null, callIdHeader); | 1241 | "z9hG4bK-ViaRecordInfo-" + tm, "fromRec" + tm, null, callIdHeader); |
| 1223 | 1242 | ||
| 1224 | - transmitRequest(device, request, errorEvent); | 1243 | + transmitRequest(device, request, errorEvent, okEvent); |
| 1225 | } catch (SipException | ParseException | InvalidArgumentException e) { | 1244 | } catch (SipException | ParseException | InvalidArgumentException e) { |
| 1226 | e.printStackTrace(); | 1245 | e.printStackTrace(); |
| 1227 | return false; | 1246 | return false; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.cmd.impl; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | ||
| 4 | -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; | ||
| 6 | -import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; | 3 | +import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderPlarformProvider; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.SIPRequestHeaderPlarformProvider; |
| 7 | +import com.genersoft.iot.vmp.gb28181.utils.DateUtil; | ||
| 10 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 8 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 12 | import org.slf4j.Logger; | 10 | import org.slf4j.Logger; |
| @@ -17,6 +15,7 @@ import org.springframework.context.annotation.DependsOn; | @@ -17,6 +15,7 @@ import org.springframework.context.annotation.DependsOn; | ||
| 17 | import org.springframework.context.annotation.Lazy; | 15 | import org.springframework.context.annotation.Lazy; |
| 18 | import org.springframework.lang.Nullable; | 16 | import org.springframework.lang.Nullable; |
| 19 | import org.springframework.stereotype.Component; | 17 | import org.springframework.stereotype.Component; |
| 18 | +import org.springframework.util.StringUtils; | ||
| 20 | 19 | ||
| 21 | import javax.sip.*; | 20 | import javax.sip.*; |
| 22 | import javax.sip.header.CallIdHeader; | 21 | import javax.sip.header.CallIdHeader; |
| @@ -496,5 +495,52 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -496,5 +495,52 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 496 | catalogXml.append("</Notify>\r\n"); | 495 | catalogXml.append("</Notify>\r\n"); |
| 497 | return catalogXml.toString(); | 496 | return catalogXml.toString(); |
| 498 | } | 497 | } |
| 498 | + @Override | ||
| 499 | + public boolean recordInfo(DeviceChannel deviceChannel, ParentPlatform parentPlatform, String fromTag, RecordInfo recordInfo) { | ||
| 500 | + if ( parentPlatform ==null) { | ||
| 501 | + return false; | ||
| 502 | + } | ||
| 503 | + try { | ||
| 504 | + StringBuffer recordXml = new StringBuffer(600); | ||
| 505 | + recordXml.append("<?xml version=\"1.0\" encoding=\"GB2312\"?>\r\n"); | ||
| 506 | + recordXml.append("<Response>\r\n"); | ||
| 507 | + recordXml.append("<CmdType>RecordInfo</CmdType>\r\n"); | ||
| 508 | + recordXml.append("<SN>" +recordInfo.getSn() + "</SN>\r\n"); | ||
| 509 | + recordXml.append("<DeviceID>" + recordInfo.getDeviceId() + "</DeviceID>\r\n"); | ||
| 510 | + recordXml.append("<SumNum>" + recordInfo.getSumNum() + "</SumNum>\r\n"); | ||
| 511 | + recordXml.append("<RecordList Num=\"" + recordInfo.getRecordList().size()+"\">\r\n"); | ||
| 512 | + for (RecordItem recordItem : recordInfo.getRecordList()) { | ||
| 513 | + recordXml.append("<Item>\r\n"); | ||
| 514 | + if (deviceChannel != null) { | ||
| 515 | + recordXml.append("<DeviceID>" + recordItem.getDeviceId() + "</DeviceID>\r\n"); | ||
| 516 | + recordXml.append("<Name>" + recordItem.getName() + "</Name>\r\n"); | ||
| 517 | + recordXml.append("<StartTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(recordItem.getStartTime()) + "</StartTime>\r\n"); | ||
| 518 | + recordXml.append("<EndTime>" + DateUtil.yyyy_MM_dd_HH_mm_ssToISO8601(recordItem.getEndTime()) + "</EndTime>\r\n"); | ||
| 519 | + recordXml.append("<Secrecy>" + recordItem.getSecrecy() + "</Secrecy>\r\n"); | ||
| 520 | + recordXml.append("<Type>" + recordItem.getType() + "</Type>\r\n"); | ||
| 521 | + if (!StringUtils.isEmpty(recordItem.getFileSize())) { | ||
| 522 | + recordXml.append("<FileSize>" + recordItem.getFileSize() + "</FileSize>\r\n"); | ||
| 523 | + } | ||
| 524 | + if (!StringUtils.isEmpty(recordItem.getFilePath())) { | ||
| 525 | + recordXml.append("<FilePath>" + recordItem.getFilePath() + "</FilePath>\r\n"); | ||
| 526 | + } | ||
| 527 | + } | ||
| 528 | + recordXml.append("</Item>\r\n"); | ||
| 529 | + } | ||
| 499 | 530 | ||
| 531 | + recordXml.append("</RecordList>\r\n"); | ||
| 532 | + recordXml.append("</Response>\r\n"); | ||
| 533 | + | ||
| 534 | + // callid | ||
| 535 | + CallIdHeader callIdHeader = parentPlatform.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() | ||
| 536 | + : udpSipProvider.getNewCallId(); | ||
| 537 | + Request request = headerProviderPlarformProvider.createMessageRequest(parentPlatform, recordXml.toString(), fromTag, callIdHeader); | ||
| 538 | + transmitRequest(parentPlatform, request); | ||
| 539 | + | ||
| 540 | + } catch (SipException | ParseException | InvalidArgumentException e) { | ||
| 541 | + e.printStackTrace(); | ||
| 542 | + return false; | ||
| 543 | + } | ||
| 544 | + return true; | ||
| 545 | + } | ||
| 500 | } | 546 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/AckRequestProcessor.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | 6 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 10 | +import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | ||
| 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 11 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 12 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 10 | import com.genersoft.iot.vmp.service.IMediaServerService; | 13 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| @@ -24,6 +27,8 @@ import javax.sip.header.HeaderAddress; | @@ -24,6 +27,8 @@ import javax.sip.header.HeaderAddress; | ||
| 24 | import javax.sip.header.ToHeader; | 27 | import javax.sip.header.ToHeader; |
| 25 | import java.util.HashMap; | 28 | import java.util.HashMap; |
| 26 | import java.util.Map; | 29 | import java.util.Map; |
| 30 | +import java.util.Timer; | ||
| 31 | +import java.util.TimerTask; | ||
| 27 | 32 | ||
| 28 | /** | 33 | /** |
| 29 | * SIP命令类型: ACK请求 | 34 | * SIP命令类型: ACK请求 |
| @@ -52,6 +57,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -52,6 +57,9 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 52 | @Autowired | 57 | @Autowired |
| 53 | private IMediaServerService mediaServerService; | 58 | private IMediaServerService mediaServerService; |
| 54 | 59 | ||
| 60 | + @Autowired | ||
| 61 | + private ZLMHttpHookSubscribe subscribe; | ||
| 62 | + | ||
| 55 | 63 | ||
| 56 | /** | 64 | /** |
| 57 | * 处理 ACK请求 | 65 | * 处理 ACK请求 |
| @@ -60,6 +68,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -60,6 +68,7 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 60 | */ | 68 | */ |
| 61 | @Override | 69 | @Override |
| 62 | public void process(RequestEvent evt) { | 70 | public void process(RequestEvent evt) { |
| 71 | + logger.info("ACK请求: {}", ((System.currentTimeMillis()))); | ||
| 63 | Dialog dialog = evt.getDialog(); | 72 | Dialog dialog = evt.getDialog(); |
| 64 | if (dialog == null) return; | 73 | if (dialog == null) return; |
| 65 | if (dialog.getState()== DialogState.CONFIRMED) { | 74 | if (dialog.getState()== DialogState.CONFIRMED) { |
| @@ -69,16 +78,17 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -69,16 +78,17 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 69 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; | 78 | String is_Udp = sendRtpItem.isTcp() ? "0" : "1"; |
| 70 | String deviceId = sendRtpItem.getDeviceId(); | 79 | String deviceId = sendRtpItem.getDeviceId(); |
| 71 | StreamInfo streamInfo = null; | 80 | StreamInfo streamInfo = null; |
| 72 | - if (deviceId == null) { | 81 | + if (sendRtpItem.isPlay()) { |
| 82 | + streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); | ||
| 83 | + }else { | ||
| 84 | + streamInfo = redisCatchStorage.queryPlaybackByDevice(deviceId, channelId); | ||
| 85 | + } | ||
| 86 | + System.out.println(JSON.toJSON(streamInfo)); | ||
| 87 | + if (streamInfo == null) { | ||
| 73 | streamInfo = new StreamInfo(); | 88 | streamInfo = new StreamInfo(); |
| 74 | streamInfo.setApp(sendRtpItem.getApp()); | 89 | streamInfo.setApp(sendRtpItem.getApp()); |
| 75 | streamInfo.setStream(sendRtpItem.getStreamId()); | 90 | streamInfo.setStream(sendRtpItem.getStreamId()); |
| 76 | - }else { | ||
| 77 | - streamInfo = redisCatchStorage.queryPlayByDevice(deviceId, channelId); | ||
| 78 | - sendRtpItem.setStreamId(streamInfo.getStream()); | ||
| 79 | - streamInfo.setApp("rtp"); | ||
| 80 | } | 91 | } |
| 81 | - | ||
| 82 | redisCatchStorage.updateSendRTPSever(sendRtpItem); | 92 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 83 | logger.info(platformGbId); | 93 | logger.info(platformGbId); |
| 84 | logger.info(channelId); | 94 | logger.info(channelId); |
| @@ -90,34 +100,42 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | @@ -90,34 +100,42 @@ public class AckRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 90 | param.put("dst_url",sendRtpItem.getIp()); | 100 | param.put("dst_url",sendRtpItem.getIp()); |
| 91 | param.put("dst_port", sendRtpItem.getPort()); | 101 | param.put("dst_port", sendRtpItem.getPort()); |
| 92 | param.put("is_udp", is_Udp); | 102 | param.put("is_udp", is_Udp); |
| 93 | - //param.put ("src_port", sendRtpItem.getLocalPort()); | ||
| 94 | // 设备推流查询,成功后才能转推 | 103 | // 设备推流查询,成功后才能转推 |
| 95 | - boolean rtpPushed = false; | ||
| 96 | - long startTime = System.currentTimeMillis(); | ||
| 97 | - while (!rtpPushed) { | ||
| 98 | - try { | ||
| 99 | - if (System.currentTimeMillis() - startTime < 30 * 1000) { | ||
| 100 | - MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | ||
| 101 | - if (zlmrtpServerFactory.isStreamReady(mediaInfo, streamInfo.getApp(), streamInfo.getStream())) { | ||
| 102 | - rtpPushed = true; | ||
| 103 | - logger.info("已获取设备推流[{}/{}],开始向上级推流[{}:{}]", | ||
| 104 | - streamInfo.getApp() ,streamInfo.getStream(), sendRtpItem.getIp(), sendRtpItem.getPort()); | ||
| 105 | - zlmrtpServerFactory.startSendRtpStream(mediaInfo, param); | ||
| 106 | - } else { | ||
| 107 | - logger.info("等待设备推流[{}/{}].......", | ||
| 108 | - streamInfo.getApp() ,streamInfo.getStream()); | ||
| 109 | - Thread.sleep(1000); | ||
| 110 | - continue; | ||
| 111 | - } | ||
| 112 | - } else { | ||
| 113 | - rtpPushed = true; | ||
| 114 | - logger.info("设备推流[{}/{}]超时,终止向上级推流", | ||
| 115 | - streamInfo.getApp() ,streamInfo.getStream()); | ||
| 116 | - } | ||
| 117 | - } catch (InterruptedException e) { | ||
| 118 | - e.printStackTrace(); | ||
| 119 | - } | ||
| 120 | - } | 104 | + MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| 105 | + zlmrtpServerFactory.startSendRtpStream(mediaInfo, param); | ||
| 106 | +// if (zlmrtpServerFactory.isStreamReady(mediaInfo, streamInfo.getApp(), streamInfo.getStreamId())) { | ||
| 107 | +// logger.info("已获取设备推流[{}/{}],开始向上级推流[{}:{}]", | ||
| 108 | +// streamInfo.getApp() ,streamInfo.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort()); | ||
| 109 | +// zlmrtpServerFactory.startSendRtpStream(mediaInfo, param); | ||
| 110 | +// } else { | ||
| 111 | +// // 对hook进行订阅 | ||
| 112 | +// logger.info("等待设备推流[{}/{}].......", | ||
| 113 | +// streamInfo.getApp(), streamInfo.getStreamId()); | ||
| 114 | +// Timer timer = new Timer(); | ||
| 115 | +// timer.schedule(new TimerTask() { | ||
| 116 | +// @Override | ||
| 117 | +// public void run() { | ||
| 118 | +// logger.info("设备推流[{}/{}]超时,终止向上级推流", | ||
| 119 | +// finalStreamInfo.getApp() , finalStreamInfo.getStreamId()); | ||
| 120 | +// | ||
| 121 | +// } | ||
| 122 | +// }, 30*1000L); | ||
| 123 | +// // 添加订阅 | ||
| 124 | +// JSONObject subscribeKey = new JSONObject(); | ||
| 125 | +// subscribeKey.put("app", "rtp"); | ||
| 126 | +// subscribeKey.put("stream", streamInfo.getStreamId()); | ||
| 127 | +// subscribeKey.put("mediaServerId", streamInfo.getMediaServerId()); | ||
| 128 | +// subscribe.addSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, subscribeKey, | ||
| 129 | +// (MediaServerItem mediaServerItemInUse, JSONObject json) -> { | ||
| 130 | +// logger.info("已获取设备推流[{}/{}],开始向上级推流[{}:{}]", | ||
| 131 | +// finalStreamInfo.getApp(), finalStreamInfo.getStreamId(), sendRtpItem.getIp(), sendRtpItem.getPort()); | ||
| 132 | +// timer.cancel(); | ||
| 133 | +// zlmrtpServerFactory.startSendRtpStream(mediaInfo, param); | ||
| 134 | +// subscribe.removeSubscribe(ZLMHttpHookSubscribe.HookType.on_stream_changed, subscribeKey); | ||
| 135 | +// }); | ||
| 136 | +// } | ||
| 137 | + | ||
| 138 | + | ||
| 121 | } | 139 | } |
| 122 | } | 140 | } |
| 123 | } | 141 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
| @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | @@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | 6 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| @@ -87,22 +88,34 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | @@ -87,22 +88,34 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 87 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); | 88 | MediaServerItem mediaInfo = mediaServerService.getOne(sendRtpItem.getMediaServerId()); |
| 88 | zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); | 89 | zlmrtpServerFactory.stopSendRtpStream(mediaInfo, param); |
| 89 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId); | 90 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId); |
| 90 | - if (zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId) == 0) { | 91 | + int totalReaderCount = zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); |
| 92 | + if (totalReaderCount == 0) { | ||
| 91 | logger.info(streamId + "无其它观看者,通知设备停止推流"); | 93 | logger.info(streamId + "无其它观看者,通知设备停止推流"); |
| 92 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId, streamId); | 94 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId, streamId); |
| 95 | + }else if (totalReaderCount == -1){ | ||
| 96 | + logger.warn(streamId + " 查找其它观看者失败"); | ||
| 93 | } | 97 | } |
| 94 | } | 98 | } |
| 95 | // 可能是设备主动停止 | 99 | // 可能是设备主动停止 |
| 96 | Device device = storager.queryVideoDeviceByChannelId(platformGbId); | 100 | Device device = storager.queryVideoDeviceByChannelId(platformGbId); |
| 97 | - if (device != null) { | 101 | + if (device != null) { |
| 98 | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(device.getDeviceId(), channelId); | 102 | StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(device.getDeviceId(), channelId); |
| 103 | + if (sendRtpItem != null) { | ||
| 104 | + if (sendRtpItem.isPlay()) { | ||
| 105 | + if (streamInfo != null) { | ||
| 106 | + redisCatchStorage.stopPlay(streamInfo); | ||
| 107 | + } | ||
| 108 | + }else { | ||
| 109 | + if (streamInfo != null) { | ||
| 110 | + redisCatchStorage.stopPlayback(streamInfo); | ||
| 111 | + } | ||
| 112 | + } | ||
| 99 | 113 | ||
| 100 | - if (streamInfo != null) { | ||
| 101 | - redisCatchStorage.stopPlay(streamInfo); | 114 | + storager.stopPlay(device.getDeviceId(), channelId); |
| 115 | + mediaServerService.closeRTPServer(device.getDeviceId(), channelId, streamInfo.getStream()); | ||
| 102 | } | 116 | } |
| 103 | - storager.stopPlay(device.getDeviceId(), channelId); | ||
| 104 | - mediaServerService.closeRTPServer(device, channelId, streamInfo.getStream()); | ||
| 105 | } | 117 | } |
| 118 | + | ||
| 106 | } | 119 | } |
| 107 | } catch (SipException e) { | 120 | } catch (SipException e) { |
| 108 | e.printStackTrace(); | 121 | e.printStackTrace(); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.genersoft.iot.vmp.common.StreamInfo; | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.*; | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | +import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 9 | +import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 10 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; | 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 15 | +import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | ||
| 16 | +import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | ||
| 9 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 17 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 18 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 11 | import com.genersoft.iot.vmp.service.IMediaServerService; | 19 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 12 | import com.genersoft.iot.vmp.service.IPlayService; | 20 | import com.genersoft.iot.vmp.service.IPlayService; |
| 21 | +import com.genersoft.iot.vmp.service.bean.SSRCInfo; | ||
| 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 22 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 23 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 15 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | 24 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| 25 | +import gov.nist.javax.sdp.TimeDescriptionImpl; | ||
| 26 | +import gov.nist.javax.sdp.fields.TimeField; | ||
| 16 | import gov.nist.javax.sip.address.AddressImpl; | 27 | import gov.nist.javax.sip.address.AddressImpl; |
| 17 | import gov.nist.javax.sip.address.SipUri; | 28 | import gov.nist.javax.sip.address.SipUri; |
| 18 | import org.slf4j.Logger; | 29 | import org.slf4j.Logger; |
| @@ -27,10 +38,13 @@ import javax.sip.RequestEvent; | @@ -27,10 +38,13 @@ import javax.sip.RequestEvent; | ||
| 27 | import javax.sip.ServerTransaction; | 38 | import javax.sip.ServerTransaction; |
| 28 | import javax.sip.SipException; | 39 | import javax.sip.SipException; |
| 29 | import javax.sip.address.SipURI; | 40 | import javax.sip.address.SipURI; |
| 41 | +import javax.sip.header.CallIdHeader; | ||
| 30 | import javax.sip.header.FromHeader; | 42 | import javax.sip.header.FromHeader; |
| 31 | import javax.sip.message.Request; | 43 | import javax.sip.message.Request; |
| 32 | import javax.sip.message.Response; | 44 | import javax.sip.message.Response; |
| 33 | import java.text.ParseException; | 45 | import java.text.ParseException; |
| 46 | +import java.text.SimpleDateFormat; | ||
| 47 | +import java.util.Date; | ||
| 34 | import java.util.List; | 48 | import java.util.List; |
| 35 | import java.util.Vector; | 49 | import java.util.Vector; |
| 36 | 50 | ||
| @@ -61,6 +75,9 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -61,6 +75,9 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 61 | private IPlayService playService; | 75 | private IPlayService playService; |
| 62 | 76 | ||
| 63 | @Autowired | 77 | @Autowired |
| 78 | + private ISIPCommander commander; | ||
| 79 | + | ||
| 80 | + @Autowired | ||
| 64 | private ZLMRTPServerFactory zlmrtpServerFactory; | 81 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| 65 | 82 | ||
| 66 | @Autowired | 83 | @Autowired |
| @@ -69,6 +86,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -69,6 +86,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 69 | @Autowired | 86 | @Autowired |
| 70 | private SIPProcessorObserver sipProcessorObserver; | 87 | private SIPProcessorObserver sipProcessorObserver; |
| 71 | 88 | ||
| 89 | + | ||
| 72 | @Override | 90 | @Override |
| 73 | public void afterPropertiesSet() throws Exception { | 91 | public void afterPropertiesSet() throws Exception { |
| 74 | // 添加消息处理的订阅 | 92 | // 添加消息处理的订阅 |
| @@ -88,22 +106,19 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -88,22 +106,19 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 88 | Request request = evt.getRequest(); | 106 | Request request = evt.getRequest(); |
| 89 | SipURI sipURI = (SipURI) request.getRequestURI(); | 107 | SipURI sipURI = (SipURI) request.getRequestURI(); |
| 90 | String channelId = sipURI.getUser(); | 108 | String channelId = sipURI.getUser(); |
| 91 | - String requesterId = null; | ||
| 92 | - | ||
| 93 | - FromHeader fromHeader = (FromHeader)request.getHeader(FromHeader.NAME); | ||
| 94 | - AddressImpl address = (AddressImpl) fromHeader.getAddress(); | ||
| 95 | - SipUri uri = (SipUri) address.getURI(); | ||
| 96 | - requesterId = uri.getUser(); | ||
| 97 | - | 109 | + String requesterId = SipUtils.getUserIdFromFromHeader(request); |
| 110 | + CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME); | ||
| 98 | if (requesterId == null || channelId == null) { | 111 | if (requesterId == null || channelId == null) { |
| 99 | logger.info("无法从FromHeader的Address中获取到平台id,返回400"); | 112 | logger.info("无法从FromHeader的Address中获取到平台id,返回400"); |
| 100 | responseAck(evt, Response.BAD_REQUEST); // 参数不全, 发400,请求错误 | 113 | responseAck(evt, Response.BAD_REQUEST); // 参数不全, 发400,请求错误 |
| 101 | return; | 114 | return; |
| 102 | } | 115 | } |
| 103 | 116 | ||
| 104 | - // 查询请求方是否上级平台 | 117 | + // 查询请求是否来自上级平台\设备 |
| 105 | ParentPlatform platform = storager.queryParentPlatByServerGBId(requesterId); | 118 | ParentPlatform platform = storager.queryParentPlatByServerGBId(requesterId); |
| 106 | - if (platform != null) { | 119 | + if (platform == null) { |
| 120 | + inviteFromDeviceHandle(evt, requesterId); | ||
| 121 | + }else { | ||
| 107 | // 查询平台下是否有该通道 | 122 | // 查询平台下是否有该通道 |
| 108 | DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId); | 123 | DeviceChannel channel = storager.queryChannelInParentPlatform(requesterId, channelId); |
| 109 | GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId); | 124 | GbStream gbStream = storager.queryStreamInParentPlatform(requesterId, channelId); |
| @@ -122,7 +137,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -122,7 +137,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 122 | mediaServerItem = mediaServerService.getOne(mediaServerId); | 137 | mediaServerItem = mediaServerService.getOne(mediaServerId); |
| 123 | if (mediaServerItem == null) { | 138 | if (mediaServerItem == null) { |
| 124 | logger.info("[ app={}, stream={} ]找不到zlm {},返回410",gbStream.getApp(), gbStream.getStream(), mediaServerId); | 139 | logger.info("[ app={}, stream={} ]找不到zlm {},返回410",gbStream.getApp(), gbStream.getStream(), mediaServerId); |
| 125 | - responseAck(evt, Response.GONE, "media server not found"); | 140 | + responseAck(evt, Response.GONE); |
| 126 | return; | 141 | return; |
| 127 | } | 142 | } |
| 128 | Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); | 143 | Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); |
| @@ -158,13 +173,26 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -158,13 +173,26 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 158 | ssrc = ssrcDefault; | 173 | ssrc = ssrcDefault; |
| 159 | sdp = SdpFactory.getInstance().createSessionDescription(contentString); | 174 | sdp = SdpFactory.getInstance().createSessionDescription(contentString); |
| 160 | } | 175 | } |
| 161 | - | 176 | + String sessionName = sdp.getSessionName().getValue(); |
| 177 | + | ||
| 178 | + Long startTime = null; | ||
| 179 | + Long stopTime = null; | ||
| 180 | + Date start = null; | ||
| 181 | + Date end = null; | ||
| 182 | + if (sdp.getTimeDescriptions(false) != null && sdp.getTimeDescriptions(false).size() > 0) { | ||
| 183 | + TimeDescriptionImpl timeDescription = (TimeDescriptionImpl)(sdp.getTimeDescriptions(false).get(0)); | ||
| 184 | + TimeField startTimeFiled = (TimeField)timeDescription.getTime(); | ||
| 185 | + startTime = startTimeFiled.getStartTime(); | ||
| 186 | + stopTime = startTimeFiled.getStopTime(); | ||
| 187 | + | ||
| 188 | + start = new Date(startTime*1000); | ||
| 189 | + end = new Date(stopTime*1000); | ||
| 190 | + } | ||
| 162 | // 获取支持的格式 | 191 | // 获取支持的格式 |
| 163 | Vector mediaDescriptions = sdp.getMediaDescriptions(true); | 192 | Vector mediaDescriptions = sdp.getMediaDescriptions(true); |
| 164 | // 查看是否支持PS 负载96 | 193 | // 查看是否支持PS 负载96 |
| 165 | //String ip = null; | 194 | //String ip = null; |
| 166 | int port = -1; | 195 | int port = -1; |
| 167 | - //boolean recvonly = false; | ||
| 168 | boolean mediaTransmissionTCP = false; | 196 | boolean mediaTransmissionTCP = false; |
| 169 | Boolean tcpActive = null; | 197 | Boolean tcpActive = null; |
| 170 | for (Object description : mediaDescriptions) { | 198 | for (Object description : mediaDescriptions) { |
| @@ -200,7 +228,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -200,7 +228,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 200 | } | 228 | } |
| 201 | String username = sdp.getOrigin().getUsername(); | 229 | String username = sdp.getOrigin().getUsername(); |
| 202 | String addressStr = sdp.getOrigin().getAddress(); | 230 | String addressStr = sdp.getOrigin().getAddress(); |
| 203 | - //String sessionName = sdp.getSessionName().getValue(); | ||
| 204 | logger.info("[上级点播]用户:{}, 地址:{}:{}, ssrc:{}", username, addressStr, port, ssrc); | 231 | logger.info("[上级点播]用户:{}, 地址:{}:{}, ssrc:{}", username, addressStr, port, ssrc); |
| 205 | Device device = null; | 232 | Device device = null; |
| 206 | // 通过 channel 和 gbStream 是否为null 值判断来源是直播流合适国标 | 233 | // 通过 channel 和 gbStream 是否为null 值判断来源是直播流合适国标 |
| @@ -228,23 +255,33 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -228,23 +255,33 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 228 | responseAck(evt, Response.BUSY_HERE); | 255 | responseAck(evt, Response.BUSY_HERE); |
| 229 | return; | 256 | return; |
| 230 | } | 257 | } |
| 231 | - | 258 | + sendRtpItem.setCallId(callIdHeader.getCallId()); |
| 259 | + sendRtpItem.setPlay("Play".equals(sessionName)); | ||
| 232 | // 写入redis, 超时时回复 | 260 | // 写入redis, 超时时回复 |
| 233 | redisCatchStorage.updateSendRTPSever(sendRtpItem); | 261 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 234 | - // 通知下级推流, | ||
| 235 | - PlayResult playResult = playService.play(mediaServerItem,device.getDeviceId(), channelId, (mediaServerItemInUSe, responseJSON)->{ | ||
| 236 | - // 收到推流, 回复200OK, 等待ack | ||
| 237 | - // if (sendRtpItem == null) return; | 262 | + |
| 263 | + Device finalDevice = device; | ||
| 264 | + MediaServerItem finalMediaServerItem = mediaServerItem; | ||
| 265 | + Long finalStartTime = startTime; | ||
| 266 | + Long finalStopTime = stopTime; | ||
| 267 | + ZLMHttpHookSubscribe.Event hookEvent = (mediaServerItemInUSe, responseJSON)->{ | ||
| 268 | + logger.info("[上级点播]下级已经开始推流。 回复200OK(SDP), {}/{}", sendRtpItem.getApp(), sendRtpItem.getStreamId()); | ||
| 269 | + // * 0 等待设备推流上来 | ||
| 270 | + // * 1 下级已经推流,等待上级平台回复ack | ||
| 271 | + // * 2 推流中 | ||
| 238 | sendRtpItem.setStatus(1); | 272 | sendRtpItem.setStatus(1); |
| 239 | redisCatchStorage.updateSendRTPSever(sendRtpItem); | 273 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 240 | - // TODO 添加对tcp的支持 | ||
| 241 | 274 | ||
| 242 | StringBuffer content = new StringBuffer(200); | 275 | StringBuffer content = new StringBuffer(200); |
| 243 | content.append("v=0\r\n"); | 276 | content.append("v=0\r\n"); |
| 244 | content.append("o="+ channelId +" 0 0 IN IP4 "+mediaServerItemInUSe.getSdpIp()+"\r\n"); | 277 | content.append("o="+ channelId +" 0 0 IN IP4 "+mediaServerItemInUSe.getSdpIp()+"\r\n"); |
| 245 | - content.append("s=Play\r\n"); | 278 | + content.append("s=" + sessionName+"\r\n"); |
| 246 | content.append("c=IN IP4 "+mediaServerItemInUSe.getSdpIp()+"\r\n"); | 279 | content.append("c=IN IP4 "+mediaServerItemInUSe.getSdpIp()+"\r\n"); |
| 247 | - content.append("t=0 0\r\n"); | 280 | + if ("Playback".equals(sessionName)) { |
| 281 | + content.append("t=" + finalStartTime + " " + finalStopTime + "\r\n"); | ||
| 282 | + }else { | ||
| 283 | + content.append("t=0 0\r\n"); | ||
| 284 | + } | ||
| 248 | content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); | 285 | content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); |
| 249 | content.append("a=sendonly\r\n"); | 286 | content.append("a=sendonly\r\n"); |
| 250 | content.append("a=rtpmap:96 PS/90000\r\n"); | 287 | content.append("a=rtpmap:96 PS/90000\r\n"); |
| @@ -260,7 +297,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -260,7 +297,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 260 | } catch (ParseException e) { | 297 | } catch (ParseException e) { |
| 261 | e.printStackTrace(); | 298 | e.printStackTrace(); |
| 262 | } | 299 | } |
| 263 | - } ,((event) -> { | 300 | + }; |
| 301 | + SipSubscribe.Event errorEvent = ((event) -> { | ||
| 264 | // 未知错误。直接转发设备点播的错误 | 302 | // 未知错误。直接转发设备点播的错误 |
| 265 | Response response = null; | 303 | Response response = null; |
| 266 | try { | 304 | try { |
| @@ -271,11 +309,46 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -271,11 +309,46 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 271 | } catch (ParseException | SipException | InvalidArgumentException e) { | 309 | } catch (ParseException | SipException | InvalidArgumentException e) { |
| 272 | e.printStackTrace(); | 310 | e.printStackTrace(); |
| 273 | } | 311 | } |
| 274 | - })); | ||
| 275 | - if (logger.isDebugEnabled()) { | ||
| 276 | - logger.debug(playResult.getResult().toString()); | 312 | + }); |
| 313 | + if ("Playback".equals(sessionName)) { | ||
| 314 | + sendRtpItem.setPlay(false); | ||
| 315 | + sendRtpItem.setStreamId(ssrc); | ||
| 316 | + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 317 | + playService.playBack(device.getDeviceId(), channelId, format.format(start), format.format(end),result -> { | ||
| 318 | + if (result.getCode() != 0){ | ||
| 319 | + logger.warn("录像回放失败"); | ||
| 320 | + if (result.getEvent() != null) { | ||
| 321 | + errorEvent.response(result.getEvent()); | ||
| 322 | + } | ||
| 323 | + try { | ||
| 324 | + responseAck(evt, Response.REQUEST_TIMEOUT); | ||
| 325 | + } catch (SipException e) { | ||
| 326 | + e.printStackTrace(); | ||
| 327 | + } catch (InvalidArgumentException e) { | ||
| 328 | + e.printStackTrace(); | ||
| 329 | + } catch (ParseException e) { | ||
| 330 | + e.printStackTrace(); | ||
| 331 | + } | ||
| 332 | + }else { | ||
| 333 | + if (result.getMediaServerItem() != null) { | ||
| 334 | + hookEvent.response(result.getMediaServerItem(), result.getResponse()); | ||
| 335 | + } | ||
| 336 | + } | ||
| 337 | + }); | ||
| 338 | + }else { | ||
| 339 | + sendRtpItem.setPlay(true); | ||
| 340 | + StreamInfo streamInfo = redisCatchStorage.queryPlayByDevice(device.getDeviceId(), channelId); | ||
| 341 | + if (streamInfo == null) { | ||
| 342 | + if (mediaServerItem.isRtpEnable()) { | ||
| 343 | + sendRtpItem.setStreamId(String.format("%s_%s", device.getDeviceId(), channelId)); | ||
| 344 | + } | ||
| 345 | + sendRtpItem.setPlay(false); | ||
| 346 | + playService.play(mediaServerItem,device.getDeviceId(), channelId, hookEvent,errorEvent); | ||
| 347 | + }else { | ||
| 348 | + sendRtpItem.setStreamId(streamInfo.getStream()); | ||
| 349 | + hookEvent.response(mediaServerItem, null); | ||
| 350 | + } | ||
| 277 | } | 351 | } |
| 278 | - | ||
| 279 | }else if (gbStream != null) { | 352 | }else if (gbStream != null) { |
| 280 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | 353 | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, |
| 281 | gbStream.getApp(), gbStream.getStream(), channelId, | 354 | gbStream.getApp(), gbStream.getStream(), channelId, |
| @@ -291,11 +364,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -291,11 +364,8 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 291 | } | 364 | } |
| 292 | 365 | ||
| 293 | // 写入redis, 超时时回复 | 366 | // 写入redis, 超时时回复 |
| 294 | - redisCatchStorage.updateSendRTPSever(sendRtpItem); | ||
| 295 | - | ||
| 296 | sendRtpItem.setStatus(1); | 367 | sendRtpItem.setStatus(1); |
| 297 | redisCatchStorage.updateSendRTPSever(sendRtpItem); | 368 | redisCatchStorage.updateSendRTPSever(sendRtpItem); |
| 298 | - // TODO 添加对tcp的支持 | ||
| 299 | StringBuffer content = new StringBuffer(200); | 369 | StringBuffer content = new StringBuffer(200); |
| 300 | content.append("v=0\r\n"); | 370 | content.append("v=0\r\n"); |
| 301 | content.append("o="+ channelId +" 0 0 IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); | 371 | content.append("o="+ channelId +" 0 0 IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); |
| @@ -319,72 +389,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -319,72 +389,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 319 | } | 389 | } |
| 320 | } | 390 | } |
| 321 | 391 | ||
| 322 | - } else { | ||
| 323 | - // 非上级平台请求,查询是否设备请求(通常为接收语音广播的设备) | ||
| 324 | - Device device = redisCatchStorage.getDevice(requesterId); | ||
| 325 | - if (device != null) { | ||
| 326 | - logger.info("收到设备" + requesterId + "的语音广播Invite请求"); | ||
| 327 | - responseAck(evt, Response.TRYING); | ||
| 328 | - | ||
| 329 | - String contentString = new String(request.getRawContent()); | ||
| 330 | - // jainSip不支持y=字段, 移除移除以解析。 | ||
| 331 | - String substring = contentString; | ||
| 332 | - String ssrc = "0000000404"; | ||
| 333 | - int ssrcIndex = contentString.indexOf("y="); | ||
| 334 | - if (ssrcIndex > 0) { | ||
| 335 | - substring = contentString.substring(0, ssrcIndex); | ||
| 336 | - ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12); | ||
| 337 | - } | ||
| 338 | - ssrcIndex = substring.indexOf("f="); | ||
| 339 | - if (ssrcIndex > 0) { | ||
| 340 | - substring = contentString.substring(0, ssrcIndex); | ||
| 341 | - } | ||
| 342 | - SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring); | ||
| 343 | - | ||
| 344 | - // 获取支持的格式 | ||
| 345 | - Vector mediaDescriptions = sdp.getMediaDescriptions(true); | ||
| 346 | - // 查看是否支持PS 负载96 | ||
| 347 | - int port = -1; | ||
| 348 | - //boolean recvonly = false; | ||
| 349 | - boolean mediaTransmissionTCP = false; | ||
| 350 | - Boolean tcpActive = null; | ||
| 351 | - for (int i = 0; i < mediaDescriptions.size(); i++) { | ||
| 352 | - MediaDescription mediaDescription = (MediaDescription)mediaDescriptions.get(i); | ||
| 353 | - Media media = mediaDescription.getMedia(); | ||
| 354 | - | ||
| 355 | - Vector mediaFormats = media.getMediaFormats(false); | ||
| 356 | - if (mediaFormats.contains("8")) { | ||
| 357 | - port = media.getMediaPort(); | ||
| 358 | - String protocol = media.getProtocol(); | ||
| 359 | - // 区分TCP发流还是udp, 当前默认udp | ||
| 360 | - if ("TCP/RTP/AVP".equals(protocol)) { | ||
| 361 | - String setup = mediaDescription.getAttribute("setup"); | ||
| 362 | - if (setup != null) { | ||
| 363 | - mediaTransmissionTCP = true; | ||
| 364 | - if ("active".equals(setup)) { | ||
| 365 | - tcpActive = true; | ||
| 366 | - } else if ("passive".equals(setup)) { | ||
| 367 | - tcpActive = false; | ||
| 368 | - } | ||
| 369 | - } | ||
| 370 | - } | ||
| 371 | - break; | ||
| 372 | - } | ||
| 373 | - } | ||
| 374 | - if (port == -1) { | ||
| 375 | - logger.info("不支持的媒体格式,返回415"); | ||
| 376 | - // 回复不支持的格式 | ||
| 377 | - responseAck(evt, Response.UNSUPPORTED_MEDIA_TYPE); // 不支持的格式,发415 | ||
| 378 | - return; | ||
| 379 | - } | ||
| 380 | - String username = sdp.getOrigin().getUsername(); | ||
| 381 | - String addressStr = sdp.getOrigin().getAddress(); | ||
| 382 | - logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}", username, addressStr, port, ssrc); | ||
| 383 | - | ||
| 384 | - } else { | ||
| 385 | - logger.warn("来自无效设备/平台的请求"); | ||
| 386 | - responseAck(evt, Response.BAD_REQUEST); | ||
| 387 | - } | ||
| 388 | } | 392 | } |
| 389 | 393 | ||
| 390 | } catch (SipException | InvalidArgumentException | ParseException e) { | 394 | } catch (SipException | InvalidArgumentException | ParseException e) { |
| @@ -397,4 +401,74 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -397,4 +401,74 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 397 | e.printStackTrace(); | 401 | e.printStackTrace(); |
| 398 | } | 402 | } |
| 399 | } | 403 | } |
| 404 | + | ||
| 405 | + public void inviteFromDeviceHandle(RequestEvent evt, String requesterId) throws InvalidArgumentException, ParseException, SipException, SdpException { | ||
| 406 | + | ||
| 407 | + // 非上级平台请求,查询是否设备请求(通常为接收语音广播的设备) | ||
| 408 | + Device device = redisCatchStorage.getDevice(requesterId); | ||
| 409 | + Request request = evt.getRequest(); | ||
| 410 | + if (device != null) { | ||
| 411 | + logger.info("收到设备" + requesterId + "的语音广播Invite请求"); | ||
| 412 | + responseAck(evt, Response.TRYING); | ||
| 413 | + | ||
| 414 | + String contentString = new String(request.getRawContent()); | ||
| 415 | + // jainSip不支持y=字段, 移除移除以解析。 | ||
| 416 | + String substring = contentString; | ||
| 417 | + String ssrc = "0000000404"; | ||
| 418 | + int ssrcIndex = contentString.indexOf("y="); | ||
| 419 | + if (ssrcIndex > 0) { | ||
| 420 | + substring = contentString.substring(0, ssrcIndex); | ||
| 421 | + ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12); | ||
| 422 | + } | ||
| 423 | + ssrcIndex = substring.indexOf("f="); | ||
| 424 | + if (ssrcIndex > 0) { | ||
| 425 | + substring = contentString.substring(0, ssrcIndex); | ||
| 426 | + } | ||
| 427 | + SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring); | ||
| 428 | + | ||
| 429 | + // 获取支持的格式 | ||
| 430 | + Vector mediaDescriptions = sdp.getMediaDescriptions(true); | ||
| 431 | + // 查看是否支持PS 负载96 | ||
| 432 | + int port = -1; | ||
| 433 | + //boolean recvonly = false; | ||
| 434 | + boolean mediaTransmissionTCP = false; | ||
| 435 | + Boolean tcpActive = null; | ||
| 436 | + for (int i = 0; i < mediaDescriptions.size(); i++) { | ||
| 437 | + MediaDescription mediaDescription = (MediaDescription)mediaDescriptions.get(i); | ||
| 438 | + Media media = mediaDescription.getMedia(); | ||
| 439 | + | ||
| 440 | + Vector mediaFormats = media.getMediaFormats(false); | ||
| 441 | + if (mediaFormats.contains("8")) { | ||
| 442 | + port = media.getMediaPort(); | ||
| 443 | + String protocol = media.getProtocol(); | ||
| 444 | + // 区分TCP发流还是udp, 当前默认udp | ||
| 445 | + if ("TCP/RTP/AVP".equals(protocol)) { | ||
| 446 | + String setup = mediaDescription.getAttribute("setup"); | ||
| 447 | + if (setup != null) { | ||
| 448 | + mediaTransmissionTCP = true; | ||
| 449 | + if ("active".equals(setup)) { | ||
| 450 | + tcpActive = true; | ||
| 451 | + } else if ("passive".equals(setup)) { | ||
| 452 | + tcpActive = false; | ||
| 453 | + } | ||
| 454 | + } | ||
| 455 | + } | ||
| 456 | + break; | ||
| 457 | + } | ||
| 458 | + } | ||
| 459 | + if (port == -1) { | ||
| 460 | + logger.info("不支持的媒体格式,返回415"); | ||
| 461 | + // 回复不支持的格式 | ||
| 462 | + responseAck(evt, Response.UNSUPPORTED_MEDIA_TYPE); // 不支持的格式,发415 | ||
| 463 | + return; | ||
| 464 | + } | ||
| 465 | + String username = sdp.getOrigin().getUsername(); | ||
| 466 | + String addressStr = sdp.getOrigin().getAddress(); | ||
| 467 | + logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}", username, addressStr, port, ssrc); | ||
| 468 | + | ||
| 469 | + } else { | ||
| 470 | + logger.warn("来自无效设备/平台的请求"); | ||
| 471 | + responseAck(evt, Response.BAD_REQUEST); | ||
| 472 | + } | ||
| 473 | + } | ||
| 400 | } | 474 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.cmd; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.conf.SipConfig; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.bean.*; | ||
| 5 | +import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 6 | +import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener; | ||
| 7 | +import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | ||
| 8 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | ||
| 9 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | ||
| 10 | +import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | ||
| 11 | +import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | ||
| 12 | +import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; | ||
| 13 | +import com.genersoft.iot.vmp.gb28181.utils.DateUtil; | ||
| 14 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | ||
| 15 | +import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | ||
| 16 | +import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | ||
| 17 | +import org.dom4j.Element; | ||
| 18 | +import org.slf4j.Logger; | ||
| 19 | +import org.slf4j.LoggerFactory; | ||
| 20 | +import org.springframework.beans.factory.InitializingBean; | ||
| 21 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 22 | +import org.springframework.stereotype.Component; | ||
| 23 | + | ||
| 24 | +import javax.sip.InvalidArgumentException; | ||
| 25 | +import javax.sip.RequestEvent; | ||
| 26 | +import javax.sip.SipException; | ||
| 27 | +import javax.sip.header.FromHeader; | ||
| 28 | +import javax.sip.message.Response; | ||
| 29 | +import java.text.ParseException; | ||
| 30 | +import java.util.List; | ||
| 31 | + | ||
| 32 | +@Component | ||
| 33 | +public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { | ||
| 34 | + | ||
| 35 | + private Logger logger = LoggerFactory.getLogger(RecordInfoQueryMessageHandler.class); | ||
| 36 | + private final String cmdType = "RecordInfo"; | ||
| 37 | + | ||
| 38 | + @Autowired | ||
| 39 | + private QueryMessageHandler queryMessageHandler; | ||
| 40 | + | ||
| 41 | + @Autowired | ||
| 42 | + private IVideoManagerStorager storager; | ||
| 43 | + | ||
| 44 | + @Autowired | ||
| 45 | + private SIPCommanderFroPlatform cmderFroPlatform; | ||
| 46 | + | ||
| 47 | + @Autowired | ||
| 48 | + private SIPCommander commander; | ||
| 49 | + | ||
| 50 | + @Autowired | ||
| 51 | + private RecordEndEventListener recordEndEventListener; | ||
| 52 | + | ||
| 53 | + @Autowired | ||
| 54 | + private SipConfig config; | ||
| 55 | + | ||
| 56 | + @Autowired | ||
| 57 | + private EventPublisher publisher; | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public void afterPropertiesSet() throws Exception { | ||
| 61 | + queryMessageHandler.addHandler(cmdType, this); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public void handForDevice(RequestEvent evt, Device device, Element element) { | ||
| 66 | + | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public void handForPlatform(RequestEvent evt, ParentPlatform parentPlatform, Element rootElement) { | ||
| 71 | + | ||
| 72 | + FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); | ||
| 73 | + | ||
| 74 | + Element snElement = rootElement.element("SN"); | ||
| 75 | + int sn = Integer.parseInt(snElement.getText()); | ||
| 76 | + Element deviceIDElement = rootElement.element("DeviceID"); | ||
| 77 | + String channelId = deviceIDElement.getText(); | ||
| 78 | + Element startTimeElement = rootElement.element("StartTime"); | ||
| 79 | + String startTime = null; | ||
| 80 | + if (startTimeElement != null) { | ||
| 81 | + startTime = startTimeElement.getText(); | ||
| 82 | + } | ||
| 83 | + Element endTimeElement = rootElement.element("EndTime"); | ||
| 84 | + String endTime = null; | ||
| 85 | + if (endTimeElement != null) { | ||
| 86 | + endTime = endTimeElement.getText(); | ||
| 87 | + } | ||
| 88 | + Element secrecyElement = rootElement.element("Secrecy"); | ||
| 89 | + int secrecy = 0; | ||
| 90 | + if (secrecyElement != null) { | ||
| 91 | + secrecy = Integer.parseInt(secrecyElement.getText()); | ||
| 92 | + } | ||
| 93 | + String type = "all"; | ||
| 94 | + Element typeElement = rootElement.element("Type"); | ||
| 95 | + if (typeElement != null) { | ||
| 96 | + type = typeElement.getText(); | ||
| 97 | + } | ||
| 98 | + // 确认是直播还是国标, 国标直接请求下级,直播请求录像管理服务 | ||
| 99 | + List<ChannelSourceInfo> channelSources = storager.getChannelSource(parentPlatform.getServerGBId(), channelId); | ||
| 100 | + | ||
| 101 | + if (channelSources.get(0).getCount() > 0) { // 国标 | ||
| 102 | + // 向国标设备请求录像数据 | ||
| 103 | + Device device = storager.queryVideoDeviceByPlatformIdAndChannelId(parentPlatform.getServerGBId(), channelId); | ||
| 104 | + DeviceChannel deviceChannel = storager.queryChannelInParentPlatform(parentPlatform.getServerGBId(), channelId); | ||
| 105 | + // 接收录像数据 | ||
| 106 | + recordEndEventListener.addEndEventHandler(deviceChannel.getDeviceId(), channelId, (recordInfo)->{ | ||
| 107 | + cmderFroPlatform.recordInfo(deviceChannel, parentPlatform, fromHeader.getTag(), recordInfo); | ||
| 108 | + }); | ||
| 109 | + commander.recordInfoQuery(device, channelId, DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(startTime), | ||
| 110 | + DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(endTime), sn, secrecy, type, (eventResult -> { | ||
| 111 | + // 回复200 OK | ||
| 112 | + try { | ||
| 113 | + responseAck(evt, Response.OK); | ||
| 114 | + } catch (SipException e) { | ||
| 115 | + e.printStackTrace(); | ||
| 116 | + } catch (InvalidArgumentException e) { | ||
| 117 | + e.printStackTrace(); | ||
| 118 | + } catch (ParseException e) { | ||
| 119 | + e.printStackTrace(); | ||
| 120 | + } | ||
| 121 | + }),(eventResult -> { | ||
| 122 | + // 查询失败 | ||
| 123 | + try { | ||
| 124 | + responseAck(evt, eventResult.statusCode, eventResult.msg); | ||
| 125 | + } catch (SipException e) { | ||
| 126 | + e.printStackTrace(); | ||
| 127 | + } catch (InvalidArgumentException e) { | ||
| 128 | + e.printStackTrace(); | ||
| 129 | + } catch (ParseException e) { | ||
| 130 | + e.printStackTrace(); | ||
| 131 | + } | ||
| 132 | + })); | ||
| 133 | + | ||
| 134 | + }else if (channelSources.get(1).getCount() > 0) { // 直播流 | ||
| 135 | + // TODO | ||
| 136 | + try { | ||
| 137 | + responseAck(evt, Response.NOT_IMPLEMENTED); // 回复未实现 | ||
| 138 | + } catch (SipException e) { | ||
| 139 | + e.printStackTrace(); | ||
| 140 | + } catch (InvalidArgumentException e) { | ||
| 141 | + e.printStackTrace(); | ||
| 142 | + } catch (ParseException e) { | ||
| 143 | + e.printStackTrace(); | ||
| 144 | + } | ||
| 145 | + }else { // 错误的请求 | ||
| 146 | + try { | ||
| 147 | + responseAck(evt, Response.BAD_REQUEST); | ||
| 148 | + } catch (SipException e) { | ||
| 149 | + e.printStackTrace(); | ||
| 150 | + } catch (InvalidArgumentException e) { | ||
| 151 | + e.printStackTrace(); | ||
| 152 | + } catch (ParseException e) { | ||
| 153 | + e.printStackTrace(); | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + } | ||
| 157 | +} |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/RecordInfoResponseMessageHandler.java
| @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | @@ -4,6 +4,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; | 5 | import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.RecordItem; | 6 | import com.genersoft.iot.vmp.gb28181.bean.RecordItem; |
| 7 | +import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.callback.CheckForAllRecordsThread; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.CheckForAllRecordsThread; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| @@ -49,6 +50,9 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | @@ -49,6 +50,9 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | ||
| 49 | @Autowired | 50 | @Autowired |
| 50 | private DeferredResultHolder deferredResultHolder; | 51 | private DeferredResultHolder deferredResultHolder; |
| 51 | 52 | ||
| 53 | + @Autowired | ||
| 54 | + private EventPublisher eventPublisher; | ||
| 55 | + | ||
| 52 | @Override | 56 | @Override |
| 53 | public void afterPropertiesSet() throws Exception { | 57 | public void afterPropertiesSet() throws Exception { |
| 54 | responseMessageHandler.addHandler(cmdType, this); | 58 | responseMessageHandler.addHandler(cmdType, this); |
| @@ -77,6 +81,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | @@ -77,6 +81,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | ||
| 77 | Element recordListElement = rootElement.element("RecordList"); | 81 | Element recordListElement = rootElement.element("RecordList"); |
| 78 | if (recordListElement == null || recordInfo.getSumNum() == 0) { | 82 | if (recordListElement == null || recordInfo.getSumNum() == 0) { |
| 79 | logger.info("无录像数据"); | 83 | logger.info("无录像数据"); |
| 84 | + eventPublisher.recordEndEventPush(recordInfo); | ||
| 80 | RequestMessage msg = new RequestMessage(); | 85 | RequestMessage msg = new RequestMessage(); |
| 81 | msg.setKey(key); | 86 | msg.setKey(key); |
| 82 | msg.setData(recordInfo); | 87 | msg.setData(recordInfo); |
| @@ -99,6 +104,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | @@ -99,6 +104,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | ||
| 99 | record.setDeviceId(getText(itemRecord, "DeviceID")); | 104 | record.setDeviceId(getText(itemRecord, "DeviceID")); |
| 100 | record.setName(getText(itemRecord, "Name")); | 105 | record.setName(getText(itemRecord, "Name")); |
| 101 | record.setFilePath(getText(itemRecord, "FilePath")); | 106 | record.setFilePath(getText(itemRecord, "FilePath")); |
| 107 | + record.setFileSize(getText(itemRecord, "FileSize")); | ||
| 102 | record.setAddress(getText(itemRecord, "Address")); | 108 | record.setAddress(getText(itemRecord, "Address")); |
| 103 | record.setStartTime( | 109 | record.setStartTime( |
| 104 | DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(getText(itemRecord, "StartTime"))); | 110 | DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(getText(itemRecord, "StartTime"))); |
| @@ -112,7 +118,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | @@ -112,7 +118,7 @@ public class RecordInfoResponseMessageHandler extends SIPRequestProcessorParent | ||
| 112 | } | 118 | } |
| 113 | recordInfo.setRecordList(recordList); | 119 | recordInfo.setRecordList(recordList); |
| 114 | } | 120 | } |
| 115 | - | 121 | + eventPublisher.recordEndEventPush(recordInfo); |
| 116 | // 改用单独线程统计已获取录像文件数量,避免多包并行分别统计不完整的问题 | 122 | // 改用单独线程统计已获取录像文件数量,避免多包并行分别统计不完整的问题 |
| 117 | String cacheKey = CACHE_RECORDINFO_KEY + device.getDeviceId() + sn; | 123 | String cacheKey = CACHE_RECORDINFO_KEY + device.getDeviceId() + sn; |
| 118 | redis.set(cacheKey + "_" + uuid, recordList, 90); | 124 | redis.set(cacheKey + "_" + uuid, recordList, 90); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/InviteResponseProcessor.java
| @@ -82,9 +82,6 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract { | @@ -82,9 +82,6 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract { | ||
| 82 | requestURI.setPort(event.getRemotePort()); | 82 | requestURI.setPort(event.getRemotePort()); |
| 83 | reqAck.setRequestURI(requestURI); | 83 | reqAck.setRequestURI(requestURI); |
| 84 | logger.info("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack"); | 84 | logger.info("向 " + event.getRemoteIpAddress() + ":" + event.getRemotePort() + "回复ack"); |
| 85 | - SipURI sipURI = (SipURI)dialog.getRemoteParty().getURI(); | ||
| 86 | - String deviceId = requestURI.getUser(); | ||
| 87 | - String channelId = sipURI.getUser(); | ||
| 88 | 85 | ||
| 89 | dialog.sendAck(reqAck); | 86 | dialog.sendAck(reqAck); |
| 90 | 87 |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -184,7 +184,7 @@ public class ZLMHttpHookListener { | @@ -184,7 +184,7 @@ public class ZLMHttpHookListener { | ||
| 184 | @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8") | 184 | @PostMapping(value = "/on_publish", produces = "application/json;charset=UTF-8") |
| 185 | public ResponseEntity<String> onPublish(@RequestBody JSONObject json) { | 185 | public ResponseEntity<String> onPublish(@RequestBody JSONObject json) { |
| 186 | 186 | ||
| 187 | - logger.debug("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString()); | 187 | + logger.info("[ ZLM HOOK ]on_publish API调用,参数:" + json.toString()); |
| 188 | JSONObject ret = new JSONObject(); | 188 | JSONObject ret = new JSONObject(); |
| 189 | ret.put("code", 0); | 189 | ret.put("code", 0); |
| 190 | ret.put("msg", "success"); | 190 | ret.put("msg", "success"); |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookSubscribe.java
| @@ -77,22 +77,23 @@ public class ZLMHttpHookSubscribe { | @@ -77,22 +77,23 @@ public class ZLMHttpHookSubscribe { | ||
| 77 | if (eventMap == null) { | 77 | if (eventMap == null) { |
| 78 | return; | 78 | return; |
| 79 | } | 79 | } |
| 80 | - Iterator<Map.Entry<JSONObject, Event>> iterator = eventMap.entrySet().iterator(); | ||
| 81 | - while (iterator.hasNext()){ | ||
| 82 | - Map.Entry<JSONObject, Event> next = iterator.next(); | ||
| 83 | - JSONObject key = next.getKey(); | ||
| 84 | - Boolean result = null; | ||
| 85 | - for (String s : key.keySet()) { | ||
| 86 | - if (result == null) { | ||
| 87 | - result = key.getString(s).equals(hookResponse.getString(s)); | ||
| 88 | - }else { | ||
| 89 | - if (key.getString(s) == null) continue; | ||
| 90 | - result = result && key.getString(s).equals(hookResponse.getString(s)); | 80 | + |
| 81 | + Set<Map.Entry<JSONObject, Event>> entries = eventMap.entrySet(); | ||
| 82 | + if (entries.size() > 0) { | ||
| 83 | + for (Map.Entry<JSONObject, Event> entry : entries) { | ||
| 84 | + JSONObject key = entry.getKey(); | ||
| 85 | + Boolean result = null; | ||
| 86 | + for (String s : key.keySet()) { | ||
| 87 | + if (result == null) { | ||
| 88 | + result = key.getString(s).equals(hookResponse.getString(s)); | ||
| 89 | + }else { | ||
| 90 | + if (key.getString(s) == null) continue; | ||
| 91 | + result = result && key.getString(s).equals(hookResponse.getString(s)); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + if (null != result && result){ | ||
| 95 | + entries.remove(entry); | ||
| 91 | } | 96 | } |
| 92 | - } | ||
| 93 | - if (null != result && result){ | ||
| 94 | - // TODO 报错未处理 | ||
| 95 | - iterator.remove(); | ||
| 96 | } | 97 | } |
| 97 | } | 98 | } |
| 98 | } | 99 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRTPServerFactory.java
| @@ -242,9 +242,18 @@ public class ZLMRTPServerFactory { | @@ -242,9 +242,18 @@ public class ZLMRTPServerFactory { | ||
| 242 | */ | 242 | */ |
| 243 | public int totalReaderCount(MediaServerItem mediaServerItem, String app, String streamId) { | 243 | public int totalReaderCount(MediaServerItem mediaServerItem, String app, String streamId) { |
| 244 | JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem, app, "rtmp", streamId); | 244 | JSONObject mediaInfo = zlmresTfulUtils.getMediaInfo(mediaServerItem, app, "rtmp", streamId); |
| 245 | + Integer code = mediaInfo.getInteger("code"); | ||
| 245 | if (mediaInfo == null) { | 246 | if (mediaInfo == null) { |
| 246 | return 0; | 247 | return 0; |
| 247 | } | 248 | } |
| 249 | + if ( code < 0) { | ||
| 250 | + logger.warn("查询流({}/{})是否有其它观看者时得到: {}", app, streamId, mediaInfo.getString("msg")); | ||
| 251 | + return -1; | ||
| 252 | + } | ||
| 253 | + if ( code == 0 && ! mediaInfo.getBoolean("online")) { | ||
| 254 | + logger.warn("查询流({}/{})是否有其它观看者时得到: {}", app, streamId, mediaInfo.getString("msg")); | ||
| 255 | + return -1; | ||
| 256 | + } | ||
| 248 | return mediaInfo.getInteger("totalReaderCount"); | 257 | return mediaInfo.getInteger("totalReaderCount"); |
| 249 | } | 258 | } |
| 250 | 259 |
src/main/java/com/genersoft/iot/vmp/service/IMediaServerService.java
| @@ -48,7 +48,7 @@ public interface IMediaServerService { | @@ -48,7 +48,7 @@ public interface IMediaServerService { | ||
| 48 | 48 | ||
| 49 | SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback); | 49 | SSRCInfo openRTPServer(MediaServerItem mediaServerItem, String streamId, boolean isPlayback); |
| 50 | 50 | ||
| 51 | - void closeRTPServer(Device device, String channelId, String ssrc); | 51 | + void closeRTPServer(String deviceId, String channelId, String ssrc); |
| 52 | 52 | ||
| 53 | void clearRTPServer(MediaServerItem mediaServerItem); | 53 | void clearRTPServer(MediaServerItem mediaServerItem); |
| 54 | 54 |
src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackCallback.java
| 1 | package com.genersoft.iot.vmp.service.bean; | 1 | package com.genersoft.iot.vmp.service.bean; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 3 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 4 | +import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ||
| 4 | 5 | ||
| 5 | public interface PlayBackCallback { | 6 | public interface PlayBackCallback { |
| 6 | 7 | ||
| 7 | - void call(RequestMessage msg); | 8 | + void call(PlayBackResult<RequestMessage> msg); |
| 8 | 9 | ||
| 9 | } | 10 | } |
src/main/java/com/genersoft/iot/vmp/service/bean/PlayBackResult.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.service.bean; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | ||
| 5 | +import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 6 | + | ||
| 7 | +import javax.sip.RequestEvent; | ||
| 8 | + | ||
| 9 | +public class PlayBackResult<T> { | ||
| 10 | + private int code; | ||
| 11 | + private T data; | ||
| 12 | + private MediaServerItem mediaServerItem; | ||
| 13 | + private JSONObject response; | ||
| 14 | + private SipSubscribe.EventResult event; | ||
| 15 | + | ||
| 16 | + public int getCode() { | ||
| 17 | + return code; | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + public void setCode(int code) { | ||
| 21 | + this.code = code; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + public T getData() { | ||
| 25 | + return data; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public void setData(T data) { | ||
| 29 | + this.data = data; | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | + public MediaServerItem getMediaServerItem() { | ||
| 33 | + return mediaServerItem; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + public void setMediaServerItem(MediaServerItem mediaServerItem) { | ||
| 37 | + this.mediaServerItem = mediaServerItem; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + public JSONObject getResponse() { | ||
| 41 | + return response; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setResponse(JSONObject response) { | ||
| 45 | + this.response = response; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public SipSubscribe.EventResult getEvent() { | ||
| 49 | + return event; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void setEvent(SipSubscribe.EventResult event) { | ||
| 53 | + this.event = event; | ||
| 54 | + } | ||
| 55 | +} |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| @@ -160,16 +160,16 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -160,16 +160,16 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | @Override | 162 | @Override |
| 163 | - public void closeRTPServer(Device device, String channelId, String stream) { | ||
| 164 | - String mediaServerId = streamSession.getMediaServerId(device.getDeviceId(), channelId, stream); | ||
| 165 | - String ssrc = streamSession.getSSRC(device.getDeviceId(), channelId, stream); | 163 | + public void closeRTPServer(String deviceId, String channelId, String stream) { |
| 164 | + String mediaServerId = streamSession.getMediaServerId(deviceId, channelId, stream); | ||
| 165 | + String ssrc = streamSession.getSSRC(deviceId, channelId, stream); | ||
| 166 | MediaServerItem mediaServerItem = this.getOne(mediaServerId); | 166 | MediaServerItem mediaServerItem = this.getOne(mediaServerId); |
| 167 | if (mediaServerItem != null) { | 167 | if (mediaServerItem != null) { |
| 168 | - String streamId = String.format("%s_%s", device.getDeviceId(), channelId); | 168 | + String streamId = String.format("%s_%s", deviceId, channelId); |
| 169 | zlmrtpServerFactory.closeRTPServer(mediaServerItem, streamId); | 169 | zlmrtpServerFactory.closeRTPServer(mediaServerItem, streamId); |
| 170 | releaseSsrc(mediaServerItem, ssrc); | 170 | releaseSsrc(mediaServerItem, ssrc); |
| 171 | } | 171 | } |
| 172 | - streamSession.remove(device.getDeviceId(), channelId, stream); | 172 | + streamSession.remove(deviceId, channelId, stream); |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | @Override | 175 | @Override |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -17,9 +17,11 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | @@ -17,9 +17,11 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | ||
| 17 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 17 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 18 | import com.genersoft.iot.vmp.service.IMediaServerService; | 18 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 19 | import com.genersoft.iot.vmp.service.bean.PlayBackCallback; | 19 | import com.genersoft.iot.vmp.service.bean.PlayBackCallback; |
| 20 | +import com.genersoft.iot.vmp.service.bean.PlayBackResult; | ||
| 20 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 21 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 21 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 22 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 22 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 23 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 24 | +import com.genersoft.iot.vmp.utils.redis.RedisUtil; | ||
| 23 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 25 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 24 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | 26 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| 25 | import com.genersoft.iot.vmp.service.IMediaService; | 27 | import com.genersoft.iot.vmp.service.IMediaService; |
| @@ -54,6 +56,9 @@ public class PlayServiceImpl implements IPlayService { | @@ -54,6 +56,9 @@ public class PlayServiceImpl implements IPlayService { | ||
| 54 | private IRedisCatchStorage redisCatchStorage; | 56 | private IRedisCatchStorage redisCatchStorage; |
| 55 | 57 | ||
| 56 | @Autowired | 58 | @Autowired |
| 59 | + private RedisUtil redis; | ||
| 60 | + | ||
| 61 | + @Autowired | ||
| 57 | private DeferredResultHolder resultHolder; | 62 | private DeferredResultHolder resultHolder; |
| 58 | 63 | ||
| 59 | @Autowired | 64 | @Autowired |
| @@ -112,7 +117,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -112,7 +117,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 112 | // 点播超时回复BYE | 117 | // 点播超时回复BYE |
| 113 | cmder.streamByeCmd(device.getDeviceId(), channelId, streamInfo.getStream()); | 118 | cmder.streamByeCmd(device.getDeviceId(), channelId, streamInfo.getStream()); |
| 114 | // 释放rtpserver | 119 | // 释放rtpserver |
| 115 | - mediaServerService.closeRTPServer(playResult.getDevice(), channelId, streamInfo.getStream()); | 120 | + mediaServerService.closeRTPServer(playResult.getDevice().getDeviceId(), channelId, streamInfo.getStream()); |
| 116 | // 回复之前所有的点播请求 | 121 | // 回复之前所有的点播请求 |
| 117 | resultHolder.invokeAllResult(msg); | 122 | resultHolder.invokeAllResult(msg); |
| 118 | // TODO 释放ssrc | 123 | // TODO 释放ssrc |
| @@ -121,7 +126,6 @@ public class PlayServiceImpl implements IPlayService { | @@ -121,7 +126,6 @@ public class PlayServiceImpl implements IPlayService { | ||
| 121 | // 点播结束时调用截图接口 | 126 | // 点播结束时调用截图接口 |
| 122 | try { | 127 | try { |
| 123 | String classPath = ResourceUtils.getURL("classpath:").getPath(); | 128 | String classPath = ResourceUtils.getURL("classpath:").getPath(); |
| 124 | - // System.out.println(classPath); | ||
| 125 | // 兼容打包为jar的class路径 | 129 | // 兼容打包为jar的class路径 |
| 126 | if(classPath.contains("jar")) { | 130 | if(classPath.contains("jar")) { |
| 127 | classPath = classPath.substring(0, classPath.lastIndexOf(".")); | 131 | classPath = classPath.substring(0, classPath.lastIndexOf(".")); |
| @@ -170,7 +174,10 @@ public class PlayServiceImpl implements IPlayService { | @@ -170,7 +174,10 @@ public class PlayServiceImpl implements IPlayService { | ||
| 170 | WVPResult wvpResult = new WVPResult(); | 174 | WVPResult wvpResult = new WVPResult(); |
| 171 | wvpResult.setCode(-1); | 175 | wvpResult.setCode(-1); |
| 172 | // 点播返回sip错误 | 176 | // 点播返回sip错误 |
| 173 | - mediaServerService.closeRTPServer(playResult.getDevice(), channelId, ssrcInfo.getStream()); | 177 | + mediaServerService.closeRTPServer(playResult.getDevice().getDeviceId(), channelId, ssrcInfo.getStream()); |
| 178 | + // 释放ssrc | ||
| 179 | + mediaServerService.releaseSsrc(mediaServerItem, ssrcInfo.getSsrc()); | ||
| 180 | + streamSession.remove(deviceId, channelId, ssrcInfo.getStream()); | ||
| 174 | wvpResult.setMsg(String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg)); | 181 | wvpResult.setMsg(String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg)); |
| 175 | msg.setData(wvpResult); | 182 | msg.setData(wvpResult); |
| 176 | resultHolder.invokeAllResult(msg); | 183 | resultHolder.invokeAllResult(msg); |
| @@ -219,7 +226,10 @@ public class PlayServiceImpl implements IPlayService { | @@ -219,7 +226,10 @@ public class PlayServiceImpl implements IPlayService { | ||
| 219 | logger.info("收到订阅消息: " + response.toJSONString()); | 226 | logger.info("收到订阅消息: " + response.toJSONString()); |
| 220 | onPublishHandlerForPlay(mediaServerItemInuse, response, deviceId, channelId, uuid); | 227 | onPublishHandlerForPlay(mediaServerItemInuse, response, deviceId, channelId, uuid); |
| 221 | }, (event) -> { | 228 | }, (event) -> { |
| 222 | - mediaServerService.closeRTPServer(playResult.getDevice(), channelId, ssrcInfo.getStream()); | 229 | + mediaServerService.closeRTPServer(playResult.getDevice().getDeviceId(), channelId, ssrcInfo.getStream()); |
| 230 | + // 释放ssrc | ||
| 231 | + mediaServerService.releaseSsrc(mediaServerItem, ssrcInfo.getSsrc()); | ||
| 232 | + streamSession.remove(deviceId, channelId, ssrcInfo.getStream()); | ||
| 223 | WVPResult wvpResult = new WVPResult(); | 233 | WVPResult wvpResult = new WVPResult(); |
| 224 | wvpResult.setCode(-1); | 234 | wvpResult.setCode(-1); |
| 225 | wvpResult.setMsg(String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg)); | 235 | wvpResult.setMsg(String.format("点播失败, 错误码: %s, %s", event.statusCode, event.msg)); |
| @@ -233,11 +243,11 @@ public class PlayServiceImpl implements IPlayService { | @@ -233,11 +243,11 @@ public class PlayServiceImpl implements IPlayService { | ||
| 233 | } | 243 | } |
| 234 | 244 | ||
| 235 | @Override | 245 | @Override |
| 236 | - public void onPublishHandlerForPlay(MediaServerItem mediaServerItem, JSONObject resonse, String deviceId, String channelId, String uuid) { | 246 | + public void onPublishHandlerForPlay(MediaServerItem mediaServerItem, JSONObject response, String deviceId, String channelId, String uuid) { |
| 237 | RequestMessage msg = new RequestMessage(); | 247 | RequestMessage msg = new RequestMessage(); |
| 238 | msg.setId(uuid); | 248 | msg.setId(uuid); |
| 239 | msg.setKey(DeferredResultHolder.CALLBACK_CMD_PLAY + deviceId + channelId); | 249 | msg.setKey(DeferredResultHolder.CALLBACK_CMD_PLAY + deviceId + channelId); |
| 240 | - StreamInfo streamInfo = onPublishHandler(mediaServerItem, resonse, deviceId, channelId); | 250 | + StreamInfo streamInfo = onPublishHandler(mediaServerItem, response, deviceId, channelId); |
| 241 | if (streamInfo != null) { | 251 | if (streamInfo != null) { |
| 242 | DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId); | 252 | DeviceChannel deviceChannel = storager.queryChannel(deviceId, channelId); |
| 243 | if (deviceChannel != null) { | 253 | if (deviceChannel != null) { |
| @@ -295,9 +305,12 @@ public class PlayServiceImpl implements IPlayService { | @@ -295,9 +305,12 @@ public class PlayServiceImpl implements IPlayService { | ||
| 295 | RequestMessage msg = new RequestMessage(); | 305 | RequestMessage msg = new RequestMessage(); |
| 296 | msg.setId(uuid); | 306 | msg.setId(uuid); |
| 297 | msg.setKey(key); | 307 | msg.setKey(key); |
| 308 | + PlayBackResult<RequestMessage> playBackResult = new PlayBackResult<>(); | ||
| 298 | result.onTimeout(()->{ | 309 | result.onTimeout(()->{ |
| 299 | msg.setData("回放超时"); | 310 | msg.setData("回放超时"); |
| 300 | - callback.call(msg); | 311 | + playBackResult.setCode(-1); |
| 312 | + playBackResult.setData(msg); | ||
| 313 | + callback.call(playBackResult); | ||
| 301 | }); | 314 | }); |
| 302 | cmder.playbackStreamCmd(newMediaServerItem, ssrcInfo, device, channelId, startTime, endTime, (MediaServerItem mediaServerItem, JSONObject response) -> { | 315 | cmder.playbackStreamCmd(newMediaServerItem, ssrcInfo, device, channelId, startTime, endTime, (MediaServerItem mediaServerItem, JSONObject response) -> { |
| 303 | logger.info("收到订阅消息: " + response.toJSONString()); | 316 | logger.info("收到订阅消息: " + response.toJSONString()); |
| @@ -305,15 +318,25 @@ public class PlayServiceImpl implements IPlayService { | @@ -305,15 +318,25 @@ public class PlayServiceImpl implements IPlayService { | ||
| 305 | if (streamInfo == null) { | 318 | if (streamInfo == null) { |
| 306 | logger.warn("设备回放API调用失败!"); | 319 | logger.warn("设备回放API调用失败!"); |
| 307 | msg.setData("设备回放API调用失败!"); | 320 | msg.setData("设备回放API调用失败!"); |
| 308 | - callback.call(msg); | 321 | + playBackResult.setCode(-1); |
| 322 | + playBackResult.setData(msg); | ||
| 323 | + callback.call(playBackResult); | ||
| 309 | return; | 324 | return; |
| 310 | } | 325 | } |
| 311 | redisCatchStorage.startPlayback(streamInfo); | 326 | redisCatchStorage.startPlayback(streamInfo); |
| 312 | msg.setData(JSON.toJSONString(streamInfo)); | 327 | msg.setData(JSON.toJSONString(streamInfo)); |
| 313 | - callback.call(msg); | 328 | + playBackResult.setCode(0); |
| 329 | + playBackResult.setData(msg); | ||
| 330 | + playBackResult.setMediaServerItem(mediaServerItem); | ||
| 331 | + playBackResult.setResponse(response); | ||
| 332 | + callback.call(playBackResult); | ||
| 314 | }, event -> { | 333 | }, event -> { |
| 315 | msg.setData(String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg)); | 334 | msg.setData(String.format("回放失败, 错误码: %s, %s", event.statusCode, event.msg)); |
| 316 | - callback.call(msg); | 335 | + playBackResult.setCode(-1); |
| 336 | + playBackResult.setData(msg); | ||
| 337 | + playBackResult.setEvent(event); | ||
| 338 | + callback.call(playBackResult); | ||
| 339 | + streamSession.remove(device.getDeviceId(), channelId, ssrcInfo.getStream()); | ||
| 317 | }); | 340 | }); |
| 318 | return result; | 341 | return result; |
| 319 | } | 342 | } |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java
| @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 5 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | 5 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 6 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 7 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 7 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 8 | +import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | ||
| 8 | import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; | 9 | import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; |
| 9 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 10 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 10 | import com.github.pagehelper.PageInfo; | 11 | import com.github.pagehelper.PageInfo; |
| @@ -475,4 +476,6 @@ public interface IVideoManagerStorager { | @@ -475,4 +476,6 @@ public interface IVideoManagerStorager { | ||
| 475 | void delRelationByPlatformId(String serverGBId); | 476 | void delRelationByPlatformId(String serverGBId); |
| 476 | 477 | ||
| 477 | PlatformCatalog queryDefaultCatalogInPlatform(String platformId); | 478 | PlatformCatalog queryDefaultCatalogInPlatform(String platformId); |
| 479 | + | ||
| 480 | + List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); | ||
| 478 | } | 481 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java
| 1 | package com.genersoft.iot.vmp.storager.dao; | 1 | package com.genersoft.iot.vmp.storager.dao; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 4 | +import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | ||
| 4 | import org.apache.ibatis.annotations.*; | 5 | import org.apache.ibatis.annotations.*; |
| 5 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
| 6 | 7 | ||
| @@ -86,4 +87,9 @@ public interface ParentPlatformMapper { | @@ -86,4 +87,9 @@ public interface ParentPlatformMapper { | ||
| 86 | "WHERE serverGBId=#{platformId}"+ | 87 | "WHERE serverGBId=#{platformId}"+ |
| 87 | "</script>"}) | 88 | "</script>"}) |
| 88 | int setDefaultCatalog(String platformId, String catalogId); | 89 | int setDefaultCatalog(String platformId, String catalogId); |
| 90 | + | ||
| 91 | + @Select("select 'channel' as name, count(pgc.platformId) count from platform_gb_channel pgc left join device_channel dc on dc.id = pgc.deviceChannelId where pgc.platformId=#{platformId} and dc.channelId =#{gbId} " + | ||
| 92 | + "union " + | ||
| 93 | + "select 'stream' as name, count(pgs.platformId) count from platform_gb_stream pgs left join gb_stream gs on pgs.gbStreamId = gs.gbStreamId where pgs.platformId=#{platformId} and gs.gbId = #{gbId}") | ||
| 94 | + List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); | ||
| 89 | } | 95 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java
| @@ -75,7 +75,7 @@ public interface PlatformChannelMapper { | @@ -75,7 +75,7 @@ public interface PlatformChannelMapper { | ||
| 75 | int delByCatalogId(String id); | 75 | int delByCatalogId(String id); |
| 76 | 76 | ||
| 77 | @Delete("<script> "+ | 77 | @Delete("<script> "+ |
| 78 | - "DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" + | 78 | + "DELETE FROM platform_gb_channel WHERE catalogId=#{parentId} AND platformId=#{platformId} AND channelId=#{id}" + |
| 79 | "</script>") | 79 | "</script>") |
| 80 | int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); | 80 | int delByCatalogIdAndChannelIdAndPlatformId(PlatformCatalog platformCatalog); |
| 81 | 81 |
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/ChannelSourceInfo.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.storager.dao.dto; | ||
| 2 | + | ||
| 3 | +public class ChannelSourceInfo { | ||
| 4 | + private String name; | ||
| 5 | + private int count; | ||
| 6 | + | ||
| 7 | + public String getName() { | ||
| 8 | + return name; | ||
| 9 | + } | ||
| 10 | + | ||
| 11 | + public void setName(String name) { | ||
| 12 | + this.name = name; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + public int getCount() { | ||
| 16 | + return count; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + public void setCount(int count) { | ||
| 20 | + this.count = count; | ||
| 21 | + } | ||
| 22 | +} |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| @@ -141,7 +141,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -141,7 +141,6 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 141 | 141 | ||
| 142 | @Override | 142 | @Override |
| 143 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { | 143 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { |
| 144 | -// List<Object> playLeys = redis.keys(String.format("%S_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | ||
| 145 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | 144 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
| 146 | userSetup.getServerId(), | 145 | userSetup.getServerId(), |
| 147 | deviceId, | 146 | deviceId, |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| @@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | @@ -14,6 +14,7 @@ import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | ||
| 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 15 | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; |
| 16 | import com.genersoft.iot.vmp.storager.dao.*; | 16 | import com.genersoft.iot.vmp.storager.dao.*; |
| 17 | +import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | ||
| 17 | import com.genersoft.iot.vmp.utils.node.ForestNodeMerger; | 18 | import com.genersoft.iot.vmp.utils.node.ForestNodeMerger; |
| 18 | import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; | 19 | import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; |
| 19 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 20 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| @@ -1104,4 +1105,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -1104,4 +1105,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 1104 | public PlatformCatalog queryDefaultCatalogInPlatform(String platformId) { | 1105 | public PlatformCatalog queryDefaultCatalogInPlatform(String platformId) { |
| 1105 | return catalogMapper.selectDefaultByPlatFormId(platformId); | 1106 | return catalogMapper.selectDefaultByPlatFormId(platformId); |
| 1106 | } | 1107 | } |
| 1108 | + | ||
| 1109 | + @Override | ||
| 1110 | + public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) { | ||
| 1111 | + return platformMapper.getChannelSource(platformId, gbId); | ||
| 1112 | + } | ||
| 1107 | } | 1113 | } |
src/main/java/com/genersoft/iot/vmp/utils/node/BaseNode.java
| 1 | package com.genersoft.iot.vmp.utils.node; | 1 | package com.genersoft.iot.vmp.utils.node; |
| 2 | 2 | ||
| 3 | import com.fasterxml.jackson.annotation.JsonInclude; | 3 | import com.fasterxml.jackson.annotation.JsonInclude; |
| 4 | -import lombok.Data; | ||
| 5 | 4 | ||
| 6 | import java.util.ArrayList; | 5 | import java.util.ArrayList; |
| 7 | import java.util.List; | 6 | import java.util.List; |
| @@ -10,7 +9,6 @@ import java.util.List; | @@ -10,7 +9,6 @@ import java.util.List; | ||
| 10 | * 节点基类 | 9 | * 节点基类 |
| 11 | * | 10 | * |
| 12 | */ | 11 | */ |
| 13 | -@Data | ||
| 14 | public class BaseNode<T> implements INode<T> { | 12 | public class BaseNode<T> implements INode<T> { |
| 15 | 13 | ||
| 16 | private static final long serialVersionUID = 1L; | 14 | private static final long serialVersionUID = 1L; |
| @@ -51,4 +49,34 @@ public class BaseNode<T> implements INode<T> { | @@ -51,4 +49,34 @@ public class BaseNode<T> implements INode<T> { | ||
| 51 | } | 49 | } |
| 52 | } | 50 | } |
| 53 | 51 | ||
| 52 | + @Override | ||
| 53 | + public int getId() { | ||
| 54 | + return id; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public void setId(int id) { | ||
| 58 | + this.id = id; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public String getParentId() { | ||
| 63 | + return parentId; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public void setParentId(String parentId) { | ||
| 67 | + this.parentId = parentId; | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @Override | ||
| 71 | + public List<T> getChildren() { | ||
| 72 | + return children; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public void setChildren(List<T> children) { | ||
| 76 | + this.children = children; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + public void setHasChildren(Boolean hasChildren) { | ||
| 80 | + this.hasChildren = hasChildren; | ||
| 81 | + } | ||
| 54 | } | 82 | } |
src/main/java/com/genersoft/iot/vmp/utils/node/ForestNode.java
| 1 | package com.genersoft.iot.vmp.utils.node; | 1 | package com.genersoft.iot.vmp.utils.node; |
| 2 | 2 | ||
| 3 | -import lombok.Data; | ||
| 4 | -import lombok.EqualsAndHashCode; | ||
| 5 | 3 | ||
| 6 | 4 | ||
| 7 | /** | 5 | /** |
| 8 | * 森林节点类 | 6 | * 森林节点类 |
| 9 | * | 7 | * |
| 10 | */ | 8 | */ |
| 11 | -@Data | ||
| 12 | -@EqualsAndHashCode(callSuper = false) | ||
| 13 | public class ForestNode extends BaseNode<ForestNode> { | 9 | public class ForestNode extends BaseNode<ForestNode> { |
| 14 | 10 | ||
| 15 | private static final long serialVersionUID = 1L; | 11 | private static final long serialVersionUID = 1L; |
| @@ -25,4 +21,11 @@ public class ForestNode extends BaseNode<ForestNode> { | @@ -25,4 +21,11 @@ public class ForestNode extends BaseNode<ForestNode> { | ||
| 25 | this.content = content; | 21 | this.content = content; |
| 26 | } | 22 | } |
| 27 | 23 | ||
| 24 | + public Object getContent() { | ||
| 25 | + return content; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + public void setContent(Object content) { | ||
| 29 | + this.content = content; | ||
| 30 | + } | ||
| 28 | } | 31 | } |
src/main/java/com/genersoft/iot/vmp/utils/node/TreeNode.java
| 1 | package com.genersoft.iot.vmp.utils.node; | 1 | package com.genersoft.iot.vmp.utils.node; |
| 2 | 2 | ||
| 3 | -import lombok.Data; | ||
| 4 | -import lombok.EqualsAndHashCode; | 3 | + |
| 5 | 4 | ||
| 6 | /** | 5 | /** |
| 7 | * 树型节点类 | 6 | * 树型节点类 |
| 8 | * | 7 | * |
| 9 | */ | 8 | */ |
| 10 | -@Data | ||
| 11 | -@EqualsAndHashCode(callSuper = false) | ||
| 12 | public class TreeNode extends BaseNode<TreeNode> { | 9 | public class TreeNode extends BaseNode<TreeNode> { |
| 13 | 10 | ||
| 14 | private static final long serialVersionUID = 1L; | 11 | private static final long serialVersionUID = 1L; |
| @@ -18,4 +15,28 @@ public class TreeNode extends BaseNode<TreeNode> { | @@ -18,4 +15,28 @@ public class TreeNode extends BaseNode<TreeNode> { | ||
| 18 | private String key; | 15 | private String key; |
| 19 | 16 | ||
| 20 | private String value; | 17 | private String value; |
| 18 | + | ||
| 19 | + public String getTitle() { | ||
| 20 | + return title; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + public void setTitle(String title) { | ||
| 24 | + this.title = title; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + public String getKey() { | ||
| 28 | + return key; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + public void setKey(String key) { | ||
| 32 | + this.key = key; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + public String getValue() { | ||
| 36 | + return value; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + public void setValue(String value) { | ||
| 40 | + this.value = value; | ||
| 41 | + } | ||
| 21 | } | 42 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeviceChannelTree.java
| @@ -4,14 +4,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; | @@ -4,14 +4,10 @@ import com.fasterxml.jackson.annotation.JsonInclude; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | import com.genersoft.iot.vmp.utils.node.INode; | 5 | import com.genersoft.iot.vmp.utils.node.INode; |
| 6 | import io.swagger.annotations.ApiModel; | 6 | import io.swagger.annotations.ApiModel; |
| 7 | -import lombok.Data; | ||
| 8 | -import lombok.EqualsAndHashCode; | ||
| 9 | 7 | ||
| 10 | import java.util.ArrayList; | 8 | import java.util.ArrayList; |
| 11 | import java.util.List; | 9 | import java.util.List; |
| 12 | 10 | ||
| 13 | -@Data | ||
| 14 | -@EqualsAndHashCode(callSuper = true) | ||
| 15 | @ApiModel(value = "DeviceChannelTree对象", description = "DeviceChannelTree对象") | 11 | @ApiModel(value = "DeviceChannelTree对象", description = "DeviceChannelTree对象") |
| 16 | public class DeviceChannelTree extends DeviceChannel implements INode<DeviceChannelTree> { | 12 | public class DeviceChannelTree extends DeviceChannel implements INode<DeviceChannelTree> { |
| 17 | private static final long serialVersionUID = 1L; | 13 | private static final long serialVersionUID = 1L; |
| @@ -62,4 +58,64 @@ public class DeviceChannelTree extends DeviceChannel implements INode<DeviceChan | @@ -62,4 +58,64 @@ public class DeviceChannelTree extends DeviceChannel implements INode<DeviceChan | ||
| 62 | return this.hasChildren; | 58 | return this.hasChildren; |
| 63 | } | 59 | } |
| 64 | } | 60 | } |
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public int getId() { | ||
| 64 | + return id; | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public void setId(int id) { | ||
| 69 | + this.id = id; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public String getParentId() { | ||
| 74 | + return parentId; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @Override | ||
| 78 | + public void setParentId(String parentId) { | ||
| 79 | + this.parentId = parentId; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + public String getParentName() { | ||
| 83 | + return parentName; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public void setParentName(String parentName) { | ||
| 87 | + this.parentName = parentName; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + public String getTitle() { | ||
| 91 | + return title; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + public void setTitle(String title) { | ||
| 95 | + this.title = title; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + public String getKey() { | ||
| 99 | + return key; | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + public void setKey(String key) { | ||
| 103 | + this.key = key; | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + public String getValue() { | ||
| 107 | + return value; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public void setValue(String value) { | ||
| 111 | + this.value = value; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + public void setChildren(List<DeviceChannelTree> children) { | ||
| 115 | + this.children = children; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + public void setHasChildren(Boolean hasChildren) { | ||
| 119 | + this.hasChildren = hasChildren; | ||
| 120 | + } | ||
| 65 | } | 121 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/DeviceChannelTreeNode.java
| 1 | package com.genersoft.iot.vmp.vmanager.bean; | 1 | package com.genersoft.iot.vmp.vmanager.bean; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.utils.node.TreeNode; | 3 | import com.genersoft.iot.vmp.utils.node.TreeNode; |
| 4 | -import lombok.Data; | ||
| 5 | -import lombok.EqualsAndHashCode; | ||
| 6 | 4 | ||
| 7 | -@Data | ||
| 8 | -@EqualsAndHashCode(callSuper = true) | ||
| 9 | public class DeviceChannelTreeNode extends TreeNode { | 5 | public class DeviceChannelTreeNode extends TreeNode { |
| 10 | 6 | ||
| 11 | private Integer status; | 7 | private Integer status; |
| @@ -17,4 +13,44 @@ public class DeviceChannelTreeNode extends TreeNode { | @@ -17,4 +13,44 @@ public class DeviceChannelTreeNode extends TreeNode { | ||
| 17 | private Double lng; | 13 | private Double lng; |
| 18 | 14 | ||
| 19 | private Double lat; | 15 | private Double lat; |
| 16 | + | ||
| 17 | + public Integer getStatus() { | ||
| 18 | + return status; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + public void setStatus(Integer status) { | ||
| 22 | + this.status = status; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + public String getDeviceId() { | ||
| 26 | + return deviceId; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + public void setDeviceId(String deviceId) { | ||
| 30 | + this.deviceId = deviceId; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + public String getChannelId() { | ||
| 34 | + return channelId; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + public void setChannelId(String channelId) { | ||
| 38 | + this.channelId = channelId; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public Double getLng() { | ||
| 42 | + return lng; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public void setLng(Double lng) { | ||
| 46 | + this.lng = lng; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public Double getLat() { | ||
| 50 | + return lat; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public void setLat(Double lat) { | ||
| 54 | + this.lat = lat; | ||
| 55 | + } | ||
| 20 | } | 56 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/bean/WVPResult.java
| 1 | package com.genersoft.iot.vmp.vmanager.bean; | 1 | package com.genersoft.iot.vmp.vmanager.bean; |
| 2 | 2 | ||
| 3 | -import lombok.AllArgsConstructor; | ||
| 4 | -import lombok.Data; | ||
| 5 | -import lombok.NoArgsConstructor; | ||
| 6 | 3 | ||
| 7 | -@Data | ||
| 8 | -@NoArgsConstructor | ||
| 9 | -@AllArgsConstructor | ||
| 10 | public class WVPResult<T> { | 4 | public class WVPResult<T> { |
| 11 | 5 | ||
| 6 | + public WVPResult() { | ||
| 7 | + } | ||
| 8 | + | ||
| 9 | + public WVPResult(int code, String msg, T data) { | ||
| 10 | + this.code = code; | ||
| 11 | + this.msg = msg; | ||
| 12 | + this.data = data; | ||
| 13 | + } | ||
| 14 | + | ||
| 12 | private int code; | 15 | private int code; |
| 13 | private String msg; | 16 | private String msg; |
| 14 | private T data; | 17 | private T data; |
| @@ -32,4 +35,27 @@ public class WVPResult<T> { | @@ -32,4 +35,27 @@ public class WVPResult<T> { | ||
| 32 | return fail(FAILED, msg); | 35 | return fail(FAILED, msg); |
| 33 | } | 36 | } |
| 34 | 37 | ||
| 38 | + public int getCode() { | ||
| 39 | + return code; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + public void setCode(int code) { | ||
| 43 | + this.code = code; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + public String getMsg() { | ||
| 47 | + return msg; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + public void setMsg(String msg) { | ||
| 51 | + this.msg = msg; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + public T getData() { | ||
| 55 | + return data; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + public void setData(T data) { | ||
| 59 | + this.data = data; | ||
| 60 | + } | ||
| 35 | } | 61 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
| @@ -137,6 +137,11 @@ public class PlatformController { | @@ -137,6 +137,11 @@ public class PlatformController { | ||
| 137 | wvpResult.setMsg("missing parameters"); | 137 | wvpResult.setMsg("missing parameters"); |
| 138 | return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); | 138 | return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); |
| 139 | } | 139 | } |
| 140 | + if (parentPlatform.getServerPort()< 0 || parentPlatform.getServerPort() > 65535){ | ||
| 141 | + wvpResult.setCode(-1); | ||
| 142 | + wvpResult.setMsg("error severPort"); | ||
| 143 | + return new ResponseEntity<>(wvpResult, HttpStatus.BAD_REQUEST); | ||
| 144 | + } | ||
| 140 | 145 | ||
| 141 | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); | 146 | ParentPlatform parentPlatformOld = storager.queryParentPlatByServerGBId(parentPlatform.getServerGBId()); |
| 142 | if (parentPlatformOld != null) { | 147 | if (parentPlatformOld != null) { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -129,7 +129,6 @@ public class PlayController { | @@ -129,7 +129,6 @@ public class PlayController { | ||
| 129 | //Response response = event.getResponse(); | 129 | //Response response = event.getResponse(); |
| 130 | msg.setData(String.format("success")); | 130 | msg.setData(String.format("success")); |
| 131 | resultHolder.invokeAllResult(msg); | 131 | resultHolder.invokeAllResult(msg); |
| 132 | - mediaServerService.closeRTPServer(device, channelId, streamInfo.getStream()); | ||
| 133 | }); | 132 | }); |
| 134 | 133 | ||
| 135 | if (deviceId != null || channelId != null) { | 134 | if (deviceId != null || channelId != null) { |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
| @@ -77,8 +77,8 @@ public class PlaybackController { | @@ -77,8 +77,8 @@ public class PlaybackController { | ||
| 77 | logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); | 77 | logger.debug(String.format("设备回放 API调用,deviceId:%s ,channelId:%s", deviceId, channelId)); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | - DeferredResult<ResponseEntity<String>> result = playService.playBack(deviceId, channelId, startTime, endTime, msg->{ | ||
| 81 | - resultHolder.invokeResult(msg); | 80 | + DeferredResult<ResponseEntity<String>> result = playService.playBack(deviceId, channelId, startTime, endTime, wvpResult->{ |
| 81 | + resultHolder.invokeResult(wvpResult.getData()); | ||
| 82 | }); | 82 | }); |
| 83 | 83 | ||
| 84 | return result; | 84 | return result; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java
| @@ -64,7 +64,7 @@ public class GBRecordController { | @@ -64,7 +64,7 @@ public class GBRecordController { | ||
| 64 | RequestMessage msg = new RequestMessage(); | 64 | RequestMessage msg = new RequestMessage(); |
| 65 | msg.setId(uuid); | 65 | msg.setId(uuid); |
| 66 | msg.setKey(key); | 66 | msg.setKey(key); |
| 67 | - cmder.recordInfoQuery(device, channelId, startTime, endTime, sn, (eventResult -> { | 67 | + cmder.recordInfoQuery(device, channelId, startTime, endTime, sn, null, null, null, (eventResult -> { |
| 68 | msg.setData("查询录像失败, status: " + eventResult.statusCode + ", message: " + eventResult.msg ); | 68 | msg.setData("查询录像失败, status: " + eventResult.statusCode + ", message: " + eventResult.msg ); |
| 69 | resultHolder.invokeResult(msg); | 69 | resultHolder.invokeResult(msg); |
| 70 | })); | 70 | })); |
src/main/resources/all-application.yml
src/test/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImplTest.java
| @@ -50,14 +50,7 @@ class DeviceAlarmServiceImplTest { | @@ -50,14 +50,7 @@ class DeviceAlarmServiceImplTest { | ||
| 50 | // System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null, | 50 | // System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, "1", null, |
| 51 | // null, null).getSize()); | 51 | // null, null).getSize()); |
| 52 | 52 | ||
| 53 | - System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, null, null, | ||
| 54 | - "2021-01-01 00:00:00", null).getSize()); | ||
| 55 | 53 | ||
| 56 | - System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, null, null, | ||
| 57 | - null, "2021-04-01 09:00:00").getSize()); | ||
| 58 | - | ||
| 59 | - System.out.println(deviceAlarmService.getAllAlarm(0, 10000, "11111111111111111111", null, null, null, | ||
| 60 | - "2021-02-01 01:00:00", "2021-04-01 04:00:00").getSize()); | ||
| 61 | } | 54 | } |
| 62 | 55 | ||
| 63 | 56 |
web_src/src/components/control.vue
| @@ -37,8 +37,20 @@ | @@ -37,8 +37,20 @@ | ||
| 37 | </el-popover> | 37 | </el-popover> |
| 38 | <el-popover placement="bottom" width="900" height="300" trigger="click"> | 38 | <el-popover placement="bottom" width="900" height="300" trigger="click"> |
| 39 | <div style="height: 600px;overflow:auto; padding: 20px"> | 39 | <div style="height: 600px;overflow:auto; padding: 20px"> |
| 40 | + <el-descriptions title="国标配置" border column="1"> | ||
| 41 | + <template slot="extra"> | ||
| 42 | + <el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerConfig.sip)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button> | ||
| 43 | + </template> | ||
| 44 | + <el-descriptions-item v-for="(value, key, index) in wvpServerConfig.sip"> | ||
| 45 | + <template slot="label"> | ||
| 46 | + {{ getNameFromKey(key) }} | ||
| 47 | + </template> | ||
| 48 | + {{ value }} | ||
| 49 | + </el-descriptions-item> | ||
| 50 | + </el-descriptions> | ||
| 40 | 51 | ||
| 41 | - <el-descriptions title="基础配置" border column="1"> | 52 | + <div style="margin-top: 1rem"> |
| 53 | + <el-descriptions title="基础配置" border column="1"> | ||
| 42 | <template slot="extra"> | 54 | <template slot="extra"> |
| 43 | <el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerConfig.base)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button> | 55 | <el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerConfig.base)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button> |
| 44 | </template> | 56 | </template> |
| @@ -70,18 +82,6 @@ | @@ -70,18 +82,6 @@ | ||
| 70 | 82 | ||
| 71 | </el-descriptions-item> | 83 | </el-descriptions-item> |
| 72 | </el-descriptions> | 84 | </el-descriptions> |
| 73 | - <div style="margin-top: 1rem"> | ||
| 74 | - <el-descriptions title="国标配置" border column="1"> | ||
| 75 | - <template slot="extra"> | ||
| 76 | - <el-button style="float: right;" type="primary" size="mini" icon="el-icon-document-copy" title="点击拷贝" v-clipboard="JSON.stringify(wvpServerConfig.sip)" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></el-button> | ||
| 77 | - </template> | ||
| 78 | - <el-descriptions-item v-for="(value, key, index) in wvpServerConfig.sip" :key="key"> | ||
| 79 | - <template slot="label"> | ||
| 80 | - {{ getNameFromKey(key) }} | ||
| 81 | - </template> | ||
| 82 | - {{ value }} | ||
| 83 | - </el-descriptions-item> | ||
| 84 | - </el-descriptions> | ||
| 85 | </div> | 85 | </div> |
| 86 | <div style="margin-top: 1rem"> | 86 | <div style="margin-top: 1rem"> |
| 87 | <el-descriptions title="版本信息" border column="1"> | 87 | <el-descriptions title="版本信息" border column="1"> |