* #23361 Fixed issue with password during account edition
Changed default port value to 5070 (5060 is taken sometimes)
Changed interface display to ListPreference
diff --git a/src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java b/src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java
index f264e50..b3f30e8 100644
--- a/src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailBasic.java
@@ -89,6 +89,7 @@
else {
int index = 0;
for(String s : pref) {
+ Log.i(TAG, "Creating "+privateArray.get(index).mKey+" value "+s);
privateArray.get(index).mValue = s;
index++;
}
diff --git a/src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.java b/src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.java
index 3f4f842..e01ddef 100644
--- a/src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.java
+++ b/src/com/savoirfairelinux/sflphone/account/AccountDetailsHandler.java
@@ -228,7 +228,7 @@
nativemap.put(ServiceConstants.CONFIG_ACCOUNT_ALIAS, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_ALIAS));
nativemap.put(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_HOSTNAME));
nativemap.put(ServiceConstants.CONFIG_ACCOUNT_USERNAME, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_USERNAME));
- nativemap.put(ServiceConstants.CONFIG_ACCOUNT_PASSWORD, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_USERNAME));
+ nativemap.put(ServiceConstants.CONFIG_ACCOUNT_PASSWORD, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_PASSWORD));
nativemap.put(ServiceConstants.CONFIG_ACCOUNT_ROUTESET, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_ROUTESET));
nativemap.put(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE, swigmap.get(ServiceConstants.CONFIG_ACCOUNT_REGISTRATION_EXPIRE));
diff --git a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
index 68179b0..13e848a 100644
--- a/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/AccountPreferenceActivity.java
@@ -86,7 +86,6 @@
private String mAccountID;
private ArrayList<String> requiredFields = null;
-
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -126,7 +125,7 @@
addPreferenceListener(tlsDetails, changeTlsPreferenceListener);
}
-
+
private void initEdition() {
Bundle b = getIntent().getExtras();
@@ -135,7 +134,7 @@
ArrayList<String> advancedPreferenceList = b.getStringArrayList(AccountDetailAdvanced.BUNDLE_TAG);
ArrayList<String> srtpPreferenceList = b.getStringArrayList(AccountDetailSrtp.BUNDLE_TAG);
ArrayList<String> tlsPreferenceList = b.getStringArrayList(AccountDetailTls.BUNDLE_TAG);
-
+
basicDetails = new AccountDetailBasic(basicPreferenceList);
advancedDetails = new AccountDetailAdvanced(advancedPreferenceList);
srtpDetails = new AccountDetailSrtp(srtpPreferenceList);
@@ -191,7 +190,6 @@
}
-
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@@ -255,7 +253,6 @@
return valid;
}
-
private void updateAccountDetails(HashMap<String, String> accountDetails, AccountDetail det) {
for (AccountDetail.PreferenceEntry p : det.getDetailValues()) {
Preference pref = mPreferenceManager.findPreference(p.mKey);
@@ -264,8 +261,13 @@
CheckBoxPreference boxPref = (CheckBoxPreference) pref;
accountDetails.put(p.mKey, boxPref.isChecked() ? "true" : "false");
} else {
- EditTextPreference textPref = (EditTextPreference) pref;
- accountDetails.put(p.mKey, textPref.getText());
+ if (p.mKey == AccountDetailAdvanced.CONFIG_LOCAL_INTERFACE) {
+ ListPreference list = (ListPreference) pref;
+ accountDetails.put(p.mKey, list.getValue());
+ } else {
+ EditTextPreference textPref = (EditTextPreference) pref;
+ accountDetails.put(p.mKey, textPref.getText());
+ }
}
}
}
@@ -278,7 +280,7 @@
return true;
}
};
-
+
Preference.OnPreferenceChangeListener changeAdvancedPreferenceListener = new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
preference.setSummary((CharSequence) newValue);
@@ -286,7 +288,7 @@
return true;
}
};
-
+
Preference.OnPreferenceChangeListener changeTlsPreferenceListener = new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
preference.setSummary((CharSequence) newValue);
@@ -294,7 +296,7 @@
return true;
}
};
-
+
Preference.OnPreferenceChangeListener changeSrtpPreferenceListener = new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
preference.setSummary((CharSequence) newValue);
@@ -302,20 +304,20 @@
return true;
}
};
-
+
private void setPreferenceDetails(AccountDetail details) {
for (AccountDetail.PreferenceEntry p : details.getDetailValues()) {
- Log.i(TAG,"setPreferenceDetails: pref "+p.mKey+ " value "+ p.mValue);
+ Log.i(TAG, "setPreferenceDetails: pref " + p.mKey + " value " + p.mValue);
Preference pref = mPreferenceManager.findPreference(p.mKey);
if (pref != null) {
- if(p.mKey == AccountDetailAdvanced.CONFIG_LOCAL_INTERFACE){
+ if (p.mKey == AccountDetailAdvanced.CONFIG_LOCAL_INTERFACE) {
ArrayList<CharSequence> entries = new ArrayList<CharSequence>();
try {
-
+
for (Enumeration<NetworkInterface> list = NetworkInterface.getNetworkInterfaces(); list.hasMoreElements();) {
NetworkInterface i = list.nextElement();
Log.e("network_interfaces", "display name " + i.getDisplayName());
- if(i.isUp())
+ if (i.isUp())
entries.add(i.getDisplayName());
}
} catch (SocketException e) {
@@ -333,35 +335,31 @@
pref.setSummary(p.mValue);
}
} else {
- Log.w(TAG,"pref not found");
+ Log.w(TAG, "pref not found");
}
}
}
private void addPreferenceListener(AccountDetail details, OnPreferenceChangeListener listener) {
for (AccountDetail.PreferenceEntry p : details.getDetailValues()) {
- Log.i(TAG,"addPreferenceListener: pref "+p.mKey);
+ Log.i(TAG, "addPreferenceListener: pref " + p.mKey);
Preference pref = mPreferenceManager.findPreference(p.mKey);
if (pref != null) {
if (!p.isTwoState) {
pref.setOnPreferenceChangeListener(listener);
}
} else {
- Log.w(TAG,"addPreferenceListener: pref not found");
+ Log.w(TAG, "addPreferenceListener: pref not found");
}
}
}
-
-
-
-
/******************************************
*
* AlertDialogs
*
******************************************/
-
+
private AlertDialog createCouldNotValidateDialog(ArrayList<String> missingValue) {
String message = "The following parameters are missing:";
@@ -379,7 +377,7 @@
AlertDialog alertDialog = builder.create();
return alertDialog;
}
-
+
private AlertDialog createCancelDialog() {
Activity ownerActivity = this;
AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
@@ -399,7 +397,7 @@
return alertDialog;
}
-
+
private AlertDialog createDeleteDialog() {
Activity ownerActivity = this;
AlertDialog.Builder builder = new AlertDialog.Builder(ownerActivity);
diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
index 213a946..5f7a5a3 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
@@ -227,4 +227,9 @@
mCall.notifyServiceUnhold(service);
}
+ public void onCalltransfered(String to) {
+ mCall.notifyServiceTransfer(service, to);
+
+ }
+
}
diff --git a/src/com/savoirfairelinux/sflphone/client/OngoingCallFragment.java b/src/com/savoirfairelinux/sflphone/client/OngoingCallFragment.java
index 2c34d2c..aad848e 100644
--- a/src/com/savoirfairelinux/sflphone/client/OngoingCallFragment.java
+++ b/src/com/savoirfairelinux/sflphone/client/OngoingCallFragment.java
@@ -8,6 +8,7 @@
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;
+import android.widget.EditText;
import android.widget.TextView;
import com.savoirfairelinux.sflphone.R;
@@ -30,14 +31,29 @@
updateUI();
}
+ EditText transfer_txt;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
ViewGroup v = (ViewGroup) inflater.inflate(R.layout.frag_call_ongoing, container, false);
+ transfer_txt = (EditText) v.findViewById(R.id.text_transfer);
contact_name_txt = (TextView) v.findViewById(R.id.contact_name_txt);
end_btn = (Button) v.findViewById(R.id.end_btn);
suspend_btn = (Button) v.findViewById(R.id.suspend_btn);
+ Button transfer_btn = (Button) v.findViewById(R.id.transfer);
+ transfer_btn.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ listener.onCalltransfered(transfer_txt.getText().toString());
+
+
+ }
+ });
+
+
+
callstatus_txt = (TextView) v.findViewById(R.id.callstatus_txt);
calllength_txt = (TextView) v.findViewById(R.id.calllength_txt);
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
index 6d14815..41650e5 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHomeActivity.java
@@ -97,7 +97,7 @@
/* putFragment (Bundle bundle, String key, Fragment fragment) */
getFragmentManager().putFragment(bundle, mSectionsPagerAdapter.getClassName(i), mSectionsPagerAdapter.getFragment(i));
} catch (IllegalStateException e) {
- Log.e(TAG, e.toString() + "fragment=" + mSectionsPagerAdapter.getFragment(i));
+ Log.e(TAG, "fragment=" + mSectionsPagerAdapter.getFragment(i));
}
}
Log.w(TAG, "onSaveInstanceState()");
diff --git a/src/com/savoirfairelinux/sflphone/model/SipCall.java b/src/com/savoirfairelinux/sflphone/model/SipCall.java
index 713f508..472bc79 100644
--- a/src/com/savoirfairelinux/sflphone/model/SipCall.java
+++ b/src/com/savoirfairelinux/sflphone/model/SipCall.java
@@ -402,4 +402,14 @@
return false;
}
+
+ public void notifyServiceTransfer(ISipService service, String to) {
+ try {
+ if(getCallStateInt() == CALL_STATE_CURRENT) {
+ service.transfer(mCallInfo.mCallID, to);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
+ }
}
diff --git a/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java b/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java
index b72738c..2b6140b 100644
--- a/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java
+++ b/src/com/savoirfairelinux/sflphone/service/CallManagerCallBack.java
@@ -37,6 +37,11 @@
Log.d(TAG, "on_incoming_call(" + accountID + ", " + callID + ", " + from + ")");
sendIncomingCallMessage(accountID, callID, from);
}
+
+ @Override
+ public void on_transfer_state_changed(String result){
+ Log.w(TAG,"TRANSFER STATE CHANGED:"+result);
+ }
private void sendNewCallCreatedMessage(String accountID, String callID, String to) {
Bundle bundle = new Bundle();
diff --git a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
index ac4e9c1..a8bbc39 100644
--- a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
+++ b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
@@ -9,6 +9,7 @@
void hangUp(in String callID);
void hold(in String callID);
void unhold(in String callID);
+
List getAccountList();
String addAccount(in Map accountDetails);
void removeAccount(in String accoundId);
@@ -17,5 +18,24 @@
void setAudioPlugin(in String callID);
String getCurrentAudioOutputPlugin();
List getHistory();
+
void registerClient(in ISipClient callback);
+
+ void transfer(in String callID, in String to);
+ void attendedTransfer(in String transferID, in String targetID);
+
+ /* Conference related methods */
+ void joinParticipant(in String sel_callID, in String drag_callID);
+ void createConfFromParticipantList(in List participants);
+ void addParticipant(in String callID, in String confID);
+ void addMainParticipant(in String confID);
+ void detachParticipant(in String callID);
+ void joinConference(in String sel_confID, in String drag_confID);
+ void hangUpConference(in String confID);
+ void holdConference(in String confID);
+ void unholdConference(in String confID);
+ List getConferenceList();
+ List getParticipantList(in String confID);
+ String getConferenceId(in String callID);
+ Map getConferenceDetails(in String callID);
}
diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java
index c8a871a..c7337e5 100644
--- a/src/com/savoirfairelinux/sflphone/service/SipService.java
+++ b/src/com/savoirfairelinux/sflphone/service/SipService.java
@@ -26,6 +26,7 @@
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import android.app.Service;
@@ -34,6 +35,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Binder;
+import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
@@ -280,7 +282,7 @@
@Override
protected VectMap doRun() throws SameThreadException {
Log.i(TAG, "SipService.getHistory() thread running...");
-
+
return configurationManagerJNI.getHistory();
}
}
@@ -295,6 +297,129 @@
return nativemap;
}
+
+ @Override
+ public void transfer(final String callID, final String to) throws RemoteException {
+ getExecutor().execute(new SipRunnable() {
+ @Override
+ protected void doRun() throws SameThreadException, RemoteException {
+ Log.i(TAG, "SipService.transfer() thread running...");
+ if (callManagerJNI.transfer(callID, to)) {
+ Bundle bundle = new Bundle();
+ bundle.putString("CallID", callID);
+ bundle.putString("State", "HUNGUP");
+ Intent intent = new Intent(CallManagerCallBack.CALL_STATE_CHANGED);
+ intent.putExtra(CallManagerCallBack.SIGNAL_NAME, CallManagerCallBack.CALL_STATE_CHANGED);
+ intent.putExtra("com.savoirfairelinux.sflphone.service.newstate", bundle);
+ client.callStateChanged(intent);
+ } else
+ Log.i(TAG, "NOT OK");
+ }
+ });
+
+ }
+
+ @Override
+ public void attendedTransfer(final String transferID, final String targetID) throws RemoteException {
+ getExecutor().execute(new SipRunnable() {
+ @Override
+ protected void doRun() throws SameThreadException, RemoteException {
+ Log.i(TAG, "SipService.transfer() thread running...");
+ if (callManagerJNI.attendedTransfer(transferID, targetID)) {
+ Log.i(TAG, "OK");
+// Bundle bundle = new Bundle();
+// bundle.putString("CallID", callID);
+// bundle.putString("State", "HUNGUP");
+// Intent intent = new Intent(CallManagerCallBack.CALL_STATE_CHANGED);
+// intent.putExtra(CallManagerCallBack.SIGNAL_NAME, CallManagerCallBack.CALL_STATE_CHANGED);
+// intent.putExtra("com.savoirfairelinux.sflphone.service.newstate", bundle);
+// client.callStateChanged(intent);
+ } else
+ Log.i(TAG, "NOT OK");
+ }
+ });
+
+ }
+
+ @Override
+ public void joinParticipant(String sel_callID, String drag_callID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void createConfFromParticipantList(List participants) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addParticipant(String callID, String confID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void addMainParticipant(String confID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void detachParticipant(String callID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void joinConference(String sel_confID, String drag_confID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void hangUpConference(String confID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void holdConference(String confID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void unholdConference(String confID) throws RemoteException {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public List getConferenceList() throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public List getParticipantList(String confID) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getConferenceId(String callID) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public Map getConferenceDetails(String callID) throws RemoteException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
};
private BroadcastReceiver IncomingReceiver = new BroadcastReceiver() {
@@ -303,21 +428,24 @@
// Get instance of Vibrator from current Context
// Vibrator mVibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
// mVibrator.vibrate(300);
- try {
- if (intent.getAction().contentEquals(CallManagerCallBack.INCOMING_CALL)) {
- Log.i(TAG, "Received" + intent.getAction());
+ if (client != null) {
+ try {
+ if (intent.getAction().contentEquals(CallManagerCallBack.INCOMING_CALL)) {
+ Log.i(TAG, "Received" + intent.getAction());
- client.incomingCall(intent);
+ client.incomingCall(intent);
- } else if (intent.getAction().contentEquals(CallManagerCallBack.CALL_STATE_CHANGED)) {
- Log.i(TAG, "Received" + intent.getAction());
- client.callStateChanged(intent);
- } else if (intent.getAction().contentEquals(CallManagerCallBack.NEW_CALL_CREATED)) {
- Log.i(TAG, "Received" + intent.getAction());
+ } else if (intent.getAction().contentEquals(CallManagerCallBack.CALL_STATE_CHANGED)) {
+ Log.i(TAG, "Received" + intent.getAction());
+ client.callStateChanged(intent);
+ } else if (intent.getAction().contentEquals(CallManagerCallBack.NEW_CALL_CREATED)) {
+ Log.i(TAG, "Received" + intent.getAction());
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString());
}
- } catch (RemoteException e) {
- Log.e(TAG, e.toString());
}
+
}
};
@@ -496,13 +624,15 @@
}
public abstract static class SipRunnable implements Runnable {
- protected abstract void doRun() throws SameThreadException;
+ protected abstract void doRun() throws SameThreadException, RemoteException;
public void run() {
try {
doRun();
} catch (SameThreadException e) {
Log.e(TAG, "Not done from same thread");
+ } catch (RemoteException e) {
+ Log.e(TAG,e.toString());
}
}
}