diff --git a/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java b/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java index c6b50b02..8ab34bf4 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/MediaConfig.java @@ -21,25 +21,25 @@ public class MediaConfig { private String streamIp; @Value("${media.httpPort}") - private String httpPort; + private Integer httpPort; @Value("${media.httpSSlPort:}") - private String httpSSlPort; + private Integer httpSSlPort; @Value("${media.rtmpPort:}") - private String rtmpPort; + private Integer rtmpPort; @Value("${media.rtmpSSlPort:}") - private String rtmpSSlPort; + private Integer rtmpSSlPort; @Value("${media.rtpProxyPort:}") - private String rtpProxyPort; + private Integer rtpProxyPort; @Value("${media.rtspPort:}") - private String rtspPort; + private Integer rtspPort; @Value("${media.rtspSSLPort:}") - private String rtspSSLPort; + private Integer rtspSSLPort; @Value("${media.autoConfig:true}") private boolean autoConfig; @@ -57,73 +57,141 @@ public class MediaConfig { private String rtpPortRange; @Value("${media.recordAssistPort}") - private int recordAssistPort; + private Integer recordAssistPort; public String getIp() { return ip; } + public void setIp(String ip) { + this.ip = ip; + } + public String getHookIp() { return hookIp; } + public void setHookIp(String hookIp) { + this.hookIp = hookIp; + } + public String getSdpIp() { return sdpIp; } + public void setSdpIp(String sdpIp) { + this.sdpIp = sdpIp; + } + public String getStreamIp() { return streamIp; } - public String getHttpPort() { + public void setStreamIp(String streamIp) { + this.streamIp = streamIp; + } + + public Integer getHttpPort() { return httpPort; } - public String getHttpSSlPort() { + public void setHttpPort(Integer httpPort) { + this.httpPort = httpPort; + } + + public Integer getHttpSSlPort() { return httpSSlPort; } - public String getRtmpPort() { + public void setHttpSSlPort(Integer httpSSlPort) { + this.httpSSlPort = httpSSlPort; + } + + public Integer getRtmpPort() { return rtmpPort; } - public String getRtmpSSlPort() { + public void setRtmpPort(Integer rtmpPort) { + this.rtmpPort = rtmpPort; + } + + public Integer getRtmpSSlPort() { return rtmpSSlPort; } - public String getRtpProxyPort() { + public void setRtmpSSlPort(Integer rtmpSSlPort) { + this.rtmpSSlPort = rtmpSSlPort; + } + + public Integer getRtpProxyPort() { return rtpProxyPort; } - public String getRtspPort() { + public void setRtpProxyPort(Integer rtpProxyPort) { + this.rtpProxyPort = rtpProxyPort; + } + + public Integer getRtspPort() { return rtspPort; } - public String getRtspSSLPort() { + public void setRtspPort(Integer rtspPort) { + this.rtspPort = rtspPort; + } + + public Integer getRtspSSLPort() { return rtspSSLPort; } + public void setRtspSSLPort(Integer rtspSSLPort) { + this.rtspSSLPort = rtspSSLPort; + } + public boolean isAutoConfig() { return autoConfig; } + public void setAutoConfig(boolean autoConfig) { + this.autoConfig = autoConfig; + } + public String getSecret() { return secret; } + public void setSecret(String secret) { + this.secret = secret; + } + public String getStreamNoneReaderDelayMS() { return streamNoneReaderDelayMS; } + public void setStreamNoneReaderDelayMS(String streamNoneReaderDelayMS) { + this.streamNoneReaderDelayMS = streamNoneReaderDelayMS; + } + public boolean isRtpEnable() { return rtpEnable; } + public void setRtpEnable(boolean rtpEnable) { + this.rtpEnable = rtpEnable; + } + public String getRtpPortRange() { return rtpPortRange; } - public int getRecordAssistPort() { + public void setRtpPortRange(String rtpPortRange) { + this.rtpPortRange = rtpPortRange; + } + + public Integer getRecordAssistPort() { return recordAssistPort; } + + public void setRecordAssistPort(Integer recordAssistPort) { + this.recordAssistPort = recordAssistPort; + } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java b/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java index f61b019b..e6d8d54a 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/auth/DigestServerAuthenticationHelper.java @@ -109,13 +109,10 @@ public class DigestServerAuthenticationHelper { WWWAuthenticateHeader proxyAuthenticate = headerFactory .createWWWAuthenticateHeader(DEFAULT_SCHEME); proxyAuthenticate.setParameter("realm", realm); + proxyAuthenticate.setParameter("qop", "auth"); proxyAuthenticate.setParameter("nonce", generateNonce()); - - proxyAuthenticate.setParameter("opaque", ""); - proxyAuthenticate.setParameter("stale", "FALSE"); proxyAuthenticate.setParameter("algorithm", DEFAULT_ALGORITHM); -// proxyAuthenticate.setParameter("qop", "auth"); response.setHeader(proxyAuthenticate); } catch (Exception ex) { InternalErrorHandler.handleException(ex); @@ -243,26 +240,26 @@ public class DigestServerAuthenticationHelper { } public static void main(String[] args) throws NoSuchAlgorithmException { - String realm = "4401000000"; - String username = "44010000001110008008"; + String realm = "3402000000"; + String username = "44010000001180008012"; - String nonce = "0074b397f86fc263b1b7f9eb72553267"; - String uri = "sip:44010000002000000001@4401000000"; + String nonce = "07cab60999fbf643264ace27d3b7de8b"; + String uri = "sip:34020000002000000001@3402000000"; // qop 保护质量 包含auth(默认的)和auth-int(增加了报文完整性检测)两种策略 - String qop = null; + String qop = "auth"; // 客户端随机数,这是一个不透明的字符串值,由客户端提供,并且客户端和服务器都会使用,以避免用明文文本。 // 这使得双方都可以查验对方的身份,并对消息的完整性提供一些保护 //String cNonce = authHeader.getCNonce(); // nonce计数器,是一个16进制的数值,表示同一nonce下客户端发送出请求的数量 - int nc = -1; + int nc = 1; String ncStr = new DecimalFormat("00000000").format(nc); // String ncStr = new DecimalFormat("00000000").format(Integer.parseInt(nc + "", 16)); MessageDigest messageDigest = MessageDigest.getInstance(DEFAULT_ALGORITHM); - String A1 = username + ":" + realm + ":" + "crservice@123"; - String A2 = "REGISTER" + ":" + uri.toString(); + String A1 = username + ":" + realm + ":" + "12345678"; + String A2 = "REGISTER" + ":" + uri; byte mdbytes[] = messageDigest.digest(A1.getBytes()); String HA1 = toHexString(mdbytes); System.out.println("A1: " + A1); @@ -272,7 +269,7 @@ public class DigestServerAuthenticationHelper { String HA2 = toHexString(mdbytes); System.out.println("HA1: " + HA1); System.out.println("HA2: " + HA2); - String cnonce = null; + String cnonce = "0a4f113b"; System.out.println("nonce: " + nonce); System.out.println("nc: " + ncStr); System.out.println("cnonce: " + cnonce); @@ -293,7 +290,7 @@ public class DigestServerAuthenticationHelper { mdbytes = messageDigest.digest(KD.getBytes()); String mdString = toHexString(mdbytes); System.out.println("mdString: " + mdString); - String response = "fdb1608a7a3b96f0598f40b8ba78d6a9"; + String response = "4f0507d4b87cdecff04bdaf4c96348f0"; System.out.println("response: " + response); } } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java index bb9a9f0b..2c9339cc 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java @@ -356,10 +356,10 @@ public class SIPCommander implements ISIPCommander { logger.warn("点播时发现ZLM尚未连接..."); return; } - String mediaPort = null; + Integer mediaPort = null; // 使用动态udp端口 if (mediaConfig.isRtpEnable()) { - mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + ""; + mediaPort = zlmrtpServerFactory.createRTPServer(streamId); }else { mediaPort = mediaInfo.getRtpProxyPort(); } @@ -485,10 +485,10 @@ public class SIPCommander implements ISIPCommander { content.append("c=IN IP4 "+mediaInfo.getSdpIp()+"\r\n"); content.append("t="+DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime)+" " +DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) +"\r\n"); - String mediaPort = null; + Integer mediaPort = null; // 使用动态udp端口 if (mediaConfig.isRtpEnable()) { - mediaPort = zlmrtpServerFactory.createRTPServer(streamId) + ""; + mediaPort = zlmrtpServerFactory.createRTPServer(streamId); }else { mediaPort = mediaInfo.getRtpProxyPort(); } diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java index 7602c064..5f356b0d 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/InviteRequestProcessor.java @@ -336,11 +336,6 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor { String username = sdp.getOrigin().getUsername(); String addressStr = sdp.getOrigin().getAddress(); logger.info("设备{}请求语音流,地址:{}:{},ssrc:{}", username, addressStr, port, ssrc); - - - - - } else { logger.warn("来自无效设备/平台的请求"); diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java index 32cb49b4..5196f4c3 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMServerConfig.java @@ -43,6 +43,8 @@ public class ZLMServerConfig { private String updateTime; + private String createTime; + @JSONField(name = "hls.fileBufSize") private String hlsFileBufSize; @@ -65,7 +67,7 @@ public class ZLMServerConfig { private String hookEnable; @JSONField(name = "hook.on_flow_report") - private String hookOnFlowReport; + private Integer hookOnFlowReport; @JSONField(name = "hook.on_http_access") private String hookOnHttpAccess; @@ -116,7 +118,7 @@ public class ZLMServerConfig { private String httpNotFound; @JSONField(name = "http.port") - private String httpPort; + private Integer httpPort; @JSONField(name = "http.rootPath") private String httpRootPath; @@ -125,7 +127,7 @@ public class ZLMServerConfig { private String httpSendBufSize; @JSONField(name = "http.sslport") - private String httpSSLport; + private Integer httpSSLport; @JSONField(name = "multicast.addrMax") private String multicastAddrMax; @@ -158,10 +160,10 @@ public class ZLMServerConfig { private String rtmpModifyStamp; @JSONField(name = "rtmp.port") - private String rtmpPort; + private Integer rtmpPort; @JSONField(name = "rtmp.sslport") - private String rtmpSslPort; + private Integer rtmpSslPort; @JSONField(name = "rtp.audioMtuSize") private String rtpAudioMtuSize; @@ -185,7 +187,7 @@ public class ZLMServerConfig { private String rtpProxyDumpDir; @JSONField(name = "rtp_proxy.port") - private String rtpProxyPort; + private Integer rtpProxyPort; @JSONField(name = "rtp_proxy.timeoutSec") private String rtpProxyTimeoutSec; @@ -200,10 +202,10 @@ public class ZLMServerConfig { private String rtspKeepAliveSecond; @JSONField(name = "rtsp.port") - private String rtspPort; + private Integer rtspPort; @JSONField(name = "rtsp.sslport") - private String rtspSSlport; + private Integer rtspSSlport; @JSONField(name = "shell.maxReqSize") private String shellMaxReqSize; @@ -211,7 +213,6 @@ public class ZLMServerConfig { @JSONField(name = "shell.shell") private String shellPhell; - public String getApiDebug() { return apiDebug; } @@ -260,6 +261,14 @@ public class ZLMServerConfig { this.generalEnableVhost = generalEnableVhost; } + public String getGeneralMediaServerId() { + return generalMediaServerId; + } + + public void setGeneralMediaServerId(String generalMediaServerId) { + this.generalMediaServerId = generalMediaServerId; + } + public String getGeneralFlowThreshold() { return generalFlowThreshold; } @@ -292,6 +301,38 @@ public class ZLMServerConfig { this.ip = ip; } + public String getSdpIp() { + return sdpIp; + } + + public void setSdpIp(String sdpIp) { + this.sdpIp = sdpIp; + } + + public String getStreamIp() { + return streamIp; + } + + public void setStreamIp(String streamIp) { + this.streamIp = streamIp; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + public String getHlsFileBufSize() { return hlsFileBufSize; } @@ -348,11 +389,11 @@ public class ZLMServerConfig { this.hookEnable = hookEnable; } - public String getHookOnFlowReport() { + public Integer getHookOnFlowReport() { return hookOnFlowReport; } - public void setHookOnFlowReport(String hookOnFlowReport) { + public void setHookOnFlowReport(Integer hookOnFlowReport) { this.hookOnFlowReport = hookOnFlowReport; } @@ -484,11 +525,11 @@ public class ZLMServerConfig { this.httpNotFound = httpNotFound; } - public String getHttpPort() { + public Integer getHttpPort() { return httpPort; } - public void setHttpPort(String httpPort) { + public void setHttpPort(Integer httpPort) { this.httpPort = httpPort; } @@ -508,11 +549,11 @@ public class ZLMServerConfig { this.httpSendBufSize = httpSendBufSize; } - public String getHttpSSLport() { + public Integer getHttpSSLport() { return httpSSLport; } - public void setHttpSSLport(String httpSSLport) { + public void setHttpSSLport(Integer httpSSLport) { this.httpSSLport = httpSSLport; } @@ -596,14 +637,22 @@ public class ZLMServerConfig { this.rtmpModifyStamp = rtmpModifyStamp; } - public String getRtmpPort() { + public Integer getRtmpPort() { return rtmpPort; } - public void setRtmpPort(String rtmpPort) { + public void setRtmpPort(Integer rtmpPort) { this.rtmpPort = rtmpPort; } + public Integer getRtmpSslPort() { + return rtmpSslPort; + } + + public void setRtmpSslPort(Integer rtmpSslPort) { + this.rtmpSslPort = rtmpSslPort; + } + public String getRtpAudioMtuSize() { return rtpAudioMtuSize; } @@ -660,11 +709,11 @@ public class ZLMServerConfig { this.rtpProxyDumpDir = rtpProxyDumpDir; } - public String getRtpProxyPort() { + public Integer getRtpProxyPort() { return rtpProxyPort; } - public void setRtpProxyPort(String rtpProxyPort) { + public void setRtpProxyPort(Integer rtpProxyPort) { this.rtpProxyPort = rtpProxyPort; } @@ -700,19 +749,19 @@ public class ZLMServerConfig { this.rtspKeepAliveSecond = rtspKeepAliveSecond; } - public String getRtspPort() { + public Integer getRtspPort() { return rtspPort; } - public void setRtspPort(String rtspPort) { + public void setRtspPort(Integer rtspPort) { this.rtspPort = rtspPort; } - public String getRtspSSlport() { + public Integer getRtspSSlport() { return rtspSSlport; } - public void setRtspSSlport(String rtspSSlport) { + public void setRtspSSlport(Integer rtspSSlport) { this.rtspSSlport = rtspSSlport; } @@ -731,48 +780,4 @@ public class ZLMServerConfig { public void setShellPhell(String shellPhell) { this.shellPhell = shellPhell; } - - public String getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(String updateTime) { - this.updateTime = updateTime; - } - - public String getGeneralMediaServerId() { - return generalMediaServerId; - } - - public void setGeneralMediaServerId(String generalMediaServerId) { - this.generalMediaServerId = generalMediaServerId; - } - - public String getRtmpSslPort() { - return rtmpSslPort; - } - - public void setRtmpSslPort(String rtmpSslPort) { - this.rtmpSslPort = rtmpSslPort; - } - - public String getSdpIp() { - if (StringUtils.isEmpty(sdpIp)) { - return ip; - }else { - return sdpIp; - } - } - - public void setSdpIp(String sdpIp) { - this.sdpIp = sdpIp; - } - - public String getStreamIp() { - return streamIp; - } - - public void setStreamIp(String streamIp) { - this.streamIp = streamIp; - } } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java index 0be9b19e..45b5ab7b 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java @@ -19,12 +19,12 @@ public interface DeviceChannelMapper { "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " + "VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," + "'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " + - "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, datetime('now','localtime'), datetime('now','localtime'))") + "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude},'${createTime}', '${updateTime}')") int add(DeviceChannel channel); @Update(value = {"