- 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

View File

@ -138,19 +138,19 @@ class BaresipService: Service() {
Utils.copyAssetToFile(applicationContext, a, "$filesPath/$a")
} else {
Log.d(LOG_TAG, "Asset '$a' already copied")
if (a == "config") {
var dnsServers = listOf<InetAddress>()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val activeNetwork = cm.activeNetwork
if (activeNetwork != null) {
dnsServers = cm.getLinkProperties(activeNetwork).dnsServers
Log.d(LOG_TAG, "DNS Servers = $dnsServers")
} else {
Log.d(LOG_TAG, "No active network!")
}
}
if (a == "config") {
var dnsServers = listOf<InetAddress>()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val activeNetwork = cm.activeNetwork
if (activeNetwork != null) {
dnsServers = cm.getLinkProperties(activeNetwork).dnsServers
Log.d(LOG_TAG, "DNS Servers = $dnsServers")
} else {
Log.d(LOG_TAG, "No active network!")
}
Config.initialize(dnsServers)
}
Config.initialize(dnsServers)
}
}