From 0925454c540f4dd2188bc157688f1f867e18c6a3 Mon Sep 17 00:00:00 2001 From: Juha Heinanen Date: Tue, 4 Jun 2019 20:20:34 +0300 Subject: [PATCH] - Get DNS servers dynamically also then baresip is started the first time. --- .../com/tutpro/baresip/BaresipService.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt index 803f5a12..33550b04 100644 --- a/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt +++ b/app/src/main/kotlin/com/tutpro/baresip/BaresipService.kt @@ -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() - 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() + 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) } }