设备编辑增加收流IP

pull/698/head^2
648540858 2022-10-25 10:17:59 +08:00
parent 958474c646
commit 0f0ece2401
7 changed files with 52 additions and 10 deletions

View File

@ -10,6 +10,9 @@ alter table device
alter table device alter table device
add custom_name varchar(255) default null; add custom_name varchar(255) default null;
alter table device
add sdpIp varchar(50) default null;
alter table device alter table device
add password varchar(255) default null; add password varchar(255) default null;

View File

@ -175,6 +175,9 @@ public class Device {
@Schema(description = "密码") @Schema(description = "密码")
private String password; private String password;
@Schema(description = "收流IP")
private String sdpIp;
public String getDeviceId() { public String getDeviceId() {
return deviceId; return deviceId;
@ -391,4 +394,12 @@ public class Device {
public void setPassword(String password) { public void setPassword(String password) {
this.password = password; this.password = password;
} }
public String getSdpIp() {
return sdpIp;
}
public void setSdpIp(String sdpIp) {
this.sdpIp = sdpIp;
}
} }

View File

@ -290,12 +290,17 @@ public class SIPCommander implements ISIPCommander {
subscribe.removeSubscribe(hookSubscribe); subscribe.removeSubscribe(hookSubscribe);
} }
}); });
// String sdpIp;
if (!ObjectUtils.isEmpty(device.getSdpIp())) {
sdpIp = device.getSdpIp();
}else {
sdpIp = mediaServerItem.getSdpIp();
}
StringBuffer content = new StringBuffer(200); StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n"); 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("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"); content.append("t=0 0\r\n");
if (userSetting.isSeniorSdp()) { if (userSetting.isSeniorSdp()) {
@ -379,13 +384,18 @@ public class SIPCommander implements ISIPCommander {
logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); 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); StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n"); 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("s=Playback\r\n");
content.append("u=" + channelId + ":0\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) + " " content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " "
+ DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); + 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 { SipSubscribe.Event errorEvent) throws InvalidArgumentException, SipException, ParseException {
logger.info("{} 分配的ZLM为: {} [{}:{}]", ssrcInfo.getStream(), mediaServerItem.getId(), mediaServerItem.getIp(), ssrcInfo.getPort()); 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); StringBuffer content = new StringBuffer(200);
content.append("v=0\r\n"); 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("s=Download\r\n");
content.append("u=" + channelId + ":0\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) + " " content.append("t=" + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(startTime) + " "
+ DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n"); + DateUtil.yyyy_MM_dd_HH_mm_ssToTimestamp(endTime) + "\r\n");

View File

@ -600,6 +600,7 @@ public class DeviceServiceImpl implements IDeviceService {
if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) { if (!deviceInStore.getGeoCoordSys().equals(device.getGeoCoordSys())) {
updateDeviceChannelGeoCoordSys(device); updateDeviceChannelGeoCoordSys(device);
} }
// 更新redis
deviceMapper.updateCustom(device); deviceMapper.updateCustom(device);
} }

View File

