优化docker内ip变化的情况
parent
07a8ef9e25
commit
aa56bb3c26
|
@ -39,10 +39,10 @@ public class SipLayer implements CommandLineRunner {
|
||||||
|
|
||||||
private final Map<String, SipProviderImpl> tcpSipProviderMap = new ConcurrentHashMap<>();
|
private final Map<String, SipProviderImpl> tcpSipProviderMap = new ConcurrentHashMap<>();
|
||||||
private final Map<String, SipProviderImpl> udpSipProviderMap = new ConcurrentHashMap<>();
|
private final Map<String, SipProviderImpl> udpSipProviderMap = new ConcurrentHashMap<>();
|
||||||
|
private final List<String> monitorIps = new ArrayList<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String... args) {
|
public void run(String... args) {
|
||||||
List<String> monitorIps = new ArrayList<>();
|
|
||||||
if (ObjectUtils.isEmpty(sipConfig.getIp())) {
|
if (ObjectUtils.isEmpty(sipConfig.getIp())) {
|
||||||
try {
|
try {
|
||||||
// 获得本机的所有网络接口
|
// 获得本机的所有网络接口
|
||||||
|
@ -173,6 +173,9 @@ public class SipLayer implements CommandLineRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalIp(String deviceLocalIp) {
|
public String getLocalIp(String deviceLocalIp) {
|
||||||
|
if (monitorIps.size() == 1) {
|
||||||
|
return monitorIps.get(0);
|
||||||
|
}
|
||||||
if (!ObjectUtils.isEmpty(deviceLocalIp)) {
|
if (!ObjectUtils.isEmpty(deviceLocalIp)) {
|
||||||
return deviceLocalIp;
|
return deviceLocalIp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue