Merge pull request #1270 from hexq/playback

Playback
结构优化
648540858 2024-03-05 10:41:22 +08:00 committed by GitHub
commit 5bf87ca330
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 8 deletions

View File

@ -30,8 +30,10 @@ import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
import com.genersoft.iot.vmp.utils.DateUtil;
import gov.nist.javax.sdp.TimeDescriptionImpl;
import gov.nist.javax.sdp.fields.TimeField;
import gov.nist.javax.sdp.fields.URIField;
import gov.nist.javax.sip.message.SIPRequest;
import gov.nist.javax.sip.message.SIPResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
@ -133,7 +135,20 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
// Invite Request消息实现此消息一般为级联消息上级给下级发送请求视频指令
try {
SIPRequest request = (SIPRequest)evt.getRequest();
String channelId = SipUtils.getChannelIdFromRequest(request);
String channelIdFromSub = SipUtils.getChannelIdFromRequest(request);
// 解析sdp消息, 使用jainsip 自带的sdp解析方式
String contentString = new String(request.getRawContent());
Gb28181Sdp gb28181Sdp = SipUtils.parseSDP(contentString);
SessionDescription sdp = gb28181Sdp.getBaseSdb();
String sessionName = sdp.getSessionName().getValue();
String channelIdFromSdp = null;
if(StringUtils.equalsIgnoreCase("Playback", sessionName)){
URIField uriField = (URIField)sdp.getURI();
channelIdFromSdp = uriField.getURI().split(":")[0];
}
final String channelId = StringUtils.isNotBlank(channelIdFromSdp) ? channelIdFromSdp : channelIdFromSub;
String requesterId = SipUtils.getUserIdFromFromHeader(request);
CallIdHeader callIdHeader = (CallIdHeader) request.getHeader(CallIdHeader.NAME);
if (requesterId == null || channelId == null) {
@ -242,12 +257,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements
}
return;
}
// 解析sdp消息, 使用jainsip 自带的sdp解析方式
String contentString = new String(request.getRawContent());
Gb28181Sdp gb28181Sdp = SipUtils.parseSDP(contentString);
SessionDescription sdp = gb28181Sdp.getBaseSdb();
String sessionName = sdp.getSessionName().getValue();
Long startTime = null;
Long stopTime = null;

View File

@ -136,7 +136,7 @@ public class PlatformChannelServiceImpl implements IPlatformChannelService {
deviceChannelList.add(deviceChannel);
}
return deviceChannelList;
} else if (catalog == null || !catalogId.equals(platform.getDeviceGBId())) {
} else if (catalog == null && !catalogId.equals(platform.getDeviceGBId())) {
logger.warn("未查询到目录{}的信息", catalogId);
return null;
}