Commit 5bf87ca330b446695de7e9d8149ec53e79a453c5
Committed by
GitHub
Merge pull request #1270 from hexq/playback
Playback
Showing
2 changed files
with
17 additions
and
8 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| ... | ... | @@ -30,8 +30,10 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 30 | 30 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 31 | 31 | import gov.nist.javax.sdp.TimeDescriptionImpl; |
| 32 | 32 | import gov.nist.javax.sdp.fields.TimeField; |
| 33 | +import gov.nist.javax.sdp.fields.URIField; | |
| 33 | 34 | import gov.nist.javax.sip.message.SIPRequest; |
| 34 | 35 | import gov.nist.javax.sip.message.SIPResponse; |
| 36 | +import org.apache.commons.lang3.StringUtils; | |
| 35 | 37 | import org.slf4j.Logger; |
| 36 | 38 | import org.slf4j.LoggerFactory; |
| 37 | 39 | import org.springframework.beans.factory.InitializingBean; |
| ... | ... | @@ -133,7 +135,20 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 133 | 135 | // Invite Request消息实现,此消息一般为级联消息,上级给下级发送请求视频指令 |
| 134 | 136 | try { |
| 135 | 137 | SIPRequest request = (SIPRequest)evt.getRequest(); |
| 136 | - String channelId = SipUtils.getChannelIdFromRequest(request); | |
| 138 | + String channelIdFromSub = SipUtils.getChannelIdFromRequest(request); | |
| 139 | + | |
| 140 | + // 解析sdp消息, 使用jainsip 自带的sdp解析方式 | |
| 141 | + String contentString = new String(request.getRawContent()); | |
| 142 | + Gb28181Sdp gb28181Sdp = SipUtils.parseSDP(contentString); | |
| 143 | + SessionDescription sdp = gb28181Sdp.getBaseSdb(); | |
| 144 | + String sessionName = sdp.getSessionName().getValue(); | |
| 145 | + String channelIdFromSdp = null; | |
| 146 | + if(StringUtils.equalsIgnoreCase("Playback", sessionName)){ | |
| 147 | + URIField uriField = (URIField)sdp.getURI(); | |
| 148 | + channelIdFromSdp = uriField.getURI().split(":")[0]; | |
| 149 | + } | |
| 150 | + final String channelId = StringUtils.isNotBlank(channelIdFromSdp) ? channelIdFromSdp : channelIdFromSub; | |
| 151 | + | |
| 137 | 152 | String requesterId = SipUtils.getUserIdFromFromHeader(request); |
| 138 | 153 | CallIdHeader callIdHeader = (CallIdHeader) request.getHeader(CallIdHeader.NAME); |
| 139 | 154 | if (requesterId == null || channelId == null) { |
| ... | ... | @@ -242,12 +257,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements |
| 242 | 257 | } |
| 243 | 258 | return; |
| 244 | 259 | } |
| 245 | - // 解析sdp消息, 使用jainsip 自带的sdp解析方式 | |
| 246 | - String contentString = new String(request.getRawContent()); | |
| 247 | - | |
| 248 | - Gb28181Sdp gb28181Sdp = SipUtils.parseSDP(contentString); | |
| 249 | - SessionDescription sdp = gb28181Sdp.getBaseSdb(); | |
| 250 | - String sessionName = sdp.getSessionName().getValue(); | |
| 251 | 260 | |
| 252 | 261 | Long startTime = null; |
| 253 | 262 | Long stopTime = null; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java
| ... | ... | @@ -136,7 +136,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService { |
| 136 | 136 | deviceChannelList.add(deviceChannel); |
| 137 | 137 | } |
| 138 | 138 | return deviceChannelList; |
| 139 | - } else if (catalog == null || !catalogId.equals(platform.getDeviceGBId())) { | |
| 139 | + } else if (catalog == null && !catalogId.equals(platform.getDeviceGBId())) { | |
| 140 | 140 | logger.warn("未查询到目录{}的信息", catalogId); |
| 141 | 141 | return null; |
| 142 | 142 | } | ... | ... |