#16114: Add account creation action when leaving AccountCreationActivity
diff --git a/res/xml/account_creation_preferences.xml b/res/xml/account_creation_preferences.xml
index 3634267..101dd6f 100644
--- a/res/xml/account_creation_preferences.xml
+++ b/res/xml/account_creation_preferences.xml
@@ -39,7 +39,7 @@
android:persistent="false"
android:defaultValue="SIP"
android:title="Type"
- android:summary="Current value:: "/>
+ android:summary="Current value:: SIP"/>
<EditTextPreference
android:id="@+id/account_creation_alias"
android:key="Account.alias"
@@ -53,7 +53,7 @@
android:persistent="false"
android:defaultValue="enabled"
android:title="Account enabled"
- android:summary="Current value:: "/>
+ android:summary="Current value:: enabled"/>
<EditTextPreference
android:id="@+id/account_creation_hostname"
android:key="Account.hostname"
@@ -225,7 +225,7 @@
android:persistent="false"
android:defaultValue="SFLPhone"
android:title="Display Name"
- android:summary="Current value:: "/>
+ android:summary="Current value:: SFLPhone"/>
<EditTextPreference
android:id="@+id/account_creation_stun_server"
android:key="STUN.server"
@@ -240,6 +240,10 @@
android:defaultValue="disabled"
android:title="Stun Enabled"
android:summary="Current value:: "/>
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:id="@+id/account_srtp_category"
+ android:title="SRTP settings">
<EditTextPreference
android:id="@+id/account_creation_srtp_enable"
android:key="SRTP.enable"
@@ -260,7 +264,7 @@
android:persistent="false"
android:defaultValue="disabled"
android:title="SRTP Encrypt Algo"
- android:summary="Current value:: "/>
+ android:summary="Current value:: disabled"/>
<EditTextPreference
android:id="@+id/account_creation_srtp_rtp_fallback"
android:key="SRTP.rtpFallback"
@@ -296,6 +300,10 @@
android:defaultValue="disabled"
android:title="ZRTP Display SAS Once"
android:summary="Current value:: disabled"/>
+ </PreferenceCategory>
+ <PreferenceCategory
+ android:id="@+id/account_tls_category"
+ android:title="TLS settings">
<EditTextPreference
android:id="@+id/account_creation_tls_listener_port"
android:key="TLS.listenerPort"
@@ -365,7 +373,7 @@
android:persistent="false"
android:defaultValue="disabled"
android:title="TLS Verify Server"
- android:summary="Current value:: "/>
+ android:summary="Current value:: disabled"/>
<EditTextPreference
android:id="@+id/account_creation_tls_verify_client"
android:key="TLS.verifyClient"
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
index a46dc8d..ed88388 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountCreationActivity.java
@@ -32,6 +32,8 @@
package com.savoirfairelinux.sflphone.client;
import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
import android.content.ServiceConnection;
import android.os.Bundle;
import android.os.IBinder;
@@ -46,9 +48,15 @@
import com.savoirfairelinux.sflphone.service.SipService;
import com.savoirfairelinux.sflphone.service.ISipService;
import com.savoirfairelinux.sflphone.utils.AccountDetailsHandler;
+import com.savoirfairelinux.sflphone.utils.AccountDetailBasic;
+import com.savoirfairelinux.sflphone.utils.AccountDetailAdvanced;
+import com.savoirfairelinux.sflphone.utils.AccountDetailSrtp;
+import com.savoirfairelinux.sflphone.utils.AccountDetailTls;
-import java.util.ArrayList;
+//import java.util.ArrayList;
+import java.util.EnumSet;
import java.util.HashMap;
+import java.util.Set;
public class AccountCreationActivity extends PreferenceActivity
{
@@ -56,9 +64,15 @@
private ISipService service;
private boolean mBound = false;
private PreferenceManager mPreferenceManager = null;
+ private AccountDetailBasic basicDetails;
+ private AccountDetailAdvanced advancedDetails;
+ private AccountDetailSrtp srtpDetails;
+ private AccountDetailTls tlsDetails;
Preference.OnPreferenceChangeListener changeNewAccountPreferenceListener = new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
+
+ ((EditTextPreference)preference).setText(((CharSequence) newValue).toString());
preference.setSummary(getString(R.string.account_current_value_label) + (CharSequence)newValue);
return true;
}
@@ -79,6 +93,14 @@
}
};
+ public AccountCreationActivity()
+ {
+ basicDetails = new AccountDetailBasic();
+ advancedDetails = new AccountDetailAdvanced();
+ srtpDetails = new AccountDetailSrtp();
+ tlsDetails = new AccountDetailTls();
+ }
+
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -91,41 +113,111 @@
@Override
protected void onStart() {
super.onStart();
- ArrayList<String> preferenceKey = new ArrayList<String>();
- preferenceKey.add("AccountAlias");
- preferenceKey.add("AccountUserName");
- preferenceKey.add("AccountHostname");
- preferenceKey.add("AccountPassword");
- preferenceKey.add("AccountRealm");
- preferenceKey.add("AccountUserAgent");
- preferenceKey.add("AccountAutoAnswer");
- for(String s : preferenceKey) {
+ for(String s : basicDetails.getDetailKeys()) {
EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
- pref.setOnPreferenceChangeListener(changeNewAccountPreferenceListener);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s);
+ pref.setOnPreferenceChangeListener(changeNewAccountPreferenceListener);
+ }
+ }
+
+ for(String s : advancedDetails.getDetailKeys()) {
+ EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s);
+ pref.setOnPreferenceChangeListener(changeNewAccountPreferenceListener);
+ }
+ }
+
+ for(String s : srtpDetails.getDetailKeys()) {
+ EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s);
+ pref.setOnPreferenceChangeListener(changeNewAccountPreferenceListener);
+ }
+ }
+
+ for(String s : tlsDetails.getDetailKeys()) {
+ EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s);
+ pref.setOnPreferenceChangeListener(changeNewAccountPreferenceListener);
+ }
+ }
+
+ if(!mBound) {
+ Log.i(TAG, "onStart: Binding service...");
+ Intent intent = new Intent(this, SipService.class);
+ bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
}
}
@Override
protected void onStop() {
super.onStop();
-
HashMap<String, String> accountDetails = new HashMap<String, String>();
+/*
+ EditTextPreference accountAliasPref = (EditTextPreference) mPreferenceManager.findPreference("Account.alias");
+ EditTextPreference accountUsername = (EditTextPreference) mPreferenceManager.findPreference("Account.username");
+ EditTextPreference accountHostname = (EditTextPreference) mPreferenceManager.findPreference("Account.hostname");
+ EditTextPreference accountPassword = (EditTextPreference) mPreferenceManager.findPreference("Account.password");
+ EditTextPreference accountRoutset = (EditTextPreference) mPreferenceManager.findPreference("Account.realm");
+ EditTextPreference accountUseragent = (EditTextPreference) mPreferenceManager.findPreference("Account.useragent");
+ EditTextPreference accountAutoAnswer = (EditTextPreference) mPreferenceManager.findPreference("Account.autoAnswer");
- EditTextPreference accountAliasPref = (EditTextPreference) mPreferenceManager.findPreference("AccountAlias");
- EditTextPreference accountUsername = (EditTextPreference) mPreferenceManager.findPreference("AccountUserName");
- EditTextPreference accountHostname = (EditTextPreference) mPreferenceManager.findPreference("AccountHostname");
- EditTextPreference accountPassword = (EditTextPreference) mPreferenceManager.findPreference("AccountPassword");
- EditTextPreference accountRoutset = (EditTextPreference) mPreferenceManager.findPreference("AccountRealm");
- EditTextPreference accountUseragent = (EditTextPreference) mPreferenceManager.findPreference("AccountUserAgent");
- EditTextPreference accountAutoAnswer = (EditTextPreference) mPreferenceManager.findPreference("AccountAutoAnswer");
+ accountDetails.put("Account.alias", accountAliasPref.getText());
+ accountDetails.put("Account.username", accountUsername.getText());
+ accountDetails.put("Account.hostname", accountHostname.getText());
+ accountDetails.put("Account.password", accountPassword.getText());
+ accountDetails.put("Account.realm", accountRoutset.getText());
+ accountDetails.put("Account.useragent", accountUseragent.getText());
+ accountDetails.put("Account.autoanswer", accountAutoAnswer.getText());
+*/
- /*
+ for(String s : basicDetails.getDetailKeys()) {
+ EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s + " " + pref.getText());
+ accountDetails.put(s, pref.getText());
+ }
+ }
+
+ for(String s : advancedDetails.getDetailKeys()) {
+ EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s + " " + pref.getText());
+ accountDetails.put(s, pref.getText());
+ }
+ }
+
+ for(String s : srtpDetails.getDetailKeys()) {
+ EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s + " " + pref.getText());
+ accountDetails.put(s, pref.getText());
+ }
+ }
+
+ for(String s : tlsDetails.getDetailKeys()) {
+ EditTextPreference pref = (EditTextPreference) mPreferenceManager.findPreference(s);
+ if(pref != null) {
+ Log.i(TAG, "FOUND " + s + " " + pref.getText());
+ accountDetails.put(s, pref.getText());
+ }
+ }
+
try {
+ Log.i(TAG, "ADD ACCOUNT");
service.addAccount(accountDetails);
} catch (RemoteException e) {
Log.e(TAG, "Cannot call service method", e);
}
- */
+
+ if(mBound) {
+ Log.i(TAG, "onStop: Unbinding service...");
+ unbindService(mConnection);
+ mBound = false;
+ }
}
}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
new file mode 100644
index 0000000..8934a90
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetail.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * If you own a pjsip commercial license you can also redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public License
+ * as an android library.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.savoirfairelinux.sflphone.utils;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.service.ISipService;
+import com.savoirfairelinux.sflphone.service.ServiceConstants;
+import com.savoirfairelinux.sflphone.service.StringMap;
+
+import java.util.Collection;
+import java.util.Set;
+
+public interface AccountDetail {
+
+ public static class PreferenceEntry
+ {
+ public String mKey;
+ public int mLabelId;
+
+ public PreferenceEntry(String key, int labelId)
+ {
+ mKey = key;
+ mLabelId = labelId;
+ }
+ }
+
+ public Set<String> getDetailKeys();
+
+ public Collection<PreferenceEntry> getDetailValues();
+}
+
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java
new file mode 100644
index 0000000..b8cee46
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailAdvanced.java
@@ -0,0 +1,117 @@
+/**
+ * Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * If you own a pjsip commercial license you can also redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public License
+ * as an android library.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.savoirfairelinux.sflphone.utils;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.utils.AccountDetail;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashMap;
+
+public class AccountDetailAdvanced implements AccountDetail {
+
+ public static final String CONFIG_ACCOUNT_MAILBOX = "Account.mailbox";
+ public static final String CONFIG_ACCOUNT_REGISTRATION_EXPIRE = "Account.registrationExpire";
+ public static final String CONFIG_ACCOUNT_REGISTRATION_STATUS = "Account.registrationStatus";
+ public static final String CONFIG_ACCOUNT_REGISTRATION_STATE_CODE = "Account.registrationCode";
+ public static final String CONFIG_ACCOUNT_REGISTRATION_STATE_DESC = "Account.registrationDescription";
+ public static final String CONFIG_CREDENTIAL_NUMBER = "Credential.count";
+ public static final String CONFIG_ACCOUNT_DTMF_TYPE = "Account.dtmfType";
+ public static final String CONFIG_RINGTONE_PATH = "Account.ringtonePath";
+ public static final String CONFIG_RINGTONE_ENABLED = "Account.ringtoneEnabled";
+ public static final String CONFIG_KEEP_ALIVE_ENABLED = "Account.keepAliveEnabled";
+
+ public static final String CONFIG_ACCOUNT_AUTOANSWER = "Account.autoAnswer";
+ public static final String CONFIG_LOCAL_INTERFACE = "Account.localInterface";
+ public static final String CONFIG_INTERFACE = "Account.interface";
+ public static final String CONFIG_PUBLISHED_SAMEAS_LOCAL = "Account.publishedSameAsLocal";
+ public static final String CONFIG_LOCAL_PORT = "Account.localPort";
+ public static final String CONFIG_PUBLISHED_PORT = "Account.publishedPort";
+ public static final String CONFIG_PUBLISHED_ADDRESS = "Account.publishedAddress";
+ public static final String CONFIG_DEFAULT_LOCAL_PORT = "5060";
+ public static final String CONFIG_DEFAULT_PUBLISHED_PORT = "5060";
+ public static final String CONFIG_DEFAULT_PUBLISHED_SAMEAS_LOCAL = "true";
+ public static final String CONFIG_DEFAULT_INTERFACE = "default";
+
+ public static final String CONFIG_DISPLAY_NAME = "Account.displayName";
+ public static final String CONFIG_DEFAULT_ADDRESS = "0.0.0.0";
+
+ public static final String CONFIG_STUN_SERVER = "STUN.server";
+ public static final String CONFIG_STUN_ENABLE = "STUN.enable";
+
+ private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
+
+ public AccountDetailAdvanced()
+ {
+ privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
+
+ privateMap.put(CONFIG_ACCOUNT_REGISTRATION_EXPIRE,
+ new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_EXPIRE, R.string.account_registration_exp_label));
+ privateMap.put(CONFIG_ACCOUNT_REGISTRATION_STATUS,
+ new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_STATUS, R.string.account_registration_status_label));
+ privateMap.put(CONFIG_ACCOUNT_REGISTRATION_STATE_CODE,
+ new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, R.string.account_registration_code_label));
+ privateMap.put(CONFIG_ACCOUNT_REGISTRATION_STATE_DESC,
+ new PreferenceEntry(CONFIG_ACCOUNT_REGISTRATION_STATE_DESC, R.string.account_registration_state_label));
+ privateMap.put(CONFIG_CREDENTIAL_NUMBER,
+ new PreferenceEntry(CONFIG_CREDENTIAL_NUMBER, R.string.account_credential_count_label));
+ privateMap.put(CONFIG_ACCOUNT_DTMF_TYPE,
+ new PreferenceEntry(CONFIG_ACCOUNT_DTMF_TYPE, R.string.account_config_dtmf_type_label));
+ privateMap.put(CONFIG_RINGTONE_PATH,
+ new PreferenceEntry(CONFIG_RINGTONE_PATH, R.string.account_ringtone_path_label));
+ privateMap.put(CONFIG_RINGTONE_ENABLED,
+ new PreferenceEntry(CONFIG_RINGTONE_ENABLED, R.string.account_ringtone_enabled_label));
+ privateMap.put(CONFIG_KEEP_ALIVE_ENABLED,
+ new PreferenceEntry(CONFIG_KEEP_ALIVE_ENABLED, R.string.account_keep_alive_label));
+ privateMap.put(CONFIG_ACCOUNT_AUTOANSWER,
+ new PreferenceEntry(CONFIG_ACCOUNT_AUTOANSWER, R.string.account_account_interface_label));
+ privateMap.put(CONFIG_LOCAL_INTERFACE,
+ new PreferenceEntry(CONFIG_LOCAL_INTERFACE, R.string.account_local_interface_label));
+ privateMap.put(CONFIG_INTERFACE,
+ new PreferenceEntry(CONFIG_INTERFACE, R.string.account_account_interface_label));
+ privateMap.put(CONFIG_PUBLISHED_SAMEAS_LOCAL,
+ new PreferenceEntry(CONFIG_PUBLISHED_SAMEAS_LOCAL, R.string.account_published_same_as_local_label));
+ privateMap.put(CONFIG_LOCAL_PORT,
+ new PreferenceEntry(CONFIG_LOCAL_PORT, R.string.account_local_port_label));
+ privateMap.put(CONFIG_PUBLISHED_PORT,
+ new PreferenceEntry(CONFIG_PUBLISHED_PORT, R.string.account_published_port_label));
+ privateMap.put(CONFIG_PUBLISHED_ADDRESS,
+ new PreferenceEntry(CONFIG_PUBLISHED_ADDRESS, R.string.account_published_address_label));
+ privateMap.put(CONFIG_DISPLAY_NAME,
+ new PreferenceEntry(CONFIG_DISPLAY_NAME, R.string.account_displayname_label));
+ privateMap.put(CONFIG_STUN_SERVER,
+ new PreferenceEntry(CONFIG_STUN_SERVER, R.string.account_stun_server_label));
+ privateMap.put(CONFIG_STUN_ENABLE,
+ new PreferenceEntry(CONFIG_STUN_ENABLE, R.string.account_stun_enable_label));
+ }
+
+ public Set<String> getDetailKeys()
+ {
+ return privateMap.keySet();
+ }
+
+ public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateMap.values();
+ }
+}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
new file mode 100644
index 0000000..161fff1
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailBasic.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * If you own a pjsip commercial license you can also redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public License
+ * as an android library.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.savoirfairelinux.sflphone.utils;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.utils.AccountDetail;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashMap;
+
+public class AccountDetailBasic implements AccountDetail {
+
+ public static final String CONFIG_ACCOUNT_TYPE = "Account.type";
+ public static final String CONFIG_ACCOUNT_ALIAS = "Account.alias";
+ public static final String CONFIG_ACCOUNT_ENABLE = "Account.enable";
+ public static final String CONFIG_ACCOUNT_HOSTNAME = "Account.hostname";
+ public static final String CONFIG_ACCOUNT_USERNAME = "Account.username";
+ public static final String CONFIG_ACCOUNT_ROUTESET = "Account.routeset";
+ public static final String CONFIG_ACCOUNT_PASSWORD = "Account.password";
+ public static final String CONFIG_ACCOUNT_REALM = "Account.realm";
+ public static final String CONFIG_ACCOUNT_DEFAULT_REALM = "*";
+ public static final String CONFIG_ACCOUNT_USERAGENT = "Account.useragent";
+
+ private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
+
+ public AccountDetailBasic()
+ {
+ privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
+
+ privateMap.put(CONFIG_ACCOUNT_TYPE,
+ new PreferenceEntry(CONFIG_ACCOUNT_TYPE, R.string.account_type_label));
+ privateMap.put(CONFIG_ACCOUNT_ALIAS,
+ new PreferenceEntry(CONFIG_ACCOUNT_ALIAS, R.string.account_alias_label));
+ privateMap.put(CONFIG_ACCOUNT_ENABLE,
+ new PreferenceEntry(CONFIG_ACCOUNT_ENABLE, R.string.account_enabled_label));
+ privateMap.put(CONFIG_ACCOUNT_HOSTNAME,
+ new PreferenceEntry(CONFIG_ACCOUNT_HOSTNAME, R.string.account_hostname_label));
+ privateMap.put(CONFIG_ACCOUNT_USERNAME,
+ new PreferenceEntry(CONFIG_ACCOUNT_USERNAME, R.string.account_username_label));
+ privateMap.put(CONFIG_ACCOUNT_ROUTESET,
+ new PreferenceEntry(CONFIG_ACCOUNT_ROUTESET, R.string.account_routeset_label));
+ privateMap.put(CONFIG_ACCOUNT_PASSWORD,
+ new PreferenceEntry(CONFIG_ACCOUNT_PASSWORD, R.string.account_password_label));
+ privateMap.put(CONFIG_ACCOUNT_REALM,
+ new PreferenceEntry(CONFIG_ACCOUNT_REALM, R.string.account_realm_label));
+ privateMap.put(CONFIG_ACCOUNT_DEFAULT_REALM,
+ new PreferenceEntry(CONFIG_ACCOUNT_DEFAULT_REALM, R.string.account_useragent_label));
+ privateMap.put(CONFIG_ACCOUNT_USERAGENT,
+ new PreferenceEntry(CONFIG_ACCOUNT_USERAGENT, R.string.account_autoanswer_label));
+ }
+
+ public Set<String> getDetailKeys()
+ {
+ return privateMap.keySet();
+ }
+
+ public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateMap.values();
+ }
+}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java
new file mode 100644
index 0000000..b3446f7
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailSrtp.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * If you own a pjsip commercial license you can also redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public License
+ * as an android library.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.savoirfairelinux.sflphone.utils;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.utils.AccountDetail;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashMap;
+
+public class AccountDetailSrtp implements AccountDetail{
+
+ public static final String CONFIG_SRTP_ENABLE = "SRTP.enable";
+ public static final String CONFIG_SRTP_KEY_EXCHANGE = "SRTP.keyExchange";
+ public static final String CONFIG_SRTP_ENCRYPTION_ALGO = "SRTP.encryptionAlgorithm"; // Provided by ccRTP,0=NULL,1=AESCM,2=AESF8
+ public static final String CONFIG_SRTP_RTP_FALLBACK = "SRTP.rtpFallback";
+ public static final String CONFIG_ZRTP_HELLO_HASH = "ZRTP.helloHashEnable";
+ public static final String CONFIG_ZRTP_DISPLAY_SAS = "ZRTP.displaySAS";
+ public static final String CONFIG_ZRTP_NOT_SUPP_WARNING = "ZRTP.notSuppWarning";
+ public static final String CONFIG_ZRTP_DISPLAY_SAS_ONCE = "ZRTP.displaySasOnce";
+
+ private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
+
+ public AccountDetailSrtp()
+ {
+ privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
+
+ privateMap.put(CONFIG_SRTP_ENABLE,
+ new PreferenceEntry(CONFIG_SRTP_ENABLE, R.string.account_srtp_enabled_label));
+ privateMap.put(CONFIG_SRTP_KEY_EXCHANGE,
+ new PreferenceEntry(CONFIG_SRTP_KEY_EXCHANGE, R.string.account_srtp_exchange_label));
+ privateMap.put(CONFIG_SRTP_ENCRYPTION_ALGO,
+ new PreferenceEntry(CONFIG_SRTP_ENCRYPTION_ALGO, R.string.account_encryption_algo_label));
+ privateMap.put(CONFIG_SRTP_RTP_FALLBACK,
+ new PreferenceEntry(CONFIG_SRTP_RTP_FALLBACK, R.string.account_srtp_fallback_label));
+ privateMap.put(CONFIG_ZRTP_HELLO_HASH,
+ new PreferenceEntry(CONFIG_ZRTP_HELLO_HASH, R.string.account_hello_hash_enable_label));
+ privateMap.put(CONFIG_ZRTP_DISPLAY_SAS,
+ new PreferenceEntry(CONFIG_ZRTP_DISPLAY_SAS, R.string.account_display_sas_label));
+ privateMap.put(CONFIG_ZRTP_NOT_SUPP_WARNING,
+ new PreferenceEntry(CONFIG_ZRTP_NOT_SUPP_WARNING, R.string.account_not_supported_warning_label));
+ privateMap.put(CONFIG_ZRTP_DISPLAY_SAS_ONCE,
+ new PreferenceEntry(CONFIG_ZRTP_DISPLAY_SAS_ONCE, R.string.account_display_sas_once_label));
+ }
+
+ public Set<String> getDetailKeys()
+ {
+ return privateMap.keySet();
+ }
+
+ public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateMap.values();
+ }
+}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java
new file mode 100644
index 0000000..4fce769
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailTls.java
@@ -0,0 +1,93 @@
+/**
+ * Copyright (C) 2004-2012 Savoir-Faire Linux Inc.
+ *
+ * Author: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * If you own a pjsip commercial license you can also redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public License
+ * as an android library.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package com.savoirfairelinux.sflphone.utils;
+
+import com.savoirfairelinux.sflphone.R;
+import com.savoirfairelinux.sflphone.utils.AccountDetail;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.HashMap;
+
+public class AccountDetailTls implements AccountDetail {
+
+ public static final String CONFIG_TLS_LISTENER_PORT = "TLS.listenerPort";
+ public static final String CONFIG_TLS_ENABLE = "TLS.enable";
+ public static final String CONFIG_TLS_CA_LIST_FILE = "TLS.certificateListFile";
+ public static final String CONFIG_TLS_CERTIFICATE_FILE = "TLS.certificateFile";
+ public static final String CONFIG_TLS_PRIVATE_KEY_FILE = "TLS.privateKeyFile";
+ public static final String CONFIG_TLS_PASSWORD = "TLS.password";
+ public static final String CONFIG_TLS_METHOD = "TLS.method";
+ public static final String CONFIG_TLS_CIPHERS = "TLS.ciphers";
+ public static final String CONFIG_TLS_SERVER_NAME = "TLS.serverName";
+ public static final String CONFIG_TLS_VERIFY_SERVER = "TLS.verifyServer";
+ public static final String CONFIG_TLS_VERIFY_CLIENT = "TLS.verifyClient";
+ public static final String CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE = "TLS.requireClientCertificate";
+ public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC = "TLS.negotiationTimeoutSec";
+ public static final String CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC = "TLS.negotiationTimemoutMsec";
+
+ private HashMap<String, AccountDetail.PreferenceEntry> privateMap;
+
+ public AccountDetailTls()
+ {
+ privateMap = new HashMap<String, AccountDetail.PreferenceEntry>();
+
+ privateMap.put(CONFIG_TLS_LISTENER_PORT,
+ new PreferenceEntry(CONFIG_TLS_LISTENER_PORT, R.string.account_listener_port_label));
+ privateMap.put(CONFIG_TLS_ENABLE,
+ new PreferenceEntry(CONFIG_TLS_ENABLE, R.string.account_tls_enabled_label));
+ privateMap.put(CONFIG_TLS_CA_LIST_FILE,
+ new PreferenceEntry(CONFIG_TLS_CA_LIST_FILE, R.string.account_tls_certificate_list_label));
+ privateMap.put(CONFIG_TLS_CERTIFICATE_FILE,
+ new PreferenceEntry(CONFIG_TLS_CERTIFICATE_FILE, R.string.account_tls_certificate_file_label));
+ privateMap.put(CONFIG_TLS_PRIVATE_KEY_FILE,
+ new PreferenceEntry(CONFIG_TLS_PRIVATE_KEY_FILE, R.string.account_tls_private_key_file_label));
+ privateMap.put(CONFIG_TLS_PASSWORD,
+ new PreferenceEntry(CONFIG_TLS_PASSWORD, R.string.account_tls_password_label));
+ privateMap.put(CONFIG_TLS_METHOD,
+ new PreferenceEntry(CONFIG_TLS_METHOD, R.string.account_tls_method_label));
+ privateMap.put(CONFIG_TLS_CIPHERS,
+ new PreferenceEntry(CONFIG_TLS_CIPHERS, R.string.account_tls_ciphers_label));
+ privateMap.put(CONFIG_TLS_SERVER_NAME,
+ new PreferenceEntry(CONFIG_TLS_SERVER_NAME, R.string.account_tls_server_name_label));
+ privateMap.put(CONFIG_TLS_VERIFY_SERVER,
+ new PreferenceEntry(CONFIG_TLS_VERIFY_SERVER, R.string.account_tls_verify_label));
+ privateMap.put(CONFIG_TLS_VERIFY_CLIENT,
+ new PreferenceEntry(CONFIG_TLS_VERIFY_CLIENT, R.string.account_tls_verify_client_label));
+ privateMap.put(CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE,
+ new PreferenceEntry(CONFIG_TLS_REQUIRE_CLIENT_CERTIFICATE, R.string.account_tls_require_client_certificat_label));
+ privateMap.put(CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC,
+ new PreferenceEntry(CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC, R.string.account_tls_negotiation_timeout_sec));
+ privateMap.put(CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC,
+ new PreferenceEntry(CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC, R.string.account_tls_negotiation_timeout_msec));
+ }
+
+ public Set<String> getDetailKeys()
+ {
+ return privateMap.keySet();
+ }
+
+ public Collection<AccountDetail.PreferenceEntry> getDetailValues()
+ {
+ return privateMap.values();
+ }
+}
diff --git a/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java b/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
index 198f8a6..440f498 100644
--- a/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
+++ b/src/com/savoirfairelinux/sflphone/utils/AccountDetailsHandler.java
@@ -21,6 +21,8 @@
*/
package com.savoirfairelinux.sflphone.utils;
+import android.util.Log;
+
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.service.ISipService;
import com.savoirfairelinux.sflphone.service.ServiceConstants;
@@ -31,6 +33,7 @@
import java.util.HashMap;
public class AccountDetailsHandler {
+ private static final String TAG = "AccountDetailsHandler";
public static class PreferenceEntry
{
@@ -178,7 +181,7 @@
swigmap.set(ServiceConstants.CONFIG_SRTP_ENABLE, nativemap.get(ServiceConstants.CONFIG_SRTP_ENABLE));
swigmap.set(ServiceConstants.CONFIG_ACCOUNT_TYPE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_TYPE));
- swigmap.set(ServiceConstants.CONFIG_ACCOUNT_MAILBOX, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_MAILBOX));
+ // swigmap.set(ServiceConstants.CONFIG_ACCOUNT_MAILBOX, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_MAILBOX));
swigmap.set(ServiceConstants.CONFIG_ACCOUNT_ENABLE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_ENABLE));
swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATUS));
swigmap.set(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE, nativemap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_STATE_CODE));
@@ -205,8 +208,8 @@
swigmap.set(ServiceConstants.CONFIG_TLS_CIPHERS, nativemap.get(ServiceConstants.CONFIG_TLS_CIPHERS));
swigmap.set(ServiceConstants.CONFIG_TLS_LISTENER_PORT, nativemap.get(ServiceConstants.CONFIG_TLS_LISTENER_PORT));
swigmap.set(ServiceConstants.CONFIG_TLS_METHOD, nativemap.get(ServiceConstants.CONFIG_TLS_METHOD));
- swigmap.set(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC, nativemap.get(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC));
- swigmap.set(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC, nativemap.get(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC));
+ // swigmap.set(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC, nativemap.get(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_MSEC));
+ // swigmap.set(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC, nativemap.get(ServiceConstants.CONFIG_TLS_NEGOTIATION_TIMEOUT_SEC));
swigmap.set(ServiceConstants.CONFIG_TLS_PASSWORD, nativemap.get(ServiceConstants.CONFIG_TLS_PASSWORD));
swigmap.set(ServiceConstants.CONFIG_TLS_PRIVATE_KEY_FILE, nativemap.get(ServiceConstants.CONFIG_TLS_PRIVATE_KEY_FILE));