add userid +upnp settings
This commit is contained in:
parent
8df7ffb90e
commit
82905401fd
10 changed files with 74 additions and 13 deletions
|
@ -36,6 +36,7 @@
|
|||
<bool name="pref_wifi_only_default">false</bool>
|
||||
<string name="default_stun">stun.linphone.org</string>
|
||||
<bool name="pref_ice_enabled_default">false</bool>
|
||||
<bool name="pref_upnp_enabled_default">false</bool>
|
||||
<bool name="pref_transport_use_random_ports_default">true</bool>
|
||||
<string name="pref_sip_port_default">5060</string>
|
||||
<string name="pref_transport_default">@string/pref_transport_udp_key</string>
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
<string name="pref_domain_key">pref_domain_key</string>
|
||||
<string name="pref_passwd_key">pref_passwd_key</string>
|
||||
<string name="pref_username_key">pref_username_key</string>
|
||||
<string name="pref_auth_userid_key">pref_auth_userid_key</string>
|
||||
<string name="pref_wizard_key">pref_wizard_key</string>
|
||||
<string name="pref_activated_key">pref_activated_key</string>
|
||||
<string name="pref_debug_key">pref_debug_key</string>
|
||||
|
@ -112,4 +113,5 @@
|
|||
|
||||
<string name="pref_rfc2833_dtmf_key">pref_rfc2833_dtmf_key</string>
|
||||
<string name="pref_sipinfo_dtmf_key">pref_sipinfo_dtmf_key</string>
|
||||
<string name="pref_upnp_enable_key">pref_upnp_enable_key</string>
|
||||
</resources>
|
||||
|
|
|
@ -422,4 +422,10 @@
|
|||
<string name="call_state_incoming">Incoming</string>
|
||||
|
||||
<string name="pref_background_mode">Background mode</string>
|
||||
|
||||
<string name="pref_auth_userid">Auth userid*</string>
|
||||
|
||||
<string name="pref_help_auth_userid">Enter authentication userid (optionnal)</string>
|
||||
|
||||
<string name="pref_upnp_enable">Enable UPNP</string>
|
||||
</resources>
|
||||
|
|
|
@ -7,6 +7,9 @@
|
|||
<EditTextPreference
|
||||
android:title="@string/pref_username"
|
||||
android:dialogMessage="@string/pref_help_username"
|
||||
android:persistent="true"/><EditTextPreference
|
||||
android:title="@string/pref_auth_userid"
|
||||
android:dialogMessage="@string/pref_help_auth_userid"
|
||||
android:persistent="true"/>
|
||||
|
||||
<EditTextPreference
|
||||
|
|
|
@ -226,7 +226,10 @@
|
|||
<CheckBoxPreference
|
||||
android:title="@string/pref_ice_enable"
|
||||
android:key="@string/pref_ice_enable_key"
|
||||
android:defaultValue="@bool/pref_ice_enabled_default"/>
|
||||
android:defaultValue="@bool/pref_ice_enabled_default"/><CheckBoxPreference
|
||||
android:title="@string/pref_upnp_enable"
|
||||
android:key="@string/pref_upnp_enable_key"
|
||||
android:defaultValue="@bool/pref_upnp_enabled_default"/>
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/pref_transport_use_random_ports_key"
|
||||
|
|
|
@ -71,12 +71,19 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
|
|||
username.setOnPreferenceChangeListener(preferenceChangedListener);
|
||||
username.setSummary(username.getText());
|
||||
|
||||
EditTextPreference password = (EditTextPreference) account.getPreference(1);
|
||||
EditTextPreference userid = (EditTextPreference) account.getPreference(1);
|
||||
userid.setText(prefs.getString(getString(R.string.pref_auth_userid_key) + key, ""));
|
||||
userid.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
|
||||
userid.setKey(getString(R.string.pref_auth_userid_key) + key);
|
||||
userid.setOnPreferenceChangeListener(preferenceChangedListener);
|
||||
userid.setSummary(userid.getText());
|
||||
|
||||
EditTextPreference password = (EditTextPreference) account.getPreference(2);
|
||||
password.setText(prefs.getString(getString(R.string.pref_passwd_key) + key, ""));
|
||||
password.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||
password.setKey(getString(R.string.pref_passwd_key) + key);
|
||||
|
||||
EditTextPreference domain = (EditTextPreference) account.getPreference(2);
|
||||
EditTextPreference domain = (EditTextPreference) account.getPreference(3);
|
||||
domain.setText(prefs.getString(getString(R.string.pref_domain_key) + key, ""));
|
||||
domain.getEditText().setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
|
||||
domain.setKey(getString(R.string.pref_domain_key) + key);
|
||||
|
@ -109,6 +116,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
|
|||
|
||||
for (int i = n; i < nbAccounts - 1; i++) {
|
||||
editor.putString(getString(R.string.pref_username_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_username_key) + getAccountNumber(i+1), null));
|
||||
editor.putString(getString(R.string.pref_auth_userid_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_auth_userid_key) + getAccountNumber(i+1), null));
|
||||
editor.putString(getString(R.string.pref_passwd_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_passwd_key) + getAccountNumber(i+1), null));
|
||||
editor.putString(getString(R.string.pref_domain_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_domain_key) + getAccountNumber(i+1), null));
|
||||
editor.putString(getString(R.string.pref_proxy_key) + getAccountNumber(i), prefs.getString(getString(R.string.pref_proxy_key) + getAccountNumber(i+1), null));
|
||||
|
@ -118,6 +126,7 @@ public class AccountPreferencesFragment extends PreferencesListFragment {
|
|||
|
||||
int lastAccount = nbAccounts - 1;
|
||||
editor.putString(getString(R.string.pref_username_key) + getAccountNumber(lastAccount), null);
|
||||
editor.putString(getString(R.string.pref_auth_userid_key) + getAccountNumber(lastAccount), null);
|
||||
editor.putString(getString(R.string.pref_passwd_key) + getAccountNumber(lastAccount), null);
|
||||
editor.putString(getString(R.string.pref_domain_key) + getAccountNumber(lastAccount), null);
|
||||
editor.putString(getString(R.string.pref_proxy_key) + getAccountNumber(lastAccount), null);
|
||||
|
|
|
@ -534,7 +534,11 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
} catch (LinphoneException e) {
|
||||
Log.w("no config ready yet");
|
||||
}
|
||||
|
||||
boolean routeToBT = mServiceContext.getResources().getBoolean(R.bool.route_audio_to_bluetooth_if_available);
|
||||
if (routeToBT) {
|
||||
startBluetooth();
|
||||
}
|
||||
|
||||
TimerTask lTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
@ -547,10 +551,7 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
lFilter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
mServiceContext.registerReceiver(mKeepAliveReceiver, lFilter);
|
||||
|
||||
boolean routeToBT = mServiceContext.getResources().getBoolean(R.bool.route_audio_to_bluetooth_if_available);
|
||||
if (routeToBT) {
|
||||
startBluetooth();
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.e(e, "Cannot start linphone");
|
||||
|
@ -648,10 +649,15 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
private void initAccount(String key, boolean defaultAccount) throws LinphoneCoreException {
|
||||
String username = getPrefString(getString(R.string.pref_username_key) + key, null);
|
||||
String userid = getPrefString(getString(R.string.pref_auth_userid_key) + key, null);
|
||||
String password = getPrefString(getString(R.string.pref_passwd_key) + key, null);
|
||||
String domain = getPrefString(getString(R.string.pref_domain_key) + key, null);
|
||||
if (username != null && username.length() > 0 && password != null) {
|
||||
LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username, password, null);
|
||||
LinphoneAuthInfo lAuthInfo = LinphoneCoreFactory.instance().createAuthInfo(username
|
||||
, userid
|
||||
, password
|
||||
, null
|
||||
,null);
|
||||
mLc.addAuthInfo(lAuthInfo);
|
||||
|
||||
if (domain != null && domain.length() > 0) {
|
||||
|
@ -812,9 +818,16 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
//stun server
|
||||
String lStun = getPrefString(R.string.pref_stun_server_key, getString(R.string.default_stun));
|
||||
boolean useICE = getPrefBoolean(R.string.pref_ice_enable_key, mR.getBoolean(R.bool.pref_ice_enabled_default));
|
||||
boolean useUpnp = getPrefBoolean(R.string.pref_upnp_enable_key, mR.getBoolean(R.bool.pref_upnp_enabled_default));
|
||||
|
||||
mLc.setStunServer(lStun);
|
||||
if (lStun!=null && lStun.length()>0) {
|
||||
mLc.setFirewallPolicy(useICE ? FirewallPolicy.UseIce : FirewallPolicy.UseStun);
|
||||
if (lStun!=null && lStun.length()>0 && useICE) {
|
||||
mLc.setFirewallPolicy(FirewallPolicy.UseIce);
|
||||
if (useUpnp) Log.e("Cannot have both ice and upnp enabled, disabling upnp");
|
||||
} if (useUpnp) {
|
||||
mLc.setFirewallPolicy(FirewallPolicy.UseUpnp);
|
||||
} else if (lStun!=null && lStun.length()>0){
|
||||
mLc.setFirewallPolicy(FirewallPolicy.UseStun);
|
||||
} else {
|
||||
mLc.setFirewallPolicy(FirewallPolicy.NoFirewall);
|
||||
}
|
||||
|
|
|
@ -247,6 +247,30 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
|
|||
}
|
||||
});
|
||||
|
||||
final CheckBoxPreference useIce = (CheckBoxPreference) findPreference(R.string.pref_ice_enable_key);
|
||||
final CheckBoxPreference useUpnp = (CheckBoxPreference) findPreference(R.string.pref_upnp_enable_key);
|
||||
|
||||
useIce.setEnabled(!useUpnp.isChecked());
|
||||
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
|
||||
useUpnp.setEnabled(lc.upnpAvailable() && !useIce.isChecked());
|
||||
|
||||
useIce.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean isChecked = (Boolean) newValue;
|
||||
useUpnp.setEnabled(!isChecked);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
useUpnp.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
boolean isChecked = (Boolean) newValue;
|
||||
useIce.setEnabled(!isChecked);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (getResources().getBoolean(R.bool.disable_every_log)) {
|
||||
uncheckDisableAndHideCheckbox(R.string.pref_debug_key);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 6b058ba830644578da70c9bb85a41acdb06c03dd
|
||||
Subproject commit 3b347644ce220d97b08112a9fd835194c64000e5
|
|
@ -1 +1 @@
|
|||
Subproject commit 9d3f8f7d94080f4dd293bca53b4bcf9afac88d78
|
||||
Subproject commit 018fbdb7f1dbb634eb99c01c6fa9cc663147dae8
|
Loading…
Reference in a new issue