- Try to update dynamic DNS information if registration fails due to

"Invalid argument" error.
This commit is contained in:
Juha Heinanen
2019-08-30 10:04:58 +03:00
parent 49ccc5c620
commit 36054fd508

View File

@ -357,6 +357,22 @@ class BaresipService: Service() {
"registering failed" -> {
status[account_index] = R.drawable.dot_red
updateStatusNotification()
if ((ev.size > 1) && (ev[1] == "Invalid argument")) {
// Most likely this error is due to DNS lookup failure
newEvent = "registering failed,DNS lookup failed"
if (dynDns)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val activeNetwork = cm.activeNetwork
if (activeNetwork != null) {
val dnsServers = cm.getLinkProperties(activeNetwork).dnsServers
Log.d(LOG_TAG, "Updating DNS Servers = $dnsServers")
if (Config.updateDnsServers(dnsServers) != 0)
Log.w(LOG_TAG, "Failed to update DNS servers '$dnsServers'")
} else {
Log.d(LOG_TAG, "No active network!")
}
}
}
if (!Utils.isVisible())
return
}