@ -24,6 +24,7 @@ public interface DeviceMapper {
"transport," + "transport," +
"streamMode," + "streamMode," +
"ip," + "ip," +
"sdpIp," +
"port," + "port," +
"hostAddress," + "hostAddress," +
"expires," + "expires," +
@ -52,6 +53,7 @@ public interface DeviceMapper {
"transport," + "transport," +
"streamMode," + "streamMode," +
"ip," + "ip," +
"sdpIp," +
"port," + "port," +
"hostAddress," + "hostAddress," +
"expires," + "expires," +
@ -77,6 +79,7 @@ public interface DeviceMapper {
"#{transport}," + "#{transport}," +
"#{streamMode}," + "#{streamMode}," +
"#{ip}," + "#{ip}," +
"#{sdpIp}," +
"#{port}," + "#{port}," +
"#{hostAddress}," + "#{hostAddress}," +
"#{expires}," + "#{expires}," +
@ -125,6 +128,7 @@ public interface DeviceMapper {
"transport," + "transport," +
"streamMode," + "streamMode," +
"ip," + "ip," +
"sdpIp," +
"port," + "port," +
"hostAddress," + "hostAddress," +
"expires," + "expires," +
@ -160,6 +164,7 @@ public interface DeviceMapper {
"transport," + "transport," +
"streamMode," + "streamMode," +
"ip," + "ip," +
"sdpIp," +
"port," + "port," +
"hostAddress," + "hostAddress," +
"expires," + "expires," +
@ -188,6 +193,7 @@ public interface DeviceMapper {
"transport," + "transport," +
"streamMode," + "streamMode," +
"ip," + "ip," +
"sdpIp," +
"port," + "port," +
"hostAddress," + "hostAddress," +
"expires," + "expires," +
@ -214,6 +220,7 @@ public interface DeviceMapper {
"<if test=\"password != null\">, password='${password}'</if>" + "<if test=\"password != null\">, password='${password}'</if>" +
"<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" + "<if test=\"streamMode != null\">, streamMode='${streamMode}'</if>" +
"<if test=\"ip != null\">, ip='${ip}'</if>" + "<if test=\"ip != null\">, ip='${ip}'</if>" +
"<if test=\"sdpIp != null\">, sdpIp='${sdpIp}'</if>" +
"<if test=\"port != null\">, port=${port}</if>" + "<if test=\"port != null\">, port=${port}</if>" +
"<if test=\"charset != null\">, charset='${charset}'</if>" + "<if test=\"charset != null\">, charset='${charset}'</if>" +
"<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" + "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" +
@ -232,6 +239,7 @@ public interface DeviceMapper {
"deviceId, " + "deviceId, " +
"custom_name, " + "custom_name, " +
"password, " + "password, " +
"sdpIp, " +
"createTime," + "createTime," +
"updateTime," + "updateTime," +
"charset," + "charset," +
@ -243,6 +251,7 @@ public interface DeviceMapper {
"#{deviceId}," + "#{deviceId}," +
"#{name}," + "#{name}," +
"#{password}," + "#{password}," +
"#{sdpIp}," +
"#{createTime}," + "#{createTime}," +
"#{updateTime}," + "#{updateTime}," +
"#{charset}," + "#{charset}," +

View File

@ -19,7 +19,7 @@
<el-tag size="small">{{configInfoData.sip.password}}</el-tag> <el-tag size="small">{{configInfoData.sip.password}}</el-tag>
</el-descriptions-item> </el-descriptions-item>
</el-descriptions> </el-descriptions>
<el-descriptions title="版本信息"v-if="configInfoData.sip"> <el-descriptions title="版本信息"v-if="configInfoData.version">
<el-descriptions-item label="版本">{{configInfoData.version.version}}</el-descriptions-item> <el-descriptions-item label="版本">{{configInfoData.version.version}}</el-descriptions-item>
<el-descriptions-item label="编译时间">{{configInfoData.version.BUILD_DATE}}</el-descriptions-item> <el-descriptions-item label="编译时间">{{configInfoData.version.BUILD_DATE}}</el-descriptions-item>
<el-descriptions-item label="GIT版本">{{configInfoData.version.GIT_Revision_SHORT}}</el-descriptions-item> <el-descriptions-item label="GIT版本">{{configInfoData.version.GIT_Revision_SHORT}}</el-descriptions-item>

View File

@ -22,6 +22,9 @@
<el-form-item label="密码" prop="password"> <el-form-item label="密码" prop="password">
<el-input type="password" v-model="form.password" clearable></el-input> <el-input type="password" v-model="form.password" clearable></el-input>
</el-form-item> </el-form-item>
<el-form-item label="收流IP" prop="sdpIp">
<el-input type="sdpIp" v-model="form.sdpIp" clearable></el-input>
</el-form-item>
<el-form-item label="流媒体ID" prop="mediaServerId"> <el-form-item label="流媒体ID" prop="mediaServerId">
<el-select v-model="form.mediaServerId" style="float: left; width: 100%" > <el-select v-model="form.mediaServerId" style="float: left; width: 100%" >
<el-option key="auto" label="自动负载最小" value="auto"></el-option> <el-option key="auto" label="自动负载最小" value="auto"></el-option>