diff --git a/sql/update.sql b/sql/update.sql index c6ec5956..1c2f855f 100644 --- a/sql/update.sql +++ b/sql/update.sql @@ -10,6 +10,9 @@ alter table device alter table device add custom_name varchar(255) default null; +alter table device + add sdpIp varchar(50) default null; + alter table device add password varchar(255) default null; diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java index 8af042cf..9dd046b7 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java @@ -175,6 +175,9 @@ public class Device { @Schema(description = "密码") private String password; + @Schema(description = "收流IP") + private String sdpIp; + public String getDeviceId() { return deviceId; @@ -391,4 +394,12 @@ public class Device { public void setPassword(String password) { this.password = password; } + + public String getSdpIp() { + return sdpIp; + } + + public void setSdpIp(String sdpIp) { + this.sdpIp = sdpIp; + } } 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 b374461c..dc356d01 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 @@ -290,12 +290,17 @@ public class SIPCommander implements ISIPCommander { subscribe.removeSubscribe(hookSubscribe); } }); - // + String sdpIp; + if (!ObjectUtils.isEmpty(device.getSdpIp())) { + sdpIp = device.getSdpIp(); + }else { + sdpIp = mediaServerItem.getSdpIp(); + } StringBuffer content = new StringBuffer(200); content.append("v=0\r\n"); - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); content.append("s=Play\r\n"); - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); + content.append("c=IN IP4 " + sdpIp + "\r\n"); content.append("t=0 0\r\n"); if (userSetting.isSeniorSdp()) { @@ -379,13 +384,18 @@ public class SIPCommander implements ISIPCommander { logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); - + String sdpIp; + if (!ObjectUtils.isEmpty(device.getSdpIp())) { + sdpIp = device.getSdpIp(); + }else { + sdpIp = mediaServerItem.getSdpIp(); + } StringBuffer content = new StringBuffer(200); content.append("v=0\r\n"); - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); content.append("s=Playback\r\n"); content.append("u=" + channelId + ":0\r\n"); - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); + content.append("c=IN IP4 " + sdpIp + "\r\n"); content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " " + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); @@ -476,13 +486,18 @@ public class SIPCommander implements ISIPCommander { SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); - + String sdpIp; + if (!ObjectUtils.isEmpty(device.getSdpIp())) { + sdpIp = device.getSdpIp(); + }else { + sdpIp = mediaServerItem.getSdpIp(); + } StringBuffer content = new StringBuffer(200); content.append("v=0\r\n"); - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); content.append("s=Download\r\n"); content.append("u=" + channelId + ":0\r\n"); - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); + content.append("c=IN IP4 " + sdpIp + "\r\n"); content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " " + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); diff --git a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java index 16c9803e..c1a86190 100644 --- a/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java @@ -600,6 +600,7 @@ public class DeviceServiceImpl implements IDeviceService { if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) { updateDeviceChannelGeoCoordSys(device); } + // 更新redis deviceMapper.updateCustom(device); } diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java index b1210c62..9bf5c02b 100644 --- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java +++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java @@ -24,6 +24,7 @@ public interface DeviceMapper { "transport," + "streamMode," + "ip," + + "sdpIp," + "port," + "hostAddress," + "expires," + @@ -52,6 +53,7 @@ public interface DeviceMapper { "transport," + "streamMode," + "ip," + + "sdpIp," + "port," + "hostAddress," + "expires," + @@ -77,6 +79,7 @@ public interface DeviceMapper { "#{transport}," + "#{streamMode}," + "#{ip}," + + "#{sdpIp}," + "#{port}," + "#{hostAddress}," + "#{expires}," + @@ -125,6 +128,7 @@ public interface DeviceMapper { "transport," + "streamMode," + "ip," + + "sdpIp," + "port," + "hostAddress," + "expires," + @@ -160,6 +164,7 @@ public interface DeviceMapper { "transport," + "streamMode," + "ip," + + "sdpIp," + "port," + "hostAddress," + "expires," + @@ -188,6 +193,7 @@ public interface DeviceMapper { "transport," + "streamMode," + "ip," + + "sdpIp," + "port," + "hostAddress," + "expires," + @@ -214,6 +220,7 @@ public interface DeviceMapper { ", password='${password}'" + ", streamMode='${streamMode}'" + ", ip='${ip}'" + + ", sdpIp='${sdpIp}'" + ", port=${port}" + ", charset='${charset}'" + ", subscribeCycleForCatalog=${subscribeCycleForCatalog}" + @@ -232,6 +239,7 @@ public interface DeviceMapper { "deviceId, " + "custom_name, " + "password, " + + "sdpIp, " + "createTime," + "updateTime," + "charset," + @@ -243,6 +251,7 @@ public interface DeviceMapper { "#{deviceId}," + "#{name}," + "#{password}," + + "#{sdpIp}," + "#{createTime}," + "#{updateTime}," + "#{charset}," + diff --git a/web_src/src/components/dialog/configInfo.vue b/web_src/src/components/dialog/configInfo.vue index 428d6219..83d9f38a 100644 --- a/web_src/src/components/dialog/configInfo.vue +++ b/web_src/src/components/dialog/configInfo.vue @@ -19,7 +19,7 @@ {{configInfoData.sip.password}} - + {{configInfoData.version.version}} {{configInfoData.version.BUILD_DATE}} {{configInfoData.version.GIT_Revision_SHORT}} diff --git a/web_src/src/components/dialog/deviceEdit.vue b/web_src/src/components/dialog/deviceEdit.vue index 3747ca41..8a5f9d13 100644 --- a/web_src/src/components/dialog/deviceEdit.vue +++ b/web_src/src/components/dialog/deviceEdit.vue @@ -22,6 +22,9 @@ + + +