优化多网卡
parent
1ab73f69eb
commit
aed45e0f0d
|
@ -2,6 +2,8 @@ package com.genersoft.iot.vmp.common;
|
|||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@Schema(description = "流信息")
|
||||
public class StreamInfo {
|
||||
|
||||
|
@ -13,54 +15,56 @@ public class StreamInfo {
|
|||
private String deviceID;
|
||||
@Schema(description = "通道编号")
|
||||
private String channelId;
|
||||
@Schema(description = "HTTP-FLV流地址")
|
||||
private String flv;
|
||||
|
||||
@Schema(description = "IP")
|
||||
private String ip;
|
||||
|
||||
@Schema(description = "HTTP-FLV流地址")
|
||||
private StreamURL flv;
|
||||
|
||||
@Schema(description = "HTTPS-FLV流地址")
|
||||
private String https_flv;
|
||||
private StreamURL https_flv;
|
||||
@Schema(description = "Websocket-FLV流地址")
|
||||
private String ws_flv;
|
||||
private StreamURL ws_flv;
|
||||
@Schema(description = "Websockets-FLV流地址")
|
||||
private String wss_flv;
|
||||
private StreamURL wss_flv;
|
||||
@Schema(description = "HTTP-FMP4流地址")
|
||||
private String fmp4;
|
||||
private StreamURL fmp4;
|
||||
@Schema(description = "HTTPS-FMP4流地址")
|
||||
private String https_fmp4;
|
||||
private StreamURL https_fmp4;
|
||||
@Schema(description = "Websocket-FMP4流地址")
|
||||
private String ws_fmp4;
|
||||
private StreamURL ws_fmp4;
|
||||
@Schema(description = "Websockets-FMP4流地址")
|
||||
private String wss_fmp4;
|
||||
private StreamURL wss_fmp4;
|
||||
@Schema(description = "HLS流地址")
|
||||
private String hls;
|
||||
private StreamURL hls;
|
||||
@Schema(description = "HTTPS-HLS流地址")
|
||||
private String https_hls;
|
||||
private StreamURL https_hls;
|
||||
@Schema(description = "Websocket-HLS流地址")
|
||||
private String ws_hls;
|
||||
private StreamURL ws_hls;
|
||||
@Schema(description = "Websockets-HLS流地址")
|
||||
private String wss_hls;
|
||||
private StreamURL wss_hls;
|
||||
@Schema(description = "HTTP-TS流地址")
|
||||
private String ts;
|
||||
private StreamURL ts;
|
||||
@Schema(description = "HTTPS-TS流地址")
|
||||
private String https_ts;
|
||||
private StreamURL https_ts;
|
||||
@Schema(description = "Websocket-TS流地址")
|
||||
private String ws_ts;
|
||||
private StreamURL ws_ts;
|
||||
@Schema(description = "Websockets-TS流地址")
|
||||
private String wss_ts;
|
||||
private StreamURL wss_ts;
|
||||
@Schema(description = "RTMP流地址")
|
||||
private String rtmp;
|
||||
private StreamURL rtmp;
|
||||
@Schema(description = "RTMPS流地址")
|
||||
private String rtmps;
|
||||
private StreamURL rtmps;
|
||||
@Schema(description = "RTSP流地址")
|
||||
private String rtsp;
|
||||
private StreamURL rtsp;
|
||||
@Schema(description = "RTSPS流地址")
|
||||
private String rtsps;
|
||||
private StreamURL rtsps;
|
||||
@Schema(description = "RTC流地址")
|
||||
private String rtc;
|
||||
private StreamURL rtc;
|
||||
|
||||
@Schema(description = "RTCS流地址")
|
||||
private String rtcs;
|
||||
private StreamURL rtcs;
|
||||
@Schema(description = "流媒体ID")
|
||||
private String mediaServerId;
|
||||
@Schema(description = "流编码信息")
|
||||
|
@ -75,6 +79,102 @@ public class StreamInfo {
|
|||
@Schema(description = "是否暂停(录像回放使用)")
|
||||
private boolean pause;
|
||||
|
||||
public void setRtmp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||
String file = String.format("%s/%s/%s", app, stream, callIdParam);
|
||||
this.rtmp = new StreamURL("rtmp", host, port, file);
|
||||
if (sslPort != 0) {
|
||||
this.rtmps = new StreamURL("rtmps", host, sslPort, file);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRtsp(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||
String file = String.format("%s/%s/%s", app, stream, callIdParam);
|
||||
this.rtsp = new StreamURL("rtsp", host, port, file);
|
||||
if (sslPort != 0) {
|
||||
this.rtsps = new StreamURL("rtsps", host, sslPort, file);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFlv(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||
String file = String.format("%s/%s.live.flv%s", app, stream, callIdParam);
|
||||
this.flv = new StreamURL("http", host, port, file);
|
||||
this.ws_flv = new StreamURL("ws", host, port, file);
|
||||
if (sslPort != 0) {
|
||||
this.https_flv = new StreamURL("https", host, sslPort, file);
|
||||
this.wss_flv = new StreamURL("wss", host, sslPort, file);
|
||||
}
|
||||
}
|
||||
|
||||
public void setFmp4(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||
String file = String.format("%s/%s.live.mp4%s", app, stream, callIdParam);
|
||||
this.fmp4 = new StreamURL("http", host, port, file);
|
||||
this.ws_fmp4 = new StreamURL("ws", host, port, file);
|
||||
if (sslPort != 0) {
|
||||
this.https_fmp4 = new StreamURL("https", host, sslPort, file);
|
||||
this.wss_fmp4 = new StreamURL("wss", host, sslPort, file);
|
||||
}
|
||||
}
|
||||
|
||||
public void setHls(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||
String file = String.format("%s/%s/hls.m3u8%s", app, stream, callIdParam);
|
||||
this.hls = new StreamURL("http", host, port, file);
|
||||
this.ws_hls = new StreamURL("ws", host, port, file);
|
||||
if (sslPort != 0) {
|
||||
this.https_hls = new StreamURL("https", host, sslPort, file);
|
||||
this.wss_hls = new StreamURL("wss", host, sslPort, file);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTs(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||
String file = String.format("%s/%s.live.ts%s", app, stream, callIdParam);
|
||||
this.ts = new StreamURL("http", host, port, file);
|
||||
this.ws_ts = new StreamURL("ws", host, port, file);
|
||||
if (sslPort != 0) {
|
||||
this.https_ts = new StreamURL("https", host, sslPort, file);
|
||||
this.wss_ts = new StreamURL("wss", host, sslPort, file);
|
||||
}
|
||||
}
|
||||
|
||||
public void setRtc(String host, int port, int sslPort, String app, String stream, String callIdParam) {
|
||||
String file = String.format("index/api/webrtc?app=%s&stream=%s&type=play%s", app, stream, callIdParam);
|
||||
this.rtc = new StreamURL("http", host, port, file);
|
||||
if (sslPort != 0) {
|
||||
this.rtcs = new StreamURL("https", host, sslPort, file);
|
||||
}
|
||||
}
|
||||
|
||||
public void channgeStreamIp(String localAddr) {
|
||||
this.flv.setHost(localAddr);
|
||||
this.ws_flv.setHost(localAddr);
|
||||
this.hls.setHost(localAddr);
|
||||
this.ws_hls.setHost(localAddr);
|
||||
this.ts.setHost(localAddr);
|
||||
this.ws_ts.setHost(localAddr);
|
||||
this.fmp4.setHost(localAddr);
|
||||
this.ws_fmp4.setHost(localAddr);
|
||||
this.rtc.setHost(localAddr);
|
||||
if (this.https_flv != null) {
|
||||
this.https_flv.setHost(localAddr);
|
||||
this.wss_flv.setHost(localAddr);
|
||||
this.https_hls.setHost(localAddr);
|
||||
this.wss_hls.setHost(localAddr);
|
||||
this.wss_ts.setHost(localAddr);
|
||||
this.https_fmp4.setHost(localAddr);
|
||||
this.wss_fmp4.setHost(localAddr);
|
||||
this.rtcs.setHost(localAddr);
|
||||
}
|
||||
this.rtsp.setHost(localAddr);
|
||||
if (this.rtsps != null) {
|
||||
this.rtsps.setHost(localAddr);
|
||||
}
|
||||
this.rtmp.setHost(localAddr);
|
||||
if (this.rtmps != null) {
|
||||
this.rtmps.setHost(localAddr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class TransactionInfo{
|
||||
public String callId;
|
||||
public String localTag;
|
||||
|
@ -108,94 +208,6 @@ public class StreamInfo {
|
|||
this.channelId = channelId;
|
||||
}
|
||||
|
||||
public String getFlv() {
|
||||
return flv;
|
||||
}
|
||||
|
||||
public void setFlv(String flv) {
|
||||
this.flv = flv;
|
||||
}
|
||||
|
||||
public String getWs_flv() {
|
||||
return ws_flv;
|
||||
}
|
||||
|
||||
public void setWs_flv(String ws_flv) {
|
||||
this.ws_flv = ws_flv;
|
||||
}
|
||||
|
||||
public String getRtmp() {
|
||||
return rtmp;
|
||||
}
|
||||
|
||||
public void setRtmp(String rtmp) {
|
||||
this.rtmp = rtmp;
|
||||
}
|
||||
|
||||
public String getHls() {
|
||||
return hls;
|
||||
}
|
||||
|
||||
public void setHls(String hls) {
|
||||
this.hls = hls;
|
||||
}
|
||||
|
||||
public String getRtsp() {
|
||||
return rtsp;
|
||||
}
|
||||
|
||||
public void setRtsp(String rtsp) {
|
||||
this.rtsp = rtsp;
|
||||
}
|
||||
|
||||
public Object getTracks() {
|
||||
return tracks;
|
||||
}
|
||||
|
||||
public void setTracks(Object tracks) {
|
||||
this.tracks = tracks;
|
||||
}
|
||||
|
||||
public String getFmp4() {
|
||||
return fmp4;
|
||||
}
|
||||
|
||||
public void setFmp4(String fmp4) {
|
||||
this.fmp4 = fmp4;
|
||||
}
|
||||
|
||||
public String getWs_fmp4() {
|
||||
return ws_fmp4;
|
||||
}
|
||||
|
||||
public void setWs_fmp4(String ws_fmp4) {
|
||||
this.ws_fmp4 = ws_fmp4;
|
||||
}
|
||||
|
||||
public String getWs_hls() {
|
||||
return ws_hls;
|
||||
}
|
||||
|
||||
public void setWs_hls(String ws_hls) {
|
||||
this.ws_hls = ws_hls;
|
||||
}
|
||||
|
||||
public String getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
public void setTs(String ts) {
|
||||
this.ts = ts;
|
||||
}
|
||||
|
||||
public String getWs_ts() {
|
||||
return ws_ts;
|
||||
}
|
||||
|
||||
public void setWs_ts(String ws_ts) {
|
||||
this.ws_ts = ws_ts;
|
||||
}
|
||||
|
||||
public String getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
@ -204,20 +216,108 @@ public class StreamInfo {
|
|||
this.stream = stream;
|
||||
}
|
||||
|
||||
public String getRtc() {
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public StreamURL getFlv() {
|
||||
return flv;
|
||||
}
|
||||
|
||||
public StreamURL getHttps_flv() {
|
||||
return https_flv;
|
||||
}
|
||||
|
||||
public StreamURL getWs_flv() {
|
||||
return ws_flv;
|
||||
}
|
||||
|
||||
|
||||
public StreamURL getWss_flv() {
|
||||
return wss_flv;
|
||||
}
|
||||
|
||||
public StreamURL getFmp4() {
|
||||
return fmp4;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public StreamURL getHttps_fmp4() {
|
||||
return https_fmp4;
|
||||
}
|
||||
|
||||
public StreamURL getWs_fmp4() {
|
||||
return ws_fmp4;
|
||||
}
|
||||
|
||||
public StreamURL getWss_fmp4() {
|
||||
return wss_fmp4;
|
||||
}
|
||||
|
||||
public StreamURL getHls() {
|
||||
return hls;
|
||||
}
|
||||
|
||||
|
||||
public StreamURL getHttps_hls() {
|
||||
return https_hls;
|
||||
}
|
||||
|
||||
public StreamURL getWs_hls() {
|
||||
return ws_hls;
|
||||
}
|
||||
|
||||
public StreamURL getWss_hls() {
|
||||
return wss_hls;
|
||||
}
|
||||
|
||||
public StreamURL getTs() {
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
||||
public StreamURL getHttps_ts() {
|
||||
return https_ts;
|
||||
}
|
||||
|
||||
|
||||
public StreamURL getWs_ts() {
|
||||
return ws_ts;
|
||||
}
|
||||
|
||||
|
||||
public StreamURL getWss_ts() {
|
||||
return wss_ts;
|
||||
}
|
||||
|
||||
|
||||
public StreamURL getRtmp() {
|
||||
return rtmp;
|
||||
}
|
||||
|
||||
public StreamURL getRtmps() {
|
||||
return rtmps;
|
||||
}
|
||||
|
||||
public StreamURL getRtsp() {
|
||||
return rtsp;
|
||||
}
|
||||
|
||||
public StreamURL getRtsps() {
|
||||
return rtsps;
|
||||
}
|
||||
|
||||
public StreamURL getRtc() {
|
||||
return rtc;
|
||||
}
|
||||
|
||||
public void setRtc(String rtc) {
|
||||
this.rtc = rtc;
|
||||
}
|
||||
|
||||
public TransactionInfo getTransactionInfo() {
|
||||
return transactionInfo;
|
||||
}
|
||||
|
||||
public void setTransactionInfo(TransactionInfo transactionInfo) {
|
||||
this.transactionInfo = transactionInfo;
|
||||
public StreamURL getRtcs() {
|
||||
return rtcs;
|
||||
}
|
||||
|
||||
public String getMediaServerId() {
|
||||
|
@ -228,87 +328,14 @@ public class StreamInfo {
|
|||
this.mediaServerId = mediaServerId;
|
||||
}
|
||||
|
||||
public String getHttps_flv() {
|
||||
return https_flv;
|
||||
public Object getTracks() {
|
||||
return tracks;
|
||||
}
|
||||
|
||||
public void setHttps_flv(String https_flv) {
|
||||
this.https_flv = https_flv;
|
||||
public void setTracks(Object tracks) {
|
||||
this.tracks = tracks;
|
||||
}
|
||||
|
||||
public String getWss_flv() {
|
||||
return wss_flv;
|
||||
}
|
||||
|
||||
public void setWss_flv(String wss_flv) {
|
||||
this.wss_flv = wss_flv;
|
||||
}
|
||||
|
||||
public String getWss_fmp4() {
|
||||
return wss_fmp4;
|
||||
}
|
||||
|
||||
public void setWss_fmp4(String wss_fmp4) {
|
||||
this.wss_fmp4 = wss_fmp4;
|
||||
}
|
||||
|
||||
public String getWss_hls() {
|
||||
return wss_hls;
|
||||
}
|
||||
|
||||
public void setWss_hls(String wss_hls) {
|
||||
this.wss_hls = wss_hls;
|
||||
}
|
||||
|
||||
public String getWss_ts() {
|
||||
return wss_ts;
|
||||
}
|
||||
|
||||
public void setWss_ts(String wss_ts) {
|
||||
this.wss_ts = wss_ts;
|
||||
}
|
||||
|
||||
public String getRtmps() {
|
||||
return rtmps;
|
||||
}
|
||||
|
||||
public void setRtmps(String rtmps) {
|
||||
this.rtmps = rtmps;
|
||||
}
|
||||
|
||||
public String getRtsps() {
|
||||
return rtsps;
|
||||
}
|
||||
|
||||
public void setRtsps(String rtsps) {
|
||||
this.rtsps = rtsps;
|
||||
}
|
||||
|
||||
public String getHttps_hls() {
|
||||
return https_hls;
|
||||
}
|
||||
|
||||
public void setHttps_hls(String https_hls) {
|
||||
this.https_hls = https_hls;
|
||||
}
|
||||
|
||||
public String getHttps_fmp4() {
|
||||
return https_fmp4;
|
||||
}
|
||||
|
||||
public void setHttps_fmp4(String https_fmp4) {
|
||||
this.https_fmp4 = https_fmp4;
|
||||
}
|
||||
|
||||
public String getHttps_ts() {
|
||||
return https_ts;
|
||||
}
|
||||
|
||||
public void setHttps_ts(String https_ts) {
|
||||
this.https_ts = https_ts;
|
||||
}
|
||||
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
@ -333,22 +360,6 @@ public class StreamInfo {
|
|||
this.progress = progress;
|
||||
}
|
||||
|
||||
public String getIp() {
|
||||
return ip;
|
||||
}
|
||||
|
||||
public void setIp(String ip) {
|
||||
this.ip = ip;
|
||||
}
|
||||
|
||||
public String getRtcs() {
|
||||
return rtcs;
|
||||
}
|
||||
|
||||
public void setRtcs(String rtcs) {
|
||||
this.rtcs = rtcs;
|
||||
}
|
||||
|
||||
public boolean isPause() {
|
||||
return pause;
|
||||
}
|
||||
|
@ -356,4 +367,12 @@ public class StreamInfo {
|
|||
public void setPause(boolean pause) {
|
||||
this.pause = pause;
|
||||
}
|
||||
|
||||
public TransactionInfo getTransactionInfo() {
|
||||
return transactionInfo;
|
||||
}
|
||||
|
||||
public void setTransactionInfo(TransactionInfo transactionInfo) {
|
||||
this.transactionInfo = transactionInfo;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,78 @@
|
|||
package com.genersoft.iot.vmp.common;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
|
||||
@Schema(description = "流地址信息")
|
||||
public class StreamURL {
|
||||
|
||||
@Schema(description = "协议")
|
||||
private String protocol;
|
||||
|
||||
@Schema(description = "主机地址")
|
||||
private String host;
|
||||
|
||||
@Schema(description = "端口")
|
||||
private int port = -1;
|
||||
|
||||
@Schema(description = "定位位置")
|
||||
private String file;
|
||||
|
||||
@Schema(description = "拼接后的地址")
|
||||
private String url;
|
||||
|
||||
public StreamURL() {
|
||||
}
|
||||
|
||||
public StreamURL(String protocol, String host, int port, String file) {
|
||||
this.protocol = protocol;
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public String getProtocol() {
|
||||
return protocol;
|
||||
}
|
||||
|
||||
public void setProtocol(String protocol) {
|
||||
this.protocol = protocol;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (protocol != null && host != null && port != -1 ) {
|
||||
return String.format("%s://%s:%s/%s", protocol, host, port, file);
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,7 +27,7 @@ public class MediaConfig{
|
|||
@Value("${media.ip}")
|
||||
private String ip;
|
||||
|
||||
@Value("${media.hook-ip:${sip.ip}}")
|
||||
@Value("${media.hook-ip:}")
|
||||
private String hookIp;
|
||||
|
||||
@Value("${sip.ip}")
|
||||
|
@ -92,7 +92,7 @@ public class MediaConfig{
|
|||
|
||||
public String getHookIp() {
|
||||
if (ObjectUtils.isEmpty(hookIp)){
|
||||
return sipIp;
|
||||
return sipIp.split(",")[0];
|
||||
}else {
|
||||
return hookIp;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ public class UserSetting {
|
|||
|
||||
private Boolean usePushingAsStatus = Boolean.TRUE;
|
||||
|
||||
private Boolean useSourceIpAsStreamIp = Boolean.FALSE;
|
||||
|
||||
private Boolean streamOnDemand = Boolean.TRUE;
|
||||
|
||||
private String serverId = "000000";
|
||||
|
@ -156,4 +158,12 @@ public class UserSetting {
|
|||
public void setStreamOnDemand(Boolean streamOnDemand) {
|
||||
this.streamOnDemand = streamOnDemand;
|
||||
}
|
||||
|
||||
public Boolean getUseSourceIpAsStreamIp() {
|
||||
return useSourceIpAsStreamIp;
|
||||
}
|
||||
|
||||
public void setUseSourceIpAsStreamIp(Boolean useSourceIpAsStreamIp) {
|
||||
this.useSourceIpAsStreamIp = useSourceIpAsStreamIp;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,23 +45,23 @@ public class SIPRequestHeaderPlarformProvider {
|
|||
@Autowired
|
||||
private IRedisCatchStorage redisCatchStorage;
|
||||
|
||||
public Request createRegisterRequest(@NotNull ParentPlatform platform, long CSeq, String fromTag, String viaTag, CallIdHeader callIdHeader, boolean isRegister) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
||||
public Request createRegisterRequest(@NotNull ParentPlatform parentPlatform, long CSeq, String fromTag, String viaTag, CallIdHeader callIdHeader, boolean isRegister) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
||||
Request request = null;
|
||||
String sipAddress = sipConfig.getIp() + ":" + sipConfig.getPort();
|
||||
String sipAddress = parentPlatform.getDeviceIp() + ":" + parentPlatform.getDevicePort();
|
||||
//请求行
|
||||
SipURI requestLine = sipLayer.getSipFactory().createAddressFactory().createSipURI(platform.getServerGBId(),
|
||||
platform.getServerIP() + ":" + platform.getServerPort());
|
||||
SipURI requestLine = sipLayer.getSipFactory().createAddressFactory().createSipURI(parentPlatform.getServerGBId(),
|
||||
parentPlatform.getServerIP() + ":" + parentPlatform.getServerPort());
|
||||
//via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(platform.getServerIP(), platform.getServerPort(), platform.getTransport(), viaTag);
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(parentPlatform.getServerIP(), parentPlatform.getServerPort(), parentPlatform.getTransport(), viaTag);
|
||||
viaHeader.setRPort();
|
||||
viaHeaders.add(viaHeader);
|
||||
//from
|
||||
SipURI fromSipURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(platform.getDeviceGBId(), sipConfig.getDomain());
|
||||
SipURI fromSipURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(), sipConfig.getDomain());
|
||||
Address fromAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(fromSipURI);
|
||||
FromHeader fromHeader = sipLayer.getSipFactory().createHeaderFactory().createFromHeader(fromAddress, fromTag);
|
||||
//to
|
||||
SipURI toSipURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(platform.getDeviceGBId(), sipConfig.getDomain());
|
||||
SipURI toSipURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(parentPlatform.getDeviceGBId(), sipConfig.getDomain());
|
||||
Address toAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(toSipURI);
|
||||
ToHeader toHeader = sipLayer.getSipFactory().createHeaderFactory().createToHeader(toAddress,null);
|
||||
|
||||
|
@ -74,10 +74,10 @@ public class SIPRequestHeaderPlarformProvider {
|
|||
cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
|
||||
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory()
|
||||
.createSipURI(platform.getDeviceGBId(), sipAddress));
|
||||
.createSipURI(parentPlatform.getDeviceGBId(), sipAddress));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
ExpiresHeader expires = sipLayer.getSipFactory().createHeaderFactory().createExpiresHeader(isRegister ? platform.getExpires() : 0);
|
||||
ExpiresHeader expires = sipLayer.getSipFactory().createHeaderFactory().createExpiresHeader(isRegister ? parentPlatform.getExpires() : 0);
|
||||
request.addHeader(expires);
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
@ -251,7 +251,7 @@ public class SIPRequestHeaderPlarformProvider {
|
|||
SubscriptionStateHeader active = sipLayer.getSipFactory().createHeaderFactory().createSubscriptionStateHeader("active");
|
||||
request.setHeader(active);
|
||||
|
||||
String sipAddress = sipConfig.getIp() + ":" + sipConfig.getPort();
|
||||
String sipAddress = parentPlatform.getDeviceIp() + ":" + parentPlatform.getDevicePort();
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory()
|
||||
.createSipURI(parentPlatform.getDeviceGBId(), sipAddress));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
@ -301,7 +301,7 @@ public class SIPRequestHeaderPlarformProvider {
|
|||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
||||
String sipAddress = sipConfig.getIp() + ":" + sipConfig.getPort();
|
||||
String sipAddress = platform.getDeviceIp() + ":" + platform.getDevicePort();
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory()
|
||||
.createSipURI(platform.getDeviceGBId(), sipAddress));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
|
|
@ -52,7 +52,7 @@ public class SIPRequestHeaderProvider {
|
|||
SipURI requestURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(device.getDeviceId(), device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(sipConfig.getIp(), sipConfig.getPort(), device.getTransport(), viaTag);
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(device.getLocalIp(), sipConfig.getPort(), device.getTransport(), viaTag);
|
||||
viaHeader.setRPort();
|
||||
viaHeaders.add(viaHeader);
|
||||
// from
|
||||
|
@ -85,7 +85,7 @@ public class SIPRequestHeaderProvider {
|
|||
SipURI requestLine = sipLayer.getSipFactory().createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
//via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(sipConfig.getIp(), sipConfig.getPort(), device.getTransport(), viaTag);
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(device.getLocalIp(), sipConfig.getPort(), device.getTransport(), viaTag);
|
||||
viaHeader.setRPort();
|
||||
viaHeaders.add(viaHeader);
|
||||
|
||||
|
@ -107,7 +107,7 @@ public class SIPRequestHeaderProvider {
|
|||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), device.getLocalIp()+":"+sipConfig.getPort()));
|
||||
// Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
// Subject
|
||||
|
@ -124,7 +124,7 @@ public class SIPRequestHeaderProvider {
|
|||
SipURI requestLine = sipLayer.getSipFactory().createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(sipConfig.getIp(), sipConfig.getPort(), device.getTransport(), viaTag);
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(device.getLocalIp(), sipConfig.getPort(), device.getTransport(), viaTag);
|
||||
viaHeader.setRPort();
|
||||
viaHeaders.add(viaHeader);
|
||||
//from
|
||||
|
@ -143,7 +143,7 @@ public class SIPRequestHeaderProvider {
|
|||
CSeqHeader cSeqHeader = sipLayer.getSipFactory().createHeaderFactory().createCSeqHeader(redisCatchStorage.getCSEQ(), Request.INVITE);
|
||||
request = sipLayer.getSipFactory().createMessageFactory().createRequest(requestLine, Request.INVITE, callIdHeader, cSeqHeader,fromHeader, toHeader, viaHeaders, maxForwards);
|
||||
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), device.getLocalIp()+":"+sipConfig.getPort()));
|
||||
// Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), device.getHost().getIp()+":"+device.getHost().getPort()));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
|
@ -164,7 +164,7 @@ public class SIPRequestHeaderProvider {
|
|||
SipURI requestLine = sipLayer.getSipFactory().createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(sipConfig.getIp(), sipConfig.getPort(), device.getTransport(), SipUtils.getNewViaTag());
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(device.getLocalIp(), sipConfig.getPort(), device.getTransport(), SipUtils.getNewViaTag());
|
||||
viaHeaders.add(viaHeader);
|
||||
//from
|
||||
SipURI fromSipURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(),sipConfig.getDomain());
|
||||
|
@ -185,7 +185,7 @@ public class SIPRequestHeaderProvider {
|
|||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), device.getLocalIp()+":"+sipConfig.getPort()));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
@ -199,7 +199,7 @@ public class SIPRequestHeaderProvider {
|
|||
SipURI requestURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(device.getDeviceId(), device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(sipConfig.getIp(), sipConfig.getPort(),
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(device.getLocalIp(), sipConfig.getPort(),
|
||||
device.getTransport(), SipUtils.getNewViaTag());
|
||||
viaHeader.setRPort();
|
||||
viaHeaders.add(viaHeader);
|
||||
|
@ -222,7 +222,7 @@ public class SIPRequestHeaderProvider {
|
|||
toHeader, viaHeaders, maxForwards);
|
||||
|
||||
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), device.getLocalIp()+":"+sipConfig.getPort()));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
// Expires
|
||||
|
@ -254,7 +254,7 @@ public class SIPRequestHeaderProvider {
|
|||
SipURI requestLine = sipLayer.getSipFactory().createAddressFactory().createSipURI(channelId, device.getHostAddress());
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(sipConfig.getIp(), sipConfig.getPort(), device.getTransport(), SipUtils.getNewViaTag());
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(device.getLocalIp(), sipConfig.getPort(), device.getTransport(), SipUtils.getNewViaTag());
|
||||
viaHeaders.add(viaHeader);
|
||||
//from
|
||||
SipURI fromSipURI = sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(),sipConfig.getDomain());
|
||||
|
@ -275,7 +275,7 @@ public class SIPRequestHeaderProvider {
|
|||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), device.getLocalIp()+":"+sipConfig.getPort()));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
@ -288,11 +288,12 @@ public class SIPRequestHeaderProvider {
|
|||
return request;
|
||||
}
|
||||
|
||||
public Request createAckRequest(SipURI sipURI, SIPResponse sipResponse) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
||||
public Request createAckRequest(String localIp, SipURI sipURI, SIPResponse sipResponse) throws ParseException, InvalidArgumentException, PeerUnavailableException {
|
||||
|
||||
|
||||
// via
|
||||
ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(sipConfig.getIp(), sipConfig.getPort(), sipResponse.getTopmostViaHeader().getTransport(), SipUtils.getNewViaTag());
|
||||
ViaHeader viaHeader = sipLayer.getSipFactory().createHeaderFactory().createViaHeader(localIp, sipConfig.getPort(), sipResponse.getTopmostViaHeader().getTransport(), SipUtils.getNewViaTag());
|
||||
viaHeaders.add(viaHeader);
|
||||
|
||||
//Forwards
|
||||
|
@ -305,7 +306,7 @@ public class SIPRequestHeaderProvider {
|
|||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), sipConfig.getIp()+":"+sipConfig.getPort()));
|
||||
Address concatAddress = sipLayer.getSipFactory().createAddressFactory().createAddress(sipLayer.getSipFactory().createAddressFactory().createSipURI(sipConfig.getId(), localIp + ":"+sipConfig.getPort()));
|
||||
request.addHeader(sipLayer.getSipFactory().createHeaderFactory().createContactHeader(concatAddress));
|
||||
|
||||
request.addHeader(SipUtils.createUserAgentHeader(sipLayer.getSipFactory(), gitUtil));
|
||||
|
|
|
@ -9,8 +9,6 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP
|
|||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler;
|
||||
import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.control.ControlMessageHandler;
|
||||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import com.genersoft.iot.vmp.utils.SpringBeanFactory;
|
||||
import gov.nist.javax.sip.SipStackImpl;
|
||||
import gov.nist.javax.sip.message.SIPRequest;
|
||||
import org.dom4j.Element;
|
||||
import org.slf4j.Logger;
|
||||
|
|
|
@ -104,11 +104,12 @@ public class InviteResponseProcessor extends SIPResponseProcessorAbstract {
|
|||
} else {
|
||||
sdp = SdpFactory.getInstance().createSessionDescription(contentString);
|
||||
}
|
||||
|
||||
SipURI requestUri = sipLayer.getSipFactory().createAddressFactory().createSipURI(sdp.getOrigin().getUsername(), event.getRemoteIpAddress() + ":" + event.getRemotePort());
|
||||
Request reqAck = headerProvider.createAckRequest(requestUri, response);
|
||||
Request reqAck = headerProvider.createAckRequest(response.getLocalAddress().getHostAddress(), requestUri, response);
|
||||
|
||||
logger.info("[回复ack] {}-> {}:{} ", sdp.getOrigin().getUsername(), event.getRemoteIpAddress(), event.getRemotePort());
|
||||
sipSender.transmitRequest(response.getLocalAddress().getHostAddress(), reqAck);
|
||||
sipSender.transmitRequest( response.getLocalAddress().getHostAddress(), reqAck);
|
||||
}
|
||||
} catch (InvalidArgumentException | ParseException | SipException | SdpParseException e) {
|
||||
logger.info("[点播回复ACK],异常:", e );
|
||||
|
|
|
@ -608,7 +608,7 @@ public class MediaServerServiceImpl implements IMediaServerService {
|
|||
mediaServerItem.setRtspSSLPort(zlmServerConfig.getRtspSSlport());
|
||||
mediaServerItem.setRtpProxyPort(zlmServerConfig.getRtpProxyPort());
|
||||
mediaServerItem.setStreamIp(ip);
|
||||
mediaServerItem.setHookIp(sipConfig.getIp());
|
||||
mediaServerItem.setHookIp(sipConfig.getIp().split(",")[0]);
|
||||
mediaServerItem.setSdpIp(ip);
|
||||
return mediaServerItem;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.StreamURL;
|
||||
import com.genersoft.iot.vmp.conf.MediaConfig;
|
||||
import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem;
|
||||
|
@ -18,6 +19,8 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
@Service
|
||||
public class MediaServiceImpl implements IMediaService {
|
||||
|
||||
|
@ -93,38 +96,17 @@ public class MediaServiceImpl implements IMediaService {
|
|||
if (addr == null) {
|
||||
addr = mediaInfo.getStreamIp();
|
||||
}
|
||||
|
||||
streamInfoResult.setIp(addr);
|
||||
streamInfoResult.setMediaServerId(mediaInfo.getId());
|
||||
String callIdParam = ObjectUtils.isEmpty(callId)?"":"?callId=" + callId;
|
||||
streamInfoResult.setRtmp(String.format("rtmp://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpPort(), app, stream, callIdParam));
|
||||
if (mediaInfo.getRtmpSSlPort() != 0) {
|
||||
streamInfoResult.setRtmps(String.format("rtmps://%s:%s/%s/%s%s", addr, mediaInfo.getRtmpSSlPort(), app, stream, callIdParam));
|
||||
}
|
||||
streamInfoResult.setRtsp(String.format("rtsp://%s:%s/%s/%s%s", addr, mediaInfo.getRtspPort(), app, stream, callIdParam));
|
||||
if (mediaInfo.getRtspSSLPort() != 0) {
|
||||
streamInfoResult.setRtsps(String.format("rtsps://%s:%s/%s/%s%s", addr, mediaInfo.getRtspSSLPort(), app, stream, callIdParam));
|
||||
}
|
||||
streamInfoResult.setFlv(String.format("http://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWs_flv(String.format("ws://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setHls(String.format("http://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWs_hls(String.format("ws://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setFmp4(String.format("http://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWs_fmp4(String.format("ws://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setTs(String.format("http://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWs_ts(String.format("ws://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setRtc(String.format("http://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play%s", mediaInfo.getStreamIp(), mediaInfo.getHttpPort(), app, stream, ObjectUtils.isEmpty(callId)?"":"&callId=" + callId));
|
||||
if (mediaInfo.getHttpSSlPort() != 0) {
|
||||
streamInfoResult.setHttps_flv(String.format("https://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWss_flv(String.format("wss://%s:%s/%s/%s.live.flv%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setHttps_hls(String.format("https://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWss_hls(String.format("wss://%s:%s/%s/%s/hls.m3u8%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setHttps_fmp4(String.format("https://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWss_fmp4(String.format("wss://%s:%s/%s/%s.live.mp4%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setHttps_ts(String.format("https://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setWss_ts(String.format("wss://%s:%s/%s/%s.live.ts%s", addr, mediaInfo.getHttpSSlPort(), app, stream, callIdParam));
|
||||
streamInfoResult.setRtcs(String.format("https://%s:%s/index/api/webrtc?app=%s&stream=%s&type=play%s", mediaInfo.getStreamIp(), mediaInfo.getHttpSSlPort(), app, stream, ObjectUtils.isEmpty(callId)?"":"&callId=" + callId));
|
||||
}
|
||||
streamInfoResult.setRtmp(addr, mediaInfo.getRtmpPort(),mediaInfo.getRtmpSSlPort(), app, stream, callIdParam);
|
||||
streamInfoResult.setRtsp(addr, mediaInfo.getRtspPort(),mediaInfo.getRtspSSLPort(), app, stream, callIdParam);
|
||||
streamInfoResult.setFlv(addr, mediaInfo.getHttpPort(),mediaInfo.getHttpSSlPort(), app, stream, callIdParam);
|
||||
streamInfoResult.setFmp4(addr, mediaInfo.getHttpPort(),mediaInfo.getHttpSSlPort(), app, stream, callIdParam);
|
||||
streamInfoResult.setHls(addr, mediaInfo.getHttpPort(),mediaInfo.getHttpSSlPort(), app, stream, callIdParam);
|
||||
streamInfoResult.setTs(addr, mediaInfo.getHttpPort(),mediaInfo.getHttpSSlPort(), app, stream, callIdParam);
|
||||
streamInfoResult.setRtc(addr, mediaInfo.getHttpPort(),mediaInfo.getHttpSSlPort(), app, stream, callIdParam);
|
||||
|
||||
streamInfoResult.setTracks(tracks);
|
||||
return streamInfoResult;
|
||||
|
|
|
@ -143,7 +143,7 @@ public class PlayServiceImpl implements IPlayService {
|
|||
if (Objects.requireNonNull(wvpResult).getCode() == 0) {
|
||||
StreamInfo streamInfoForSuccess = (StreamInfo) wvpResult.getData();
|
||||
MediaServerItem mediaInfo = mediaServerService.getOne(streamInfoForSuccess.getMediaServerId());
|
||||
String streamUrl = streamInfoForSuccess.getFmp4();
|
||||
String streamUrl = streamInfoForSuccess.getFmp4().getUrl();
|
||||
|
||||
// 请求截图
|
||||
logger.info("[请求截图]: " + fileName);
|
||||
|
|
|
@ -415,47 +415,6 @@ public class StreamProxyServiceImpl implements IStreamProxyService {
|
|||
return streamProxyMapper.updateStatus(app, stream, status);
|
||||
}
|
||||
|
||||
private void syncPullStream(String mediaServerId){
|
||||
MediaServerItem mediaServer = mediaServerService.getOne(mediaServerId);
|
||||
if (mediaServer != null) {
|
||||
List<MediaItem> allPullStream = redisCatchStorage.getStreams(mediaServerId, "PULL");
|
||||
if (allPullStream.size() > 0) {
|
||||
zlmresTfulUtils.getMediaList(mediaServer, jsonObject->{
|
||||
Map<String, StreamInfo> stringStreamInfoMap = new HashMap<>();
|
||||
if (jsonObject.getInteger("code") == 0) {
|
||||
JSONArray data = jsonObject.getJSONArray("data");
|
||||
if(data != null && data.size() > 0) {
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
JSONObject streamJSONObj = data.getJSONObject(i);
|
||||
if ("rtsp".equals(streamJSONObj.getString("schema"))) {
|
||||
StreamInfo streamInfo = new StreamInfo();
|
||||
String app = streamJSONObj.getString("app");
|
||||
String stream = streamJSONObj.getString("stream");
|
||||
streamInfo.setApp(app);
|
||||
streamInfo.setStream(stream);
|
||||
stringStreamInfoMap.put(app+stream, streamInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (stringStreamInfoMap.size() == 0) {
|
||||
redisCatchStorage.removeStream(mediaServerId, "PULL");
|
||||
}else {
|
||||
for (String key : stringStreamInfoMap.keySet()) {
|
||||
StreamInfo streamInfo = stringStreamInfoMap.get(key);
|
||||
if (stringStreamInfoMap.get(streamInfo.getApp() + streamInfo.getStream()) == null) {
|
||||
redisCatchStorage.removeStream(mediaServerId, "PULL", streamInfo.getApp(),
|
||||
streamInfo.getStream());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceBaceInfo getOverview() {
|
||||
return streamProxyMapper.getOverview();
|
||||
|
|
|
@ -63,4 +63,5 @@ public class WVPResult<T> {
|
|||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.genersoft.iot.vmp.vmanager.gb28181.play;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.UserSetting;
|
||||
import com.genersoft.iot.vmp.conf.exception.ControllerException;
|
||||
import com.genersoft.iot.vmp.conf.exception.SsrcTransactionNotFoundException;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction;
|
||||
|
@ -37,6 +38,8 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
|
|||
import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
||||
import org.springframework.web.context.request.async.DeferredResult;
|
||||
|
||||
import javax.servlet.http.HttpServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.sip.InvalidArgumentException;
|
||||
import javax.sip.SipException;
|
||||
import java.text.ParseException;
|
||||
|
@ -78,18 +81,25 @@ public class PlayController {
|
|||
@Autowired
|
||||
private IMediaServerService mediaServerService;
|
||||
|
||||
@Autowired
|
||||
private UserSetting userSetting;
|
||||
|
||||
@Operation(summary = "开始点播")
|
||||
@Parameter(name = "deviceId", description = "设备国标编号", required = true)
|
||||
@Parameter(name = "channelId", description = "通道国标编号", required = true)
|
||||
@GetMapping("/start/{deviceId}/{channelId}")
|
||||
public DeferredResult<WVPResult<StreamInfo>> play(@PathVariable String deviceId,
|
||||
@PathVariable String channelId) {
|
||||
public DeferredResult<WVPResult<StreamInfo>> play(HttpServletRequest request, @PathVariable String deviceId,
|
||||
@PathVariable String channelId) {
|
||||
|
||||
// 获取可用的zlm
|
||||
Device device = storager.queryVideoDevice(deviceId);
|
||||
MediaServerItem newMediaServerItem = playService.getNewMediaServerItem(device);
|
||||
PlayResult playResult = playService.play(newMediaServerItem, deviceId, channelId, null, null, null);
|
||||
|
||||
playResult.getResult().onCompletion(()->{
|
||||
WVPResult<StreamInfo> result = (WVPResult<StreamInfo>)playResult.getResult().getResult();
|
||||
result.getData().channgeStreamIp(request.getLocalAddr());
|
||||
playResult.getResult().setResult(result);
|
||||
});
|
||||
return playResult.getResult();
|
||||
}
|
||||
|
||||
|
|
|
@ -188,6 +188,8 @@ user-settings:
|
|||
logInDatebase: true
|
||||
# 使用推流状态作为推流通道状态
|
||||
use-pushing-as-status: true
|
||||
# 使用来源请求ip作为streamIp
|
||||
use-source-ip-as-stream-ip: true
|
||||
# 按需拉流, true:有人观看拉流,无人观看释放, false:拉起后不自动释放
|
||||
stream-on-demand: true
|
||||
|
||||
|
|
|
@ -53,89 +53,89 @@
|
|||
更多地址<i class="el-icon-arrow-down el-icon--right"></i>
|
||||
</el-button>
|
||||
<el-dropdown-menu slot="dropdown" >
|
||||
<el-dropdown-item :command="streamInfo.flv">
|
||||
<el-dropdown-item :command="streamInfo.flv.url">
|
||||
<el-tag >FLV:</el-tag>
|
||||
<span>{{ streamInfo.flv }}</span>
|
||||
<span>{{ streamInfo.flv.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.https_flv">
|
||||
<el-dropdown-item :command="streamInfo.https_flv.url">
|
||||
<el-tag >FLV(https):</el-tag>
|
||||
<span>{{ streamInfo.https_flv }}</span>
|
||||
<span>{{ streamInfo.https_flv.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.ws_flv">
|
||||
<el-dropdown-item :command="streamInfo.ws_flv.url">
|
||||
<el-tag >FLV(ws):</el-tag>
|
||||
<span >{{ streamInfo.ws_flv }}</span>
|
||||
<span >{{ streamInfo.ws_flv.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.wss_flv">
|
||||
<el-dropdown-item :command="streamInfo.wss_flv.url">
|
||||
<el-tag >FLV(wss):</el-tag>
|
||||
<span>{{ streamInfo.wss_flv }}</span>
|
||||
<span>{{ streamInfo.wss_flv.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.fmp4">
|
||||
<el-dropdown-item :command="streamInfo.fmp4.url">
|
||||
<el-tag >FMP4:</el-tag>
|
||||
<span>{{ streamInfo.fmp4 }}</span>
|
||||
<span>{{ streamInfo.fmp4.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.https_fmp4">
|
||||
<el-dropdown-item :command="streamInfo.https_fmp4.url">
|
||||
<el-tag >FMP4(https):</el-tag>
|
||||
<span>{{ streamInfo.https_fmp4 }}</span>
|
||||
<span>{{ streamInfo.https_fmp4.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.ws_fmp4">
|
||||
<el-dropdown-item :command="streamInfo.ws_fmp4.url">
|
||||
<el-tag >FMP4(ws):</el-tag>
|
||||
<span>{{ streamInfo.ws_fmp4 }}</span>
|
||||
<span>{{ streamInfo.ws_fmp4.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.wss_fmp4">
|
||||
<el-dropdown-item :command="streamInfo.wss_fmp4.url">
|
||||
<el-tag >FMP4(wss):</el-tag>
|
||||
<span>{{ streamInfo.wss_fmp4 }}</span>
|
||||
<span>{{ streamInfo.wss_fmp4.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.hls">
|
||||
<el-dropdown-item :command="streamInfo.hls.url">
|
||||
<el-tag>HLS:</el-tag>
|
||||
<span>{{ streamInfo.hls }}</span>
|
||||
<span>{{ streamInfo.hls.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.https_hls">
|
||||
<el-dropdown-item :command="streamInfo.https_hls.url">
|
||||
<el-tag >HLS(https):</el-tag>
|
||||
<span>{{ streamInfo.https_hls }}</span>
|
||||
<span>{{ streamInfo.https_hls.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.ws_hls">
|
||||
<el-dropdown-item :command="streamInfo.ws_hls.url">
|
||||
<el-tag >HLS(ws):</el-tag>
|
||||
<span>{{ streamInfo.ws_hls }}</span>
|
||||
<span>{{ streamInfo.ws_hls.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.wss_hls">
|
||||
<el-dropdown-item :command="streamInfo.wss_hls.url">
|
||||
<el-tag >HLS(wss):</el-tag>
|
||||
<span>{{ streamInfo.wss_hls }}</span>
|
||||
<span>{{ streamInfo.wss_hls.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.ts">
|
||||
<el-dropdown-item :command="streamInfo.ts.url">
|
||||
<el-tag>TS:</el-tag>
|
||||
<span>{{ streamInfo.ts }}</span>
|
||||
<span>{{ streamInfo.ts.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.https_ts">
|
||||
<el-dropdown-item :command="streamInfo.https_ts.url">
|
||||
<el-tag>TS(https):</el-tag>
|
||||
<span>{{ streamInfo.https_ts }}</span>
|
||||
<span>{{ streamInfo.https_ts.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.ws_ts">
|
||||
<el-dropdown-item :command="streamInfo.ws_ts.url">
|
||||
<el-tag>TS(ws):</el-tag>
|
||||
<span>{{ streamInfo.ws_ts }}</span>
|
||||
<span>{{ streamInfo.ws_ts.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.wss_ts">
|
||||
<el-dropdown-item :command="streamInfo.wss_ts.url">
|
||||
<el-tag>TS(wss):</el-tag>
|
||||
<span>{{ streamInfo.wss_ts }}</span>
|
||||
<span>{{ streamInfo.wss_ts.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.rtc">
|
||||
<el-dropdown-item :command="streamInfo.rtc.url">
|
||||
<el-tag >RTC:</el-tag>
|
||||
<span>{{ streamInfo.rtc }}</span>
|
||||
<span>{{ streamInfo.rtc.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.rtmp">
|
||||
<el-dropdown-item :command="streamInfo.rtmp.url">
|
||||
<el-tag >RTMP:</el-tag>
|
||||
<span>{{ streamInfo.rtmp }}</span>
|
||||
<span>{{ streamInfo.rtmp.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.rtmps">
|
||||
<el-dropdown-item :command="streamInfo.rtmps.url">
|
||||
<el-tag >RTMPS:</el-tag>
|
||||
<span>{{ streamInfo.rtmps }}</span>
|
||||
<span>{{ streamInfo.rtmps.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.rtsp">
|
||||
<el-dropdown-item :command="streamInfo.rtsp.url">
|
||||
<el-tag >RTSP:</el-tag>
|
||||
<span>{{ streamInfo.rtsp }}</span>
|
||||
<span>{{ streamInfo.rtsp.url }}</span>
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="streamInfo.rtsps">
|
||||
<el-dropdown-item :command="streamInfo.rtsps.url">
|
||||
<el-tag >RTSPS:</el-tag>
|
||||
<span>{{ streamInfo.rtsps }}</span>
|
||||
<span>{{ streamInfo.rtsps.url }}</span>
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
|
@ -393,7 +393,7 @@ export default {
|
|||
changePlayer: function (tab) {
|
||||
console.log(this.player[tab.name][0])
|
||||
this.activePlayer = tab.name;
|
||||
this.videoUrl = this.streamInfo[this.player[tab.name][0]]
|
||||
this.videoUrl = this.streamInfo[this.player[tab.name][0]].url
|
||||
console.log(this.videoUrl)
|
||||
},
|
||||
openDialog: function (tab, deviceId, channelId, param) {
|
||||
|
@ -446,9 +446,9 @@ export default {
|
|||
getUrlByStreamInfo(){
|
||||
console.log(this.streamInfo)
|
||||
if (location.protocol === "https:") {
|
||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]]
|
||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][1]].url
|
||||
}else {
|
||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][0]]
|
||||
this.videoUrl = this.streamInfo[this.player[this.activePlayer][0]].url
|
||||
}
|
||||
return this.videoUrl;
|
||||
|
||||
|
|
|
@ -138,8 +138,8 @@ export default {
|
|||
url: '/api/play/start/' + deviceId + '/' + channelId
|
||||
}).then(function (res) {
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
itemData.playUrl = res.data.data.httpsFlv
|
||||
that.setPlayUrl(res.data.data.ws_flv, idxTmp)
|
||||
itemData.playUrl = res.data.data.https_flv.url
|
||||
that.setPlayUrl(res.data.data.ws_flv.url, idxTmp)
|
||||
} else {
|
||||
that.$message.error(res.data.msg);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue