Commit 0f0ece240128795d7e174937a4ee848ef7f3d691
1 parent
958474c6
设备编辑增加收流IP
Showing
7 changed files
with
52 additions
and
10 deletions
sql/update.sql
| @@ -11,6 +11,9 @@ alter table device | @@ -11,6 +11,9 @@ alter table device | ||
| 11 | add custom_name varchar(255) default null; | 11 | add custom_name varchar(255) default null; |
| 12 | 12 | ||
| 13 | alter table device | 13 | alter table device |
| 14 | + add sdpIp varchar(50) default null; | ||
| 15 | + | ||
| 16 | +alter table device | ||
| 14 | add password varchar(255) default null; | 17 | add password varchar(255) default null; |
| 15 | 18 | ||
| 16 | alter table device | 19 | alter table device |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -175,6 +175,9 @@ public class Device { | @@ -175,6 +175,9 @@ public class Device { | ||
| 175 | @Schema(description = "密码") | 175 | @Schema(description = "密码") |
| 176 | private String password; | 176 | private String password; |
| 177 | 177 | ||
| 178 | + @Schema(description = "收流IP") | ||
| 179 | + private String sdpIp; | ||
| 180 | + | ||
| 178 | 181 | ||
| 179 | public String getDeviceId() { | 182 | public String getDeviceId() { |
| 180 | return deviceId; | 183 | return deviceId; |
| @@ -391,4 +394,12 @@ public class Device { | @@ -391,4 +394,12 @@ public class Device { | ||
| 391 | public void setPassword(String password) { | 394 | public void setPassword(String password) { |
| 392 | this.password = password; | 395 | this.password = password; |
| 393 | } | 396 | } |
| 397 | + | ||
| 398 | + public String getSdpIp() { | ||
| 399 | + return sdpIp; | ||
| 400 | + } | ||
| 401 | + | ||
| 402 | + public void setSdpIp(String sdpIp) { | ||
| 403 | + this.sdpIp = sdpIp; | ||
| 404 | + } | ||
| 394 | } | 405 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -290,12 +290,17 @@ public class SIPCommander implements ISIPCommander { | @@ -290,12 +290,17 @@ public class SIPCommander implements ISIPCommander { | ||
| 290 | subscribe.removeSubscribe(hookSubscribe); | 290 | subscribe.removeSubscribe(hookSubscribe); |
| 291 | } | 291 | } |
| 292 | }); | 292 | }); |
| 293 | - // | 293 | + String sdpIp; |
| 294 | + if (!ObjectUtils.isEmpty(device.getSdpIp())) { | ||
| 295 | + sdpIp = device.getSdpIp(); | ||
| 296 | + }else { | ||
| 297 | + sdpIp = mediaServerItem.getSdpIp(); | ||
| 298 | + } | ||
| 294 | StringBuffer content = new StringBuffer(200); | 299 | StringBuffer content = new StringBuffer(200); |
| 295 | content.append("v=0\r\n"); | 300 | content.append("v=0\r\n"); |
| 296 | - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); | 301 | + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); |
| 297 | content.append("s=Play\r\n"); | 302 | content.append("s=Play\r\n"); |
| 298 | - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); | 303 | + content.append("c=IN IP4 " + sdpIp + "\r\n"); |
| 299 | content.append("t=0 0\r\n"); | 304 | content.append("t=0 0\r\n"); |
| 300 | 305 | ||
| 301 | if (userSetting.isSeniorSdp()) { | 306 | if (userSetting.isSeniorSdp()) { |
| @@ -379,13 +384,18 @@ public class SIPCommander implements ISIPCommander { | @@ -379,13 +384,18 @@ public class SIPCommander implements ISIPCommander { | ||
| 379 | 384 | ||
| 380 | 385 | ||
| 381 | logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); | 386 | logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); |
| 382 | - | 387 | + String sdpIp; |
| 388 | + if (!ObjectUtils.isEmpty(device.getSdpIp())) { | ||
| 389 | + sdpIp = device.getSdpIp(); | ||
| 390 | + }else { | ||
| 391 | + sdpIp = mediaServerItem.getSdpIp(); | ||
| 392 | + } | ||
| 383 | StringBuffer content = new StringBuffer(200); | 393 | StringBuffer content = new StringBuffer(200); |
| 384 | content.append("v=0\r\n"); | 394 | content.append("v=0\r\n"); |
| 385 | - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); | 395 | + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); |
| 386 | content.append("s=Playback\r\n"); | 396 | content.append("s=Playback\r\n"); |
| 387 | content.append("u=" + channelId + ":0\r\n"); | 397 | content.append("u=" + channelId + ":0\r\n"); |
| 388 | - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); | 398 | + content.append("c=IN IP4 " + sdpIp + "\r\n"); |
| 389 | content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " " | 399 | content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " " |
| 390 | + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); | 400 | + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); |
| 391 | 401 | ||
| @@ -476,13 +486,18 @@ public class SIPCommander implements ISIPCommander { | @@ -476,13 +486,18 @@ public class SIPCommander implements ISIPCommander { | ||
| 476 | SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { | 486 | SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException { |
| 477 | 487 | ||
| 478 | logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); | 488 | logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); |
| 479 | - | 489 | + String sdpIp; |
| 490 | + if (!ObjectUtils.isEmpty(device.getSdpIp())) { | ||
| 491 | + sdpIp = device.getSdpIp(); | ||
| 492 | + }else { | ||
| 493 | + sdpIp = mediaServerItem.getSdpIp(); | ||
| 494 | + } | ||
| 480 | StringBuffer content = new StringBuffer(200); | 495 | StringBuffer content = new StringBuffer(200); |
| 481 | content.append("v=0\r\n"); | 496 | content.append("v=0\r\n"); |
| 482 | - content.append("o=" + channelId + " 0 0 IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); | 497 | + content.append("o=" + channelId + " 0 0 IN IP4 " + sdpIp + "\r\n"); |
| 483 | content.append("s=Download\r\n"); | 498 | content.append("s=Download\r\n"); |
| 484 | content.append("u=" + channelId + ":0\r\n"); | 499 | content.append("u=" + channelId + ":0\r\n"); |
| 485 | - content.append("c=IN IP4 " + mediaServerItem.getSdpIp() + "\r\n"); | 500 | + content.append("c=IN IP4 " + sdpIp + "\r\n"); |
| 486 | content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " " | 501 | content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " " |
| 487 | + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); | 502 | + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); |
| 488 | 503 |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| @@ -600,6 +600,7 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -600,6 +600,7 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 600 | if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) { | 600 | if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) { |
| 601 | updateDeviceChannelGeoCoordSys(device); | 601 | updateDeviceChannelGeoCoordSys(device); |
| 602 | } | 602 | } |
| 603 | + // 更新redis | ||
| 603 | deviceMapper.updateCustom(device); | 604 | deviceMapper.updateCustom(device); |
| 604 | } | 605 | } |
| 605 | 606 |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| @@ -24,6 +24,7 @@ public interface DeviceMapper { | @@ -24,6 +24,7 @@ public interface DeviceMapper { | ||
| 24 | "transport," + | 24 | "transport," + |
| 25 | "streamMode," + | 25 | "streamMode," + |
| 26 | "ip," + | 26 | "ip," + |
| 27 | + "sdpIp," + | ||
| 27 | "port," + | 28 | "port," + |
| 28 | "hostAddress," + | 29 | "hostAddress," + |
| 29 | "expires," + | 30 | "expires," + |
| @@ -52,6 +53,7 @@ public interface DeviceMapper { | @@ -52,6 +53,7 @@ public interface DeviceMapper { | ||
| 52 | "transport," + | 53 | "transport," + |
| 53 | "streamMode," + | 54 | "streamMode," + |
| 54 | "ip," + | 55 | "ip," + |
| 56 | + "sdpIp," + | ||
| 55 | "port," + | 57 | "port," + |
| 56 | "hostAddress," + | 58 | "hostAddress," + |
| 57 | "expires," + | 59 | "expires," + |
| @@ -77,6 +79,7 @@ public interface DeviceMapper { | @@ -77,6 +79,7 @@ public interface DeviceMapper { | ||
| 77 | "#{transport}," + | 79 | "#{transport}," + |
| 78 | "#{streamMode}," + | 80 | "#{streamMode}," + |
| 79 | "#{ip}," + | 81 | "#{ip}," + |
| 82 | + "#{sdpIp}," + | ||
| 80 | "#{port}," + | 83 | "#{port}," + |
| 81 | "#{hostAddress}," + | 84 | "#{hostAddress}," + |
| 82 | "#{expires}," + | 85 | "#{expires}," + |
| @@ -125,6 +128,7 @@ public interface DeviceMapper { | @@ -125,6 +128,7 @@ public interface DeviceMapper { | ||
| 125 | "transport," + | 128 | "transport," + |
| 126 | "streamMode," + | 129 | "streamMode," + |
| 127 | "ip," + | 130 | "ip," + |
| 131 | + "sdpIp," + | ||
| 128 | "port," + | 132 | "port," + |
| 129 | "hostAddress," + | 133 | "hostAddress," + |
| 130 | "expires," + | 134 | "expires," + |
| @@ -160,6 +164,7 @@ public interface DeviceMapper { | @@ -160,6 +164,7 @@ public interface DeviceMapper { | ||
| 160 | "transport," + | 164 | "transport," + |
| 161 | "streamMode," + | 165 | "streamMode," + |
| 162 | "ip," + | 166 | "ip," + |
| 167 | + "sdpIp," + | ||
| 163 | "port," + | 168 | "port," + |
| 164 | "hostAddress," + | 169 | "hostAddress," + |
| 165 | "expires," + | 170 | "expires," + |
| @@ -188,6 +193,7 @@ public interface DeviceMapper { | @@ -188,6 +193,7 @@ public interface DeviceMapper { | ||
| 188 | "transport," + | 193 | "transport," + |
| 189 | "streamMode," + | 194 | "streamMode," + |
| 190 | "ip," + | 195 | "ip," + |
| 196 | + "sdpIp," + | ||
| 191 | "port," + | 197 | "port," + |
| 192 | "hostAddress," + | 198 | "hostAddress," + |
| 193 | "expires," + | 199 | "expires," + |
| @@ -214,6 +220,7 @@ public interface DeviceMapper { | @@ -214,6 +220,7 @@ public interface DeviceMapper { | ||
| 214 | "<if test=\"password != null\">, password='${password}'</if>" + | 220 | "<if test=\"password != null\">, password='${password}'</if>" + |
| 215 | "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" + | 221 | "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" + |
| 216 | "<if test=\"ip != null\">, ip='${ip}'</if>" + | 222 | "<if test=\"ip != null\">, ip='${ip}'</if>" + |
| 223 | + "<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" + | ||
| 217 | "<if test=\"port != null\">, port=${port}</if>" + | 224 | "<if test=\"port != null\">, port=${port}</if>" + |
| 218 | "<if test=\"charset != null\">, charset='${charset}'</if>" + | 225 | "<if test=\"charset != null\">, charset='${charset}'</if>" + |
| 219 | "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" + | 226 | "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" + |
| @@ -232,6 +239,7 @@ public interface DeviceMapper { | @@ -232,6 +239,7 @@ public interface DeviceMapper { | ||
| 232 | "deviceId, " + | 239 | "deviceId, " + |
| 233 | "custom_name, " + | 240 | "custom_name, " + |
| 234 | "password, " + | 241 | "password, " + |
| 242 | + "sdpIp, " + | ||
| 235 | "createTime," + | 243 | "createTime," + |
| 236 | "updateTime," + | 244 | "updateTime," + |
| 237 | "charset," + | 245 | "charset," + |
| @@ -243,6 +251,7 @@ public interface DeviceMapper { | @@ -243,6 +251,7 @@ public interface DeviceMapper { | ||
| 243 | "#{deviceId}," + | 251 | "#{deviceId}," + |
| 244 | "#{name}," + | 252 | "#{name}," + |
| 245 | "#{password}," + | 253 | "#{password}," + |
| 254 | + "#{sdpIp}," + | ||
| 246 | "#{createTime}," + | 255 | "#{createTime}," + |
| 247 | "#{updateTime}," + | 256 | "#{updateTime}," + |
| 248 | "#{charset}," + | 257 | "#{charset}," + |
web_src/src/components/dialog/configInfo.vue
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <el-tag size="small">{{configInfoData.sip.password}}</el-tag> | 19 | <el-tag size="small">{{configInfoData.sip.password}}</el-tag> |
| 20 | </el-descriptions-item> | 20 | </el-descriptions-item> |
| 21 | </el-descriptions> | 21 | </el-descriptions> |
| 22 | - <el-descriptions title="版本信息"v-if="configInfoData.sip"> | 22 | + <el-descriptions title="版本信息"v-if="configInfoData.version"> |
| 23 | <el-descriptions-item label="版本">{{configInfoData.version.version}}</el-descriptions-item> | 23 | <el-descriptions-item label="版本">{{configInfoData.version.version}}</el-descriptions-item> |
| 24 | <el-descriptions-item label="编译时间">{{configInfoData.version.BUILD_DATE}}</el-descriptions-item> | 24 | <el-descriptions-item label="编译时间">{{configInfoData.version.BUILD_DATE}}</el-descriptions-item> |
| 25 | <el-descriptions-item label="GIT版本">{{configInfoData.version.GIT_Revision_SHORT}}</el-descriptions-item> | 25 | <el-descriptions-item label="GIT版本">{{configInfoData.version.GIT_Revision_SHORT}}</el-descriptions-item> |
web_src/src/components/dialog/deviceEdit.vue
| @@ -22,6 +22,9 @@ | @@ -22,6 +22,9 @@ | ||
| 22 | <el-form-item label="密码" prop="password"> | 22 | <el-form-item label="密码" prop="password"> |
| 23 | <el-input type="password" v-model="form.password" clearable></el-input> | 23 | <el-input type="password" v-model="form.password" clearable></el-input> |
| 24 | </el-form-item> | 24 | </el-form-item> |
| 25 | + <el-form-item label="收流IP" prop="sdpIp"> | ||
| 26 | + <el-input type="sdpIp" v-model="form.sdpIp" clearable></el-input> | ||
| 27 | + </el-form-item> | ||
| 25 | <el-form-item label="流媒体ID" prop="mediaServerId"> | 28 | <el-form-item label="流媒体ID" prop="mediaServerId"> |
| 26 | <el-select v-model="form.mediaServerId" style="float: left; width: 100%" > | 29 | <el-select v-model="form.mediaServerId" style="float: left; width: 100%" > |
| 27 | <el-option key="auto" label="自动负载最小" value="auto"></el-option> | 30 | <el-option key="auto" label="自动负载最小" value="auto"></el-option> |