- Get DNS servers dynamically also then baresip is started the first time.

This commit is contained in:
Juha Heinanen
2019-06-04 20:20:34 +03:00
parent 38c95c976f
commit 0925454c54
@@ -138,19 +138,19 @@ class BaresipService: Service() {
Utils.copyAssetToFile(applicationContext, a, "$filesPath/$a") Utils.copyAssetToFile(applicationContext, a, "$filesPath/$a")
} else { } else {
Log.d(LOG_TAG, "Asset '$a' already copied") Log.d(LOG_TAG, "Asset '$a' already copied")
if (a == "config") { }
var dnsServers = listOf<InetAddress>() if (a == "config") {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { var dnsServers = listOf<InetAddress>()
val activeNetwork = cm.activeNetwork if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (activeNetwork != null) { val activeNetwork = cm.activeNetwork
dnsServers = cm.getLinkProperties(activeNetwork).dnsServers if (activeNetwork != null) {
Log.d(LOG_TAG, "DNS Servers = $dnsServers") dnsServers = cm.getLinkProperties(activeNetwork).dnsServers
} else { Log.d(LOG_TAG, "DNS Servers = $dnsServers")
Log.d(LOG_TAG, "No active network!") } else {
} Log.d(LOG_TAG, "No active network!")
} }
Config.initialize(dnsServers)
} }
Config.initialize(dnsServers)
} }
} }