sip 下载信令 构造 (未完)

待实现 notify=MediaStatus, BYE 事件
This commit is contained in:
shikong 2023-09-21 02:54:52 +08:00
parent a3a23db8df
commit a5ef517477

View File

@ -30,6 +30,7 @@ import cn.skcks.docking.gb28181.wvp.sip.subscribe.SipSubscribe;
import gov.nist.javax.sdp.MediaDescriptionImpl; import gov.nist.javax.sdp.MediaDescriptionImpl;
import gov.nist.javax.sdp.fields.AttributeField; import gov.nist.javax.sdp.fields.AttributeField;
import gov.nist.javax.sdp.fields.TimeField; import gov.nist.javax.sdp.fields.TimeField;
import gov.nist.javax.sdp.fields.URIField;
import gov.nist.javax.sip.message.SIPResponse; import gov.nist.javax.sip.message.SIPResponse;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows; import lombok.SneakyThrows;
@ -133,11 +134,14 @@ public class Gb28181DownloadService {
timeField.setStartTime(start); timeField.setStartTime(start);
timeField.setStopTime(end); timeField.setStopTime(end);
TimeDescription timeDescription = SdpFactory.getInstance().createTimeDescription(timeField); TimeDescription timeDescription = SdpFactory.getInstance().createTimeDescription(timeField);
GB28181Description gb28181Description = MediaSdpHelper.playback(gbDeviceId, channel, Connection.IP4, ip, port, ssrc, StreamMode.of(ListeningPoint.UDP), startTime, endTime); GB28181Description gb28181Description = MediaSdpHelper.build(MediaSdpHelper.Action.DOWNLOAD, gbDeviceId, channel, Connection.IP4, ip, port, ssrc, StreamMode.of(ListeningPoint.UDP), timeDescription);
gb28181Description.setSessionName(SdpFactory.getInstance().createSessionName(MediaSdpHelper.Action.DOWNLOAD.getAction())); gb28181Description.setSessionName(SdpFactory.getInstance().createSessionName(MediaSdpHelper.Action.DOWNLOAD.getAction()));
gb28181Description.setTimeDescriptions(new Vector<>(){{add(timeDescription);}}); gb28181Description.setTimeDescriptions(new Vector<>(){{add(timeDescription);}});
MediaDescriptionImpl media = (MediaDescriptionImpl) gb28181Description.getMediaDescriptions(true).get(0); MediaDescriptionImpl media = (MediaDescriptionImpl) gb28181Description.getMediaDescriptions(true).get(0);
media.setAttribute("downloadspeed", String.valueOf(4)); media.setAttribute("downloadspeed", String.valueOf(4));
URIField uriField = new URIField();
uriField.setURI(StringUtils.joinWith(":", channel, "0"));
gb28181Description.setURI(uriField);
sender.sendRequest(inviteRequest(docking, device, gb28181Description, MediaSdpHelper.Action.DOWNLOAD, ssrc, streamId, result, time)); sender.sendRequest(inviteRequest(docking, device, gb28181Description, MediaSdpHelper.Action.DOWNLOAD, ssrc, streamId, result, time));
return result; return result;
} }