Fix bug #1393
Make the application manipulating tunnels only through the methods of LinphoneCore. The application does not manage the configuration storage process excepted for the tunnel mode which is not provide by the liblinphone.
This commit is contained in:
parent
5ac6dabc6d
commit
138fdfe9f3
4 changed files with 61 additions and 25 deletions
|
@ -70,6 +70,7 @@ import org.linphone.core.PresenceActivityType;
|
||||||
import org.linphone.core.PresenceModel;
|
import org.linphone.core.PresenceModel;
|
||||||
import org.linphone.core.PublishState;
|
import org.linphone.core.PublishState;
|
||||||
import org.linphone.core.SubscriptionState;
|
import org.linphone.core.SubscriptionState;
|
||||||
|
import org.linphone.core.TunnelConfig;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
|
@ -418,10 +419,9 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
|
|
||||||
NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
|
NetworkInfo info = mConnectivityManager.getActiveNetworkInfo();
|
||||||
mLc.tunnelCleanServers();
|
mLc.tunnelCleanServers();
|
||||||
String host = mPrefs.getTunnelHost();
|
TunnelConfig config = mPrefs.getTunnelConfig();
|
||||||
if (host != null) {
|
if (config.getHost() != null) {
|
||||||
int port = mPrefs.getTunnelPort();
|
mLc.tunnelAddServer(config);
|
||||||
mLc.tunnelAddServerAndMirror(host, port, 12345, 500);
|
|
||||||
manageTunnelServer(info);
|
manageTunnelServer(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -537,8 +537,6 @@ public class LinphoneManager implements LinphoneCoreListener {
|
||||||
Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
|
Log.w("MediaStreamer : " + availableCores + " cores detected and configured");
|
||||||
mLc.setCpuCount(availableCores);
|
mLc.setCpuCount(availableCores);
|
||||||
|
|
||||||
initTunnelFromConf();
|
|
||||||
|
|
||||||
int migrationResult = getLc().migrateToMultiTransport();
|
int migrationResult = getLc().migrateToMultiTransport();
|
||||||
Log.d("Migration to multi transport result = " + migrationResult);
|
Log.d("Migration to multi transport result = " + migrationResult);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
import org.linphone.core.LpConfig;
|
import org.linphone.core.LpConfig;
|
||||||
|
import org.linphone.core.TunnelConfig;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
@ -1014,6 +1015,59 @@ public class LinphonePreferences {
|
||||||
// End of advanced settings
|
// End of advanced settings
|
||||||
|
|
||||||
// Tunnel settings
|
// Tunnel settings
|
||||||
|
private TunnelConfig tunnelConfig = null;
|
||||||
|
|
||||||
|
public TunnelConfig getTunnelConfig() {
|
||||||
|
if(getLc().isTunnelAvailable()) {
|
||||||
|
if(tunnelConfig == null) {
|
||||||
|
TunnelConfig servers[] = getLc().tunnelGetServers();
|
||||||
|
if(servers.length > 0) {
|
||||||
|
tunnelConfig = servers[0];
|
||||||
|
} else {
|
||||||
|
tunnelConfig = new TunnelConfig();
|
||||||
|
tunnelConfig.setDelay(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tunnelConfig;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTunnelHost() {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if(config != null) {
|
||||||
|
return config.getHost();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTunnelHost(String host) {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if(config != null) {
|
||||||
|
config.setHost(host);
|
||||||
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTunnelPort() {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if(config != null) {
|
||||||
|
return config.getPort();
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTunnelPort(int port) {
|
||||||
|
TunnelConfig config = getTunnelConfig();
|
||||||
|
if(config != null) {
|
||||||
|
config.setPort(port);
|
||||||
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getTunnelMode() {
|
public String getTunnelMode() {
|
||||||
return getConfig().getString("app", "tunnel", null);
|
return getConfig().getString("app", "tunnel", null);
|
||||||
}
|
}
|
||||||
|
@ -1022,24 +1076,6 @@ public class LinphonePreferences {
|
||||||
getConfig().setString("app", "tunnel", mode);
|
getConfig().setString("app", "tunnel", mode);
|
||||||
LinphoneManager.getInstance().initTunnelFromConf();
|
LinphoneManager.getInstance().initTunnelFromConf();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTunnelHost() {
|
|
||||||
return getConfig().getString("tunnel", "host", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTunnelHost(String host) {
|
|
||||||
getConfig().setString("tunnel", "host", host);
|
|
||||||
LinphoneManager.getInstance().initTunnelFromConf();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getTunnelPort() {
|
|
||||||
return getConfig().getInt("tunnel", "port", 443);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTunnelPort(int port) {
|
|
||||||
getConfig().setInt("tunnel", "port", port);
|
|
||||||
LinphoneManager.getInstance().initTunnelFromConf();
|
|
||||||
}
|
|
||||||
// End of tunnel settings
|
// End of tunnel settings
|
||||||
|
|
||||||
public boolean isProvisioningLoginViewEnabled() {
|
public boolean isProvisioningLoginViewEnabled() {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.linphone.core.LinphoneCoreException;
|
||||||
import org.linphone.core.LinphoneCoreFactory;
|
import org.linphone.core.LinphoneCoreFactory;
|
||||||
import org.linphone.core.LinphoneProxyConfig;
|
import org.linphone.core.LinphoneProxyConfig;
|
||||||
import org.linphone.core.PayloadType;
|
import org.linphone.core.PayloadType;
|
||||||
|
import org.linphone.core.TunnelConfig;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.Version;
|
import org.linphone.mediastream.Version;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
|
@ -57,6 +58,7 @@ public class SettingsFragment extends PreferencesListFragment implements EcCalib
|
||||||
private static final int WIZARD_INTENT = 1;
|
private static final int WIZARD_INTENT = 1;
|
||||||
private LinphonePreferences mPrefs;
|
private LinphonePreferences mPrefs;
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
|
private TunnelConfig tunnelConfig;
|
||||||
|
|
||||||
public SettingsFragment() {
|
public SettingsFragment() {
|
||||||
super(R.xml.preferences);
|
super(R.xml.preferences);
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 5b17d4d473c4fb0a648b4d5cea98cb1bde2e2894
|
Subproject commit c3575589c123feddde3021699b2cfe446573cc93
|
Loading…
Reference in a new issue