Commit dd013ec3 authored by Christophe Deschamps's avatar Christophe Deschamps
Browse files

fix proxy definition incl port and transport

parent b6b8ee65
...@@ -25,6 +25,7 @@ import androidx.lifecycle.MutableLiveData ...@@ -25,6 +25,7 @@ import androidx.lifecycle.MutableLiveData
import org.linhome.LinhomeApplication import org.linhome.LinhomeApplication
import org.linhome.LinhomeApplication.Companion.coreContext import org.linhome.LinhomeApplication.Companion.coreContext
import org.linhome.LinhomeApplication.Companion.corePreferences import org.linhome.LinhomeApplication.Companion.corePreferences
import org.linhome.linphonecore.CoreContext
import org.linhome.linphonecore.CorePreferences import org.linhome.linphonecore.CorePreferences
import org.linhome.linphonecore.extensions.cleanHistory import org.linhome.linphonecore.extensions.cleanHistory
import org.linphone.core.* import org.linphone.core.*
...@@ -59,18 +60,22 @@ object Account { ...@@ -59,18 +60,22 @@ object Account {
expiration: String, expiration: String,
pushReady: MutableLiveData<Boolean> pushReady: MutableLiveData<Boolean>
) { ) {
accountCreator.createProxyConfig()?.also { proxyConfig -> val transports = arrayOf("udp","tcp","tls")
Log.i("[Account] created proxyConfig with domain ${proxyConfig.domain}") accountCreator.createProxyConfig()
proxyConfig.expires = expiration.toInt() coreContext.core.accountList.first()?.also { account ->
Log.i("[Account] created proxyConfig with domain ${account.params.domain}")
account.params.expires = expiration.toInt()
if (!TextUtils.isEmpty(proxy)) { if (!TextUtils.isEmpty(proxy)) {
proxyConfig.serverAddr = proxy val address = (if (accountCreator.transport == TransportType.Tls) "sips:" else "sip:") + proxy!! + ";transport="+transports.get(accountCreator.transport.toInt())
Log.i("[Account] Set proxyConfig server address to ${proxyConfig.serverAddr} for proxyConfig with domain ${proxyConfig.domain}") account.params.serverAddr = address
Log.i("[Account] Set proxyConfig server address to ${account.params.serverAddr} for proxyConfig with domain ${account.params.domain}")
} }
if (pushGateway() != null) if (pushGateway() != null)
linkProxiesWithPushGateway(pushReady) linkProxiesWithPushGateway(pushReady)
else else
createPushGateway(pushReady) createPushGateway(pushReady)
} }
} }
fun pushGateway(): ProxyConfig? { fun pushGateway(): ProxyConfig? {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment