* #40232: Display SAS when call starts
diff --git a/src/org/sflphone/adapters/AccountSelectionAdapter.java b/src/org/sflphone/adapters/AccountSelectionAdapter.java
index cc722b8..acb1ed2 100644
--- a/src/org/sflphone/adapters/AccountSelectionAdapter.java
+++ b/src/org/sflphone/adapters/AccountSelectionAdapter.java
@@ -149,23 +149,17 @@
/**
* Modify state of specific account
- *
- * @param accountState
*/
- public void updateAccount(Intent accountState) {
+ public void updateAccount(String accoundID, String state, int code) {
Log.i(TAG, "updateAccount");
- String id = accountState.getStringExtra("Account");
- String newState = accountState.getStringExtra("state");
- accountState.getStringExtra("Account");
for (Account a : accounts) {
- if (a.getAccountID().contentEquals(id)) {
- a.setRegistered_state(newState);
+ if (a.getAccountID().contentEquals(accoundID)) {
+ a.setRegistered_state(state);
notifyDataSetChanged();
return;
}
}
-
}
public String getAccountOrder() {
diff --git a/src/org/sflphone/client/AccountWizard.java b/src/org/sflphone/client/AccountWizard.java
index fbb5780..788b1f7 100644
--- a/src/org/sflphone/client/AccountWizard.java
+++ b/src/org/sflphone/client/AccountWizard.java
@@ -55,10 +55,9 @@
import android.util.Log;
import android.view.MenuItem;
-public class AccountWizard extends Activity implements AccountsInterface, Callbacks {
+public class AccountWizard extends Activity implements Callbacks {
static final String TAG = "AccountWizard";
private boolean mBound = false;
- public static final int ACCOUNT_CREATED = Activity.RESULT_OK;
private ISipService service;
ViewPager mViewPager;
private SectionsPagerAdapter mSectionsPagerAdapter;
@@ -118,18 +117,6 @@
}
}
- @Override
- public void accountsChanged() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void accountStateChanged(Intent accountState) {
- // TODO Auto-generated method stub
-
- }
-
public class SectionsPagerAdapter extends FragmentStatePagerAdapter {
Context mContext;
diff --git a/src/org/sflphone/client/CallActivity.java b/src/org/sflphone/client/CallActivity.java
index 2f5de06..4242390 100644
--- a/src/org/sflphone/client/CallActivity.java
+++ b/src/org/sflphone/client/CallActivity.java
@@ -76,14 +76,11 @@
@SuppressWarnings("unused")
static final String TAG = "CallActivity";
private ISipService mService;
-
-
-
CallPaneLayout mSlidingPaneLayout;
IMFragment mIMFragment;
CallFragment mCurrentCallFragment;
-
+ private Conference mDisplayedConference;
/* result code sent in case of call failure */
public static int RESULT_FAILURE = -10;
@@ -94,8 +91,6 @@
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_call_layout);
-
-
mProximityManager = new CallProximityManager(this, this);
mSlidingPaneLayout = (CallPaneLayout) findViewById(R.id.slidingpanelayout);
@@ -198,11 +193,8 @@
SipCall call = SipCall.SipCallBuilder.getInstance().startCallCreation().setContact(c).setAccount(acc)
.setCallType(SipCall.direction.CALL_TYPE_OUTGOING).build();
- Conference tmp = new Conference(Conference.DEFAULT_ID);
- tmp.getParticipants().add(call);
- Bundle b = new Bundle();
- b.putParcelable("conference", tmp);
- mCurrentCallFragment.setArguments(b);
+ mDisplayedConference = new Conference(Conference.DEFAULT_ID);
+ mDisplayedConference.getParticipants().add(call);
} catch (RemoteException e) {
e.printStackTrace();
} catch (Exception e) {
@@ -211,18 +203,14 @@
} else {
if (getIntent().getBooleanExtra("resuming", false)) {
- Bundle b = new Bundle();
- Conference resumed = getIntent().getParcelableExtra("conference");
- b.putParcelable("conference", getIntent().getParcelableExtra("conference"));
- mCurrentCallFragment.setArguments(b);
+ mDisplayedConference = getIntent().getParcelableExtra("conference");
Bundle IMBundle = new Bundle();
- IMBundle.putParcelableArrayList("messages", resumed.getMessages());
+ IMBundle.putParcelableArrayList("messages", mDisplayedConference.getMessages());
mIMFragment.setArguments(IMBundle);
} else {
- mCurrentCallFragment.setArguments(getIntent().getExtras());
-
+ mDisplayedConference = getIntent().getParcelableExtra("conference");
Bundle IMBundle = new Bundle();
IMBundle.putParcelableArrayList("messages", new ArrayList<SipMessage>());
mIMFragment.setArguments(IMBundle);
@@ -248,6 +236,11 @@
}
@Override
+ public Conference getDisplayedConference() {
+ return mDisplayedConference;
+ }
+
+ @Override
public void onBackPressed() {
super.onBackPressed();
Intent launchHome = new Intent(this, HomeActivity.class);
diff --git a/src/org/sflphone/client/HomeActivity.java b/src/org/sflphone/client/HomeActivity.java
index fbba340..092ced0 100644
--- a/src/org/sflphone/client/HomeActivity.java
+++ b/src/org/sflphone/client/HomeActivity.java
@@ -363,16 +363,12 @@
}
public void launchCallActivity(SipCall infos) {
-
- Bundle bundle = new Bundle();
Conference tmp = new Conference(Conference.DEFAULT_ID);
tmp.getParticipants().add(infos);
-
- bundle.putParcelable("conference", tmp);
Intent intent = new Intent().setClass(this, CallActivity.class);
+ intent.putExtra("conference", tmp);
intent.putExtra("resuming", false);
- intent.putExtras(bundle);
startActivityForResult(intent, REQUEST_CODE_CALL);
// overridePendingTransition(R.anim.slide_down, R.anim.slide_up);
diff --git a/src/org/sflphone/fragments/AccountWrapperFragment.java b/src/org/sflphone/fragments/AccountWrapperFragment.java
index 7f1144a..98dab74 100644
--- a/src/org/sflphone/fragments/AccountWrapperFragment.java
+++ b/src/org/sflphone/fragments/AccountWrapperFragment.java
@@ -27,10 +27,10 @@
@Override
public void onResume() {
- super.onResume();IntentFilter intentFilter = new IntentFilter();
- IntentFilter intentFilter2 = new IntentFilter();
- intentFilter2.addAction(ConfigurationManagerCallback.ACCOUNT_STATE_CHANGED);
- intentFilter2.addAction(ConfigurationManagerCallback.ACCOUNTS_CHANGED);
+ super.onResume();
+ IntentFilter intentFilter = new IntentFilter();
+ intentFilter.addAction(ConfigurationManagerCallback.ACCOUNT_STATE_CHANGED);
+ intentFilter.addAction(ConfigurationManagerCallback.ACCOUNTS_CHANGED);
getActivity().registerReceiver(mReceiver, intentFilter);
}
@@ -40,7 +40,7 @@
}
@Override
- public void accountStateChanged(Intent accountState) {
+ public void accountStateChanged(String accoundID, String state, int code) {
}
@@ -59,7 +59,7 @@
public void onReceive(Context context, Intent intent) {
if (intent.getAction().contentEquals(ConfigurationManagerCallback.ACCOUNT_STATE_CHANGED)) {
Log.i(TAG, "Received" + intent.getAction());
- accountStateChanged(intent);
+ accountStateChanged(intent.getStringExtra("Account"), intent.getStringExtra("state"), intent.getIntExtra("code", 0));
} else if (intent.getAction().contentEquals(ConfigurationManagerCallback.ACCOUNTS_CHANGED)) {
Log.i(TAG, "Received" + intent.getAction());
accountsChanged();
diff --git a/src/org/sflphone/fragments/AccountsManagementFragment.java b/src/org/sflphone/fragments/AccountsManagementFragment.java
index 7204808..f6f7413 100644
--- a/src/org/sflphone/fragments/AccountsManagementFragment.java
+++ b/src/org/sflphone/fragments/AccountsManagementFragment.java
@@ -220,8 +220,8 @@
}
@Override
- public void accountStateChanged(Intent accountState) {
- mAccountsAdapter.updateAccount(accountState);
+ public void accountStateChanged(String accoundID, String state, int code) {
+ mAccountsAdapter.updateAccount(accoundID, state, code);
}
@Override
@@ -348,17 +348,12 @@
/**
* Modify state of specific account
- *
- * @param accountState
*/
- public void updateAccount(Intent accountState) {
- String id = accountState.getStringExtra("Account");
- String newState = accountState.getStringExtra("state");
-
- Log.i(TAG, "updateAccount:" + newState);
+ public void updateAccount(String accoundID, String state, int code) {
+ Log.i(TAG, "updateAccount:" + state);
for (Account a : accounts) {
- if (a.getAccountID().contentEquals(id)) {
- a.setRegistered_state(newState);
+ if (a.getAccountID().contentEquals(accoundID)) {
+ a.setRegistered_state(state);
notifyDataSetChanged();
return;
}
diff --git a/src/org/sflphone/fragments/CallFragment.java b/src/org/sflphone/fragments/CallFragment.java
index 1436954..382b1a6 100644
--- a/src/org/sflphone/fragments/CallFragment.java
+++ b/src/org/sflphone/fragments/CallFragment.java
@@ -51,6 +51,7 @@
import android.view.SurfaceHolder.Callback;
import android.view.View.OnClickListener;
import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;
@@ -69,11 +70,9 @@
float BUBBLE_SIZE = 75;
static final float ATTRACTOR_SIZE = 40;
-
-
public static final int REQUEST_TRANSFER = 10;
- private Conference conf;
+
private TextView callStatusTxt;
private ToggleButton speakers;
@@ -105,7 +104,6 @@
@Override
public void onCreate(Bundle savedBundle) {
super.onCreate(savedBundle);
- conf = new Conference((Conference) getArguments().getParcelable("conference"));
model = new BubbleModel(getResources().getDisplayMetrics().density);
BUBBLE_SIZE = getResources().getDimension(R.dimen.bubble_size);
Log.e(TAG, "BUBBLE_SIZE " + BUBBLE_SIZE);
@@ -153,6 +151,11 @@
}
@Override
+ public Conference getDisplayedConference() {
+ return null;
+ }
+
+ @Override
public void startTimer() {
}
@@ -174,6 +177,8 @@
public void slideChatScreen();
public void terminateCall();
+
+ public Conference getDisplayedConference();
}
@Override
@@ -237,30 +242,43 @@
}
@Override
- public void callStateChanged(Intent callState) {
- Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
- changeCallState(b.getString("CallID"), b.getString("State"));
+ public void callStateChanged(String callID, String state) {
+ changeCallState(callID, state);
}
@Override
- public void recordingChanged(Intent intent) {
+ public void recordingChanged(String callID, String filename) {
}
@Override
- public void secureZrtpOn(Intent intent) {
+ public void secureZrtpOn(String id) {
Log.i(TAG, "secureZrtpOn");
//enableSASButton();
}
@Override
- public void secureZrtpOff(Intent intent) {
+ public void secureZrtpOff(String id) {
Log.i(TAG, "secureZrtpOff");
}
@Override
- public void displaySAS(Intent intent) {
+ public void displaySAS(final String callID, String SAS, boolean verified) {
Log.i(TAG, "displaySAS");
+ final Button sas = (Button) getView().findViewById(R.id.confirm_sas);
+ sas.setText("Confirm SAS: " + SAS);
+ sas.setVisibility(View.VISIBLE);
+ sas.setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ try {
+ mCallbacks.getService().confirmSAS(callID);
+ sas.setVisibility(View.INVISIBLE);
+ } catch (RemoteException e) {
+ e.printStackTrace();
+ }
+ }
+ });
}
@Override
@@ -339,24 +357,28 @@
return rootView;
}
+ public Conference getConference(){
+ return mCallbacks.getDisplayedConference();
+ }
+
private void initNormalStateDisplay() {
Log.i(TAG, "Start normal display");
mCallbacks.startTimer();
- getBubbleForUser(conf, model.width / 2, model.height / 2);
+ getBubbleForUser(getConference(), model.width / 2, model.height / 2);
- int angle_part = 360 / conf.getParticipants().size();
+ int angle_part = 360 / getConference().getParticipants().size();
double dX, dY;
int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE);
- for (int i = 0; i < conf.getParticipants().size(); ++i) {
+ for (int i = 0; i < getConference().getParticipants().size(); ++i) {
- if (conf.getParticipants().get(i) == null) {
+ if (getConference().getParticipants().get(i) == null) {
continue;
}
dX = Math.cos(Math.toRadians(angle_part * i - 90)) * radiusCalls;
dY = Math.sin(Math.toRadians(angle_part * i - 90)) * radiusCalls;
- getBubbleFor(conf.getParticipants().get(i), (int) (model.width / 2 + dX), (int) (model.height / 2 + dY));
+ getBubbleFor(getConference().getParticipants().get(i), (int) (model.width / 2 + dX), (int) (model.height / 2 + dY));
}
model.clearAttractors();
@@ -368,8 +390,8 @@
mCallbacks.startTimer();
int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE);
- getBubbleForUser(conf, model.width / 2, model.height / 2 + radiusCalls);
- getBubbleFor(conf.getParticipants().get(0), model.width / 2, model.height / 2 - radiusCalls);
+ getBubbleForUser(getConference(), model.width / 2, model.height / 2 + radiusCalls);
+ getBubbleFor(getConference().getParticipants().get(0), model.width / 2, model.height / 2 - radiusCalls);
model.clearAttractors();
model.addAttractor(new Attractor(new PointF(model.width / 2, model.height / 2), ATTRACTOR_SIZE, new Attractor.Callback() {
@@ -388,9 +410,9 @@
}
}, call_icon));
- if (conf.getParticipants().get(0).getAccount().isAutoanswerEnabled()) {
+ if (getConference().getParticipants().get(0).getAccount().isAutoanswerEnabled()) {
try {
- mCallbacks.getService().accept(conf.getParticipants().get(0).getCallId());
+ mCallbacks.getService().accept(getConference().getParticipants().get(0).getCallId());
} catch (RemoteException e) {
e.printStackTrace();
}
@@ -402,16 +424,16 @@
mCallbacks.startTimer();
- getBubbleForUser(conf, model.width / 2, model.height / 2);
+ getBubbleForUser(getConference(), model.width / 2, model.height / 2);
// TODO off-thread image loading
- int angle_part = 360 / conf.getParticipants().size();
+ int angle_part = 360 / getConference().getParticipants().size();
double dX, dY;
int radiusCalls = (int) (model.width / 2 - BUBBLE_SIZE);
- for (int i = 0; i < conf.getParticipants().size(); ++i) {
+ for (int i = 0; i < getConference().getParticipants().size(); ++i) {
dX = Math.cos(Math.toRadians(angle_part * i - 90)) * radiusCalls;
dY = Math.sin(Math.toRadians(angle_part * i - 90)) * radiusCalls;
- getBubbleFor(conf.getParticipants().get(i), (int) (model.width / 2 + dX), (int) (model.height / 2 + dY));
+ getBubbleFor(getConference().getParticipants().get(i), (int) (model.width / 2 + dX), (int) (model.height / 2 + dY));
}
model.clearAttractors();
@@ -474,25 +496,25 @@
e.printStackTrace();
}
}
- if (conf == null) {
+ if (getConference() == null) {
return;
}
- for (int i = 0; i < conf.getParticipants().size(); ++i) {
- if (callID.equals(conf.getParticipants().get(i).getCallId())) {
+ for (int i = 0; i < getConference().getParticipants().size(); ++i) {
+ if (callID.equals(getConference().getParticipants().get(i).getCallId())) {
if (newState.contentEquals("HUNGUP")) {
- model.removeBubble(conf.getParticipants().get(i));
- conf.getParticipants().remove(i);
+ model.removeBubble(getConference().getParticipants().get(i));
+ getConference().getParticipants().remove(i);
} else {
- conf.getParticipants().get(i).setCallState(newState);
+ getConference().getParticipants().get(i).setCallState(newState);
}
}
}
- if (conf.isOnGoing()) {
+ if (getConference().isOnGoing()) {
initNormalStateDisplay();
}
- if (conf.getParticipants().size() == 0) {
+ if (getConference().getParticipants().size() == 0) {
callStatusTxt.setText(newState);
mCallbacks.terminateCall();
}
@@ -505,29 +527,29 @@
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
- if (conf.getParticipants().size() == 1) {
- if (conf.getParticipants().get(0).isIncoming() && conf.getParticipants().get(0).isRinging()) {
+ if (getConference().getParticipants().size() == 1) {
+ if (getConference().getParticipants().get(0).isIncoming() && getConference().getParticipants().get(0).isRinging()) {
initIncomingCallDisplay();
} else {
- if (conf.getParticipants().get(0).isRinging()) {
+ if (getConference().getParticipants().get(0).isRinging()) {
initOutGoingCallDisplay();
}
try {
- if (conf.getParticipants().get(0).isOutGoing()
- && mCallbacks.getService().getConference(conf.getId()) == null) {
- mCallbacks.getService().placeCall(conf.getParticipants().get(0));
+ if (getConference().getParticipants().get(0).isOutGoing()
+ && mCallbacks.getService().getConference(getConference().getId()) == null) {
+ mCallbacks.getService().placeCall(getConference().getParticipants().get(0));
initOutGoingCallDisplay();
- } else if (conf.getParticipants().get(0).isOutGoing() && conf.getParticipants().get(0).isRinging()) {
+ } else if (getConference().getParticipants().get(0).isOutGoing() && getConference().getParticipants().get(0).isRinging()) {
initOutGoingCallDisplay();
}
} catch (RemoteException e) {
Log.e(TAG, e.toString());
}
}
- if (conf.getParticipants().get(0).isOngoing()) {
+ if (getConference().getParticipants().get(0).isOngoing()) {
initNormalStateDisplay();
}
- } else if (conf.getParticipants().size() > 1) {
+ } else if (getConference().getParticipants().size() > 1) {
initNormalStateDisplay();
}
}
@@ -568,15 +590,11 @@
}
public void updateTime() {
- long duration = System.currentTimeMillis() / 1000 - this.conf.getParticipants().get(0).getTimestampStart_();
- if (conf.isOnGoing())
+ long duration = System.currentTimeMillis() / 1000 - this.getConference().getParticipants().get(0).getTimestampStart_();
+ if (getConference().isOnGoing())
callStatusTxt.setText(String.format("%d:%02d:%02d", duration / 3600, duration % 3600 / 60, duration % 60));
}
- public Conference getConference() {
- return conf;
- }
-
public void onKeyUp(int keyCode, KeyEvent event) {
try {
diff --git a/src/org/sflphone/fragments/CallListFragment.java b/src/org/sflphone/fragments/CallListFragment.java
index 86e67ea..82b357b 100644
--- a/src/org/sflphone/fragments/CallListFragment.java
+++ b/src/org/sflphone/fragments/CallListFragment.java
@@ -83,45 +83,31 @@
};
@Override
- public void callStateChanged(Intent callState) {
- Bundle b = callState.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
- String cID = b.getString("CallID");
- String state = b.getString("State");
- Log.i(TAG, "callStateChanged" + cID + " " + state);
-
+ public void callStateChanged(String callID, String state) {
+ Log.i(TAG, "callStateChanged" + callID + " " + state);
updateLists();
-
}
@Override
- public void incomingText(Intent msg) {
- Bundle b = msg.getBundleExtra("com.savoirfairelinux.sflphone.service.newtext");
- b.getString("CallID");
- String from = b.getString("From");
- String mess = b.getString("Msg");
- Toast.makeText(getActivity(), "text from " + from + " : " + mess, Toast.LENGTH_LONG).show();
- }
-
- @Override
- public void confCreated(Intent intent) {
+ public void confCreated(String id) {
Log.i(TAG, "confCreated");
updateLists();
}
@Override
- public void confRemoved(Intent intent) {
+ public void confRemoved(String id) {
Log.i(TAG, "confRemoved");
updateLists();
}
@Override
- public void confChanged(Intent intent) {
+ public void confChanged(String id, String state) {
Log.i(TAG, "confChanged");
updateLists();
}
@Override
- public void recordingChanged(Intent intent) {
+ public void recordingChanged(String callID, String filename) {
Log.i(TAG, "confChanged");
updateLists();
}
diff --git a/src/org/sflphone/fragments/CallableWrapperFragment.java b/src/org/sflphone/fragments/CallableWrapperFragment.java
index fc6b732..e85f94f 100644
--- a/src/org/sflphone/fragments/CallableWrapperFragment.java
+++ b/src/org/sflphone/fragments/CallableWrapperFragment.java
@@ -7,9 +7,6 @@
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
import org.sflphone.interfaces.CallInterface;
import org.sflphone.service.CallManagerCallBack;
@@ -30,7 +27,8 @@
@Override
public void onResume() {
- super.onResume();IntentFilter intentFilter = new IntentFilter();
+ super.onResume();
+ IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction(CallManagerCallBack.INCOMING_CALL);
intentFilter.addAction(CallManagerCallBack.INCOMING_TEXT);
intentFilter.addAction(CallManagerCallBack.CALL_STATE_CHANGED);
@@ -52,47 +50,47 @@
}
@Override
- public void callStateChanged(Intent callState) {
+ public void callStateChanged(String callID, String state) {
}
@Override
- public void incomingText(Intent msg) {
+ public void incomingText(String ID, String from, String msg) {
}
@Override
- public void confCreated(Intent intent) {
+ public void confCreated(String id) {
}
@Override
- public void confRemoved(Intent intent) {
+ public void confRemoved(String id) {
}
@Override
- public void confChanged(Intent intent) {
+ public void confChanged(String id, String state) {
}
@Override
- public void recordingChanged(Intent intent) {
+ public void recordingChanged(String callID, String filename) {
}
@Override
- public void secureZrtpOn(Intent intent) {
+ public void secureZrtpOn(String id) {
}
@Override
- public void secureZrtpOff(Intent intent) {
+ public void secureZrtpOff(String id) {
}
@Override
- public void displaySAS(Intent intent) {
+ public void displaySAS(String callID, String SAS, boolean verified) {
}
@@ -103,23 +101,23 @@
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().contentEquals(CallManagerCallBack.INCOMING_TEXT)) {
- incomingText(intent);
+ incomingText(intent.getStringExtra("CallID"), intent.getStringExtra("From"), intent.getStringExtra("Msg"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.CALL_STATE_CHANGED)) {
- callStateChanged(intent);
+ callStateChanged(intent.getStringExtra("CallID"), intent.getStringExtra("State"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.CONF_CREATED)) {
- confCreated(intent);
+ confCreated(intent.getStringExtra("confID"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.CONF_REMOVED)) {
- confRemoved(intent);
+ confRemoved(intent.getStringExtra("confID"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.CONF_CHANGED)) {
- confChanged(intent);
+ confChanged(intent.getStringExtra("confID"), intent.getStringExtra("state"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.RECORD_STATE_CHANGED)) {
- recordingChanged(intent);
+ recordingChanged(intent.getStringExtra("callID"), intent.getStringExtra("file"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.ZRTP_OFF)) {
- secureZrtpOff(intent);
+ secureZrtpOff(intent.getStringExtra("callID"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.ZRTP_ON)) {
- secureZrtpOn(intent);
+ secureZrtpOn(intent.getStringExtra("callID"));
} else if (intent.getAction().contentEquals(CallManagerCallBack.DISPLAY_SAS)) {
- displaySAS(intent);
+ displaySAS(intent.getStringExtra("callID"), intent.getStringExtra("SAS"), intent.getBooleanExtra("verified", false));
} else {
Log.e(TAG, "Unknown action: " + intent.getAction());
}
diff --git a/src/org/sflphone/fragments/IMFragment.java b/src/org/sflphone/fragments/IMFragment.java
index 6ec7e39..f9e63b8 100644
--- a/src/org/sflphone/fragments/IMFragment.java
+++ b/src/org/sflphone/fragments/IMFragment.java
@@ -33,6 +33,7 @@
import android.widget.*;
import org.sflphone.R;
import org.sflphone.adapters.DiscussArrayAdapter;
+import org.sflphone.model.Conference;
import org.sflphone.model.SipMessage;
import org.sflphone.service.ISipService;
@@ -67,10 +68,11 @@
}
@Override
- public void incomingText(Intent in) {
- Bundle b = in.getBundleExtra("com.savoirfairelinux.sflphone.service.newtext");
- SipMessage msg = new SipMessage(true, b.getString("Msg"));
- putMessage(msg);
+ public void incomingText(String ID, String from, String msg) {
+ if (mCallbacks.getDisplayedConference().getId().contentEquals(ID)) {
+ SipMessage sipMsg = new SipMessage(true, msg);
+ putMessage(sipMsg);
+ }
}
@@ -85,6 +87,11 @@
}
@Override
+ public Conference getDisplayedConference() {
+ return null;
+ }
+
+ @Override
public boolean sendIM(SipMessage msg) {
return false;
}
@@ -97,6 +104,8 @@
public interface Callbacks {
public ISipService getService();
+ public Conference getDisplayedConference();
+
public boolean sendIM(SipMessage msg);
}
diff --git a/src/org/sflphone/fragments/MenuFragment.java b/src/org/sflphone/fragments/MenuFragment.java
index dde43fd..9ffde1c 100644
--- a/src/org/sflphone/fragments/MenuFragment.java
+++ b/src/org/sflphone/fragments/MenuFragment.java
@@ -201,11 +201,6 @@
getLoaderManager().restartLoader(LoaderConstants.ACCOUNTS_LOADER, null, this);
}
- public void updateAccount(Intent accountState) {
- if (mAccountAdapter != null)
- mAccountAdapter.updateAccount(accountState);
- }
-
@Override
public void accountsChanged() {
updateAllAccounts();
@@ -213,9 +208,9 @@
}
@Override
- public void accountStateChanged(Intent accountState) {
- updateAccount(accountState);
-
+ public void accountStateChanged(String accoundID, String state, int code) {
+ if (mAccountAdapter != null)
+ mAccountAdapter.updateAccount(accoundID, state, code);
}
@Override
diff --git a/src/org/sflphone/interfaces/AccountsInterface.java b/src/org/sflphone/interfaces/AccountsInterface.java
index 32e9492..b41f229 100644
--- a/src/org/sflphone/interfaces/AccountsInterface.java
+++ b/src/org/sflphone/interfaces/AccountsInterface.java
@@ -30,13 +30,11 @@
*/
package org.sflphone.interfaces;
-import android.content.Intent;
-
public interface AccountsInterface {
public void accountsChanged();
- public void accountStateChanged(Intent accountState);
+ public void accountStateChanged(String accoundID, String state, int code);
}
diff --git a/src/org/sflphone/interfaces/CallInterface.java b/src/org/sflphone/interfaces/CallInterface.java
index 708d59e..3a3fd61 100644
--- a/src/org/sflphone/interfaces/CallInterface.java
+++ b/src/org/sflphone/interfaces/CallInterface.java
@@ -31,29 +31,25 @@
package org.sflphone.interfaces;
-import android.content.Intent;
-
public interface CallInterface {
- public void callStateChanged(Intent callState);
+ public void callStateChanged(String callID, String state);
- public void incomingText(Intent msg);
+ public void incomingText(String ID, String from, String msg);
- public void confCreated(Intent intent);
+ public void confCreated(String id);
- public void confRemoved(Intent intent);
+ public void confRemoved(String id);
- public void confChanged(Intent intent);
-
- public void recordingChanged(Intent intent);
+ public void confChanged(String id, String state);
- public void secureZrtpOn(Intent intent);
+ public void recordingChanged(String callID, String filename);
- public void secureZrtpOff(Intent intent);
+ public void secureZrtpOn(String id);
- public void displaySAS(Intent intent);
+ public void secureZrtpOff(String id);
+
+ public void displaySAS(String callID, String SAS, boolean verified);
-
-
}
diff --git a/src/org/sflphone/service/CallManagerCallBack.java b/src/org/sflphone/service/CallManagerCallBack.java
index 093b10e..97e1fab 100644
--- a/src/org/sflphone/service/CallManagerCallBack.java
+++ b/src/org/sflphone/service/CallManagerCallBack.java
@@ -27,6 +27,8 @@
static public final String ZRTP_ON = "secure_zrtp_on";
static public final String ZRTP_OFF = "secure_zrtp_off";
static public final String DISPLAY_SAS = "display_sas";
+ static public final String ZRTP_NEGOTIATION_FAILED = "zrtp_nego_failed";
+ static public final String ZRTP_NOT_SUPPORTED = "zrtp_not_supported";
public CallManagerCallBack(SipService context) {
@@ -36,12 +38,10 @@
@Override
public void on_call_state_changed(String callID, String newState) {
Log.d(TAG, "on_call_state_changed : (" + callID + ", " + newState + ")");
- Bundle bundle = new Bundle();
- bundle.putString("CallID", callID);
- bundle.putString("State", newState);
- Intent intent = new Intent(CALL_STATE_CHANGED);
- intent.putExtra("com.savoirfairelinux.sflphone.service.newstate", bundle);
+ Intent intent = new Intent(CALL_STATE_CHANGED);
+ intent.putExtra("CallID", callID);
+ intent.putExtra("State", newState);
if (newState.equals("RINGING")) {
try {
mService.getConferences().get(callID).setCallState(callID, SipCall.state.CALL_STATE_RINGING);
@@ -202,7 +202,7 @@
}
}
}
- intent.putExtra("newconf", created);
+ intent.putExtra("confID", created.getId());
mService.getConferences().put(created.getId(), created);
mService.sendBroadcast(intent);
}
@@ -210,14 +210,10 @@
@Override
public void on_incoming_message(String ID, String from, String msg) {
Log.w(TAG, "on_incoming_message:" + msg);
- Bundle bundle = new Bundle();
-
- bundle.putString("CallID", ID);
- bundle.putString("From", from);
- bundle.putString("Msg", msg);
Intent intent = new Intent(INCOMING_TEXT);
- intent.putExtra("com.savoirfairelinux.sflphone.service.newtext", bundle);
-
+ intent.putExtra("CallID", ID);
+ intent.putExtra("From", from);
+ intent.putExtra("Msg", msg);
if (mService.getConferences().get(ID) != null) {
mService.getConferences().get(ID).addSipMessage(new SipMessage(true, msg));
@@ -270,7 +266,7 @@
if (toModify.getParticipants().size() < newParticipants.size()) {
// We need to add the new participant to the conf
for (int i = 0; i < newParticipants.size(); ++i) {
- if(toModify.getCallById(newParticipants.get(i))==null){
+ if (toModify.getCallById(newParticipants.get(i)) == null) {
mService.addCallToConference(toModify.getId(), newParticipants.get(i));
}
}
@@ -289,7 +285,7 @@
@Override
public void on_record_playback_filepath(String id, String filename) {
Intent intent = new Intent(RECORD_STATE_CHANGED);
- intent.putExtra("id", id);
+ intent.putExtra("callID", id);
intent.putExtra("file", filename);
mService.sendBroadcast(intent);
}
@@ -318,33 +314,51 @@
public void on_secure_zrtp_off(String callID) {
Log.i(TAG, "on_secure_zrtp_off");
SipCall call = mService.getCallById(callID);
- call.setSecured(false);
- Intent intent = new Intent(ZRTP_OFF);
- intent.putExtra("callID", callID);
- mService.sendBroadcast(intent);
+
+ if (call != null) {
+ call.setSecured(false);
+ Intent intent = new Intent(ZRTP_OFF);
+ intent.putExtra("callID", callID);
+ mService.sendBroadcast(intent);
+ }
}
@Override
public void on_show_sas(String callID, String sas, boolean verified) {
- Log.i(TAG, "on_show_sas:"+ sas);
- Log.i(TAG, "SAS Verified:"+ verified);
+ Log.i(TAG, "on_show_sas:" + sas);
+ Log.i(TAG, "SAS Verified:" + verified);
SipCall call = mService.getCallById(callID);
call.setSAS(sas);
call.setConfirmedSAS(verified);
Intent intent = new Intent(DISPLAY_SAS);
intent.putExtra("callID", callID);
+ intent.putExtra("SAS", sas);
+ intent.putExtra("verified", verified);
+
mService.sendBroadcast(intent);
}
@Override
public void on_zrtp_not_supported(String callID) {
Log.i(TAG, "on_zrtp_not_supported");
+ Intent intent = new Intent(ZRTP_NOT_SUPPORTED);
+ SipCall call = mService.getCallById(callID);
+ call.setSecured(false);
+ intent.putExtra("callID", callID);
+ mService.sendBroadcast(intent);
}
@Override
public void on_zrtp_negociation_failed(String callID, String reason, String severity) {
Log.i(TAG, "on_zrtp_negociation_failed");
+ Intent intent = new Intent(ZRTP_NEGOTIATION_FAILED);
+ SipCall call = mService.getCallById(callID);
+ call.setSecured(false);
+ intent.putExtra("callID", callID);
+ intent.putExtra("reason", reason);
+ intent.putExtra("severity", severity);
+ mService.sendBroadcast(intent);
}
}
diff --git a/src/org/sflphone/service/ConfigurationManagerCallback.java b/src/org/sflphone/service/ConfigurationManagerCallback.java
index 8d40272..77c157c 100644
--- a/src/org/sflphone/service/ConfigurationManagerCallback.java
+++ b/src/org/sflphone/service/ConfigurationManagerCallback.java
@@ -25,7 +25,7 @@
import android.content.Intent;
public class ConfigurationManagerCallback extends ConfigurationCallback {
-// private static final String TAG = "ConfigurationManagerCallback";
+
private SipService mService;
static public final String ACCOUNTS_CHANGED = "accounts-changed";
diff --git a/src/org/sflphone/service/ISipService.aidl b/src/org/sflphone/service/ISipService.aidl
index cb8b64c..418fe1b 100644
--- a/src/org/sflphone/service/ISipService.aidl
+++ b/src/org/sflphone/service/ISipService.aidl
@@ -49,8 +49,10 @@
/* Mute */
void setMuted(boolean mute);
boolean isCaptureMuted();
-
-
+
+ /* Security */
+ void confirmSAS(in String callID);
+
/* DTMF */
void playDtmf(in String key);
diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java
index d381b10..a2ccf2a 100644
--- a/src/org/sflphone/service/SipService.java
+++ b/src/org/sflphone/service/SipService.java
@@ -1082,21 +1082,6 @@
});
}
-/* @Override
- public Conference getCallById(String callID) throws RemoteException {
- if(mConferences.containsKey(callID))
- return mConferences.get(callID);
- else{
- Iterator<Conference> it = getConferences().values().iterator();
- while (it.hasNext()) {
- Conference c = it.next();
- if (c.getCallById(callID) != null)
- return c;
- }
- }
- return null;
- }*/
-
/***********************
* Notification API
***********************/
@@ -1182,6 +1167,17 @@
}
@Override
+ public void confirmSAS(final String callID) throws RemoteException {
+ getExecutor().execute(new SipRunnable() {
+ @Override
+ protected void doRun() throws SameThreadException, RemoteException {
+ Log.i(TAG, "SipService.confirmSAS() thread running...");
+ callManagerJNI.setSASVerified(callID);
+ }
+ });
+ }
+
+ @Override
public List getCredentials(final String accountID) throws RemoteException {
class Credentials extends SipRunnableWithReturn {