* #38606: client now handles only Conferences
Every call is considered has a Conference, holding one or several SipCall.
This simplify extraction and storage of calls in history. It also provide a unique interface
to handle calls instead of two (which were SipCall and Conference).
diff --git a/src/org/sflphone/service/CallManagerCallBack.java b/src/org/sflphone/service/CallManagerCallBack.java
index 8126c8b..5ba0d67 100644
--- a/src/org/sflphone/service/CallManagerCallBack.java
+++ b/src/org/sflphone/service/CallManagerCallBack.java
@@ -2,22 +2,20 @@
import android.content.Intent;
import android.os.Bundle;
-import android.os.RemoteException;
import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
import org.sflphone.client.CallActivity;
import org.sflphone.model.*;
+import org.sflphone.utils.SwigNativeConverter;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
public class CallManagerCallBack extends Callback {
-
+
private static final String TAG = "CallManagerCallBack";
- private final ISipService.Stub mBinder;
- private SipService mService;
+ private SipService mService;
static public final String CALL_STATE_CHANGED = "call-state-changed";
static public final String INCOMING_CALL = "incoming-call";
@@ -28,14 +26,13 @@
static public final String RECORD_STATE_CHANGED = "record_state";
- public CallManagerCallBack(SipService context, ISipService.Stub bind) {
+ public CallManagerCallBack(SipService context) {
mService = context;
- mBinder = bind;
}
@Override
public void on_call_state_changed(String callID, String newState) {
- Log.d(TAG, "on_call_state_changed : (" + callID + ", " + newState + ")");
+ Log.d(TAG, "on_call_state_changed : (" + callID + ", " + newState + ")");
Bundle bundle = new Bundle();
bundle.putString("CallID", callID);
bundle.putString("State", newState);
@@ -52,23 +49,23 @@
if (newState.equals("INCOMING")) {
- mService.getCurrentCalls().get(callID).setCallState(SipCall.state.CALL_STATE_INCOMING);
+ mService.getCurrentConfs().get(callID).setCallState(callID, SipCall.state.CALL_STATE_INCOMING);
} else if (newState.equals("RINGING")) {
try {
- mService.getCurrentCalls().get(callID).setCallState(SipCall.state.CALL_STATE_RINGING);
+ mService.getCurrentConfs().get(callID).setCallState(callID, SipCall.state.CALL_STATE_RINGING);
} catch (NullPointerException e) {
- if (mService.getCurrentCalls() == null) {
+ if (mService.getCurrentConfs() == null) {
return;
}
- if (mService.getCurrentCalls().get(callID) == null) {
+ if (mService.getCurrentConfs().get(callID) == null) {
Log.e(TAG, "call for " + callID + " is null");
return;
}
}
} else if (newState.equals("CURRENT")) {
- if (mService.getCurrentCalls().get(callID) != null) {
- mService.getCurrentCalls().get(callID).setCallState(SipCall.state.CALL_STATE_CURRENT);
+ if (mService.getCurrentConfs().get(callID) != null) {
+ mService.getCurrentConfs().get(callID).setCallState(callID, SipCall.state.CALL_STATE_CURRENT);
} else {
// Check if call is in a conference
Iterator<Map.Entry<String, Conference>> it = mService.getCurrentConfs().entrySet().iterator();
@@ -84,11 +81,11 @@
} else if (newState.equals("HUNGUP")) {
Log.d(TAG, "Hanging up " + callID);
- if (mService.getCurrentCalls().get(callID) != null) {
- if (mService.getCurrentCalls().get(callID).isRinging()
- && mService.getCurrentCalls().get(callID).isIncoming())
- mService.notificationManager.publishMissedCallNotification(mService.getCurrentCalls().get(callID));
- mService.getCurrentCalls().remove(callID);
+ if (mService.getCurrentConfs().get(callID) != null) {
+ if (mService.getCurrentConfs().get(callID).isRinging()
+ && mService.getCurrentConfs().get(callID).isIncoming())
+ mService.notificationManager.publishMissedCallNotification(mService.getCurrentConfs().get(callID));
+ mService.getCurrentConfs().remove(callID);
} else {
ArrayList<Conference> it = new ArrayList<Conference>(mService.getCurrentConfs().values());
@@ -109,15 +106,13 @@
}
}
- mService.sendBroadcast(intent);
-
} else if (newState.equals("BUSY")) {
- mService.getCurrentCalls().remove(callID);
+ mService.getCurrentConfs().remove(callID);
} else if (newState.equals("FAILURE")) {
- mService.getCurrentCalls().remove(callID);
+ mService.getCurrentConfs().remove(callID);
} else if (newState.equals("HOLD")) {
- if (mService.getCurrentCalls().get(callID) != null) {
- mService.getCurrentCalls().get(callID).setCallState(SipCall.state.CALL_STATE_HOLD);
+ if (mService.getCurrentConfs().get(callID) != null) {
+ mService.getCurrentConfs().get(callID).setCallState(callID, SipCall.state.CALL_STATE_HOLD);
} else {
// Check if call is in a conference
Iterator<Map.Entry<String, Conference>> it = mService.getCurrentConfs().entrySet().iterator();
@@ -131,8 +126,8 @@
}
} else if (newState.equals("UNHOLD")) {
- if (mService.getCurrentCalls().get(callID) != null) {
- mService.getCurrentCalls().get(callID).setCallState(SipCall.state.CALL_STATE_CURRENT);
+ if (mService.getCurrentConfs().get(callID) != null) {
+ mService.getCurrentConfs().get(callID).setCallState(callID, SipCall.state.CALL_STATE_CURRENT);
} else {
// Check if call is in a conference
Iterator<Map.Entry<String, Conference>> it = mService.getCurrentConfs().entrySet().iterator();
@@ -145,7 +140,7 @@
}
}
} else {
- mService.getCurrentCalls().get(callID).setCallState(SipCall.state.CALL_STATE_NONE);
+ mService.getCurrentConfs().get(callID).setCallState(callID, SipCall.state.CALL_STATE_NONE);
}
@@ -160,10 +155,9 @@
SipCall.SipCallBuilder callBuilder = SipCall.SipCallBuilder.getInstance();
try {
- HashMap<String, String> details = (HashMap<String, String>) mBinder.getAccountDetails(accountID);
- ArrayList<HashMap<String, String>> credentials = (ArrayList<HashMap<String, String>>) mBinder
- .getCredentials(accountID);
- Account acc = new Account(accountID, details, credentials);
+ StringMap details = mService.getConfigurationManagerJNI().getAccountDetails(accountID);
+ VectMap credentials = mService.getConfigurationManagerJNI().getCredentials(accountID);
+ Account acc = new Account(accountID, SwigNativeConverter.convertAccountToNative(details), SwigNativeConverter.convertCredentialsToNative(credentials));
callBuilder.startCallCreation(callID).setAccount(acc).setCallState(SipCall.state.CALL_STATE_RINGING)
.setCallType(SipCall.state.CALL_TYPE_INCOMING);
callBuilder.setContact(CallContact.ContactBuilder.buildUnknownContact(from));
@@ -174,99 +168,116 @@
SipCall newCall = callBuilder.build();
toSend.putExtra("newcall", newCall);
- HashMap<String, String> callDetails = (HashMap<String, String>) mBinder.getCallDetails(callID);
+ StringMap callDetails = mService.getCallManagerJNI().getCallDetails(callID);
newCall.setTimestamp_start(Long.parseLong(callDetails.get(ServiceConstants.call.TIMESTAMP_START)));
- mService.getCurrentCalls().put(newCall.getCallId(), newCall);
+
+ Conference toAdd = new Conference(newCall);
+
+ mService.getCurrentConfs().put(toAdd.getId(), toAdd);
Bundle bundle = new Bundle();
- Conference tmp = new Conference("-1");
- tmp.getParticipants().add(newCall);
-
- bundle.putParcelable("conference", tmp);
+ bundle.putParcelable("conference", toAdd);
toSend.putExtra("resuming", false);
toSend.putExtras(bundle);
mService.startActivity(toSend);
mService.mediaManager.startRing("");
mService.mediaManager.obtainAudioFocus(true);
- } catch (RemoteException e1) {
- e1.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
-
+
@Override
- public void on_transfer_state_changed(String result){
- Log.w(TAG,"TRANSFER STATE CHANGED:"+result);
+ public void on_transfer_state_changed(String result) {
+ Log.w(TAG, "TRANSFER STATE CHANGED:" + result);
}
-
+
@Override
- public void on_conference_created(String confID){
- Log.w(TAG,"CONFERENCE CREATED:"+confID);
+ public void on_conference_created(final String confID) {
+ Log.w(TAG, "CONFERENCE CREATED:" + confID);
Intent intent = new Intent(CONF_CREATED);
Conference created = new Conference(confID);
- try {
- ArrayList<String> all_participants = (ArrayList<String>) mBinder.getParticipantList(intent.getStringExtra("confID"));
- for (String participant : all_participants) {
- created.getParticipants().add(mService.getCurrentCalls().get(participant));
- mService.getCurrentCalls().remove(participant);
+ StringVect all_participants = mService.getCallManagerJNI().getParticipantList(confID);
+ Log.w(TAG, "all_participants:" + all_participants.size());
+ for (int i = 0; i < all_participants.size(); ++i) {
+ if (mService.getCurrentConfs().get(all_participants.get(i)) != null) {
+ created.addParticipant(mService.getCurrentConfs().get(all_participants.get(i)).getCallById(all_participants.get(i)));
+ mService.getCurrentConfs().remove(all_participants.get(i));
+ } else {
+ Iterator<Map.Entry<String, Conference>> it = mService.getCurrentConfs().entrySet().iterator();
+ while (it.hasNext()) {
+ Conference tmp = it.next().getValue();
+ for (SipCall c : tmp.getParticipants()) {
+ if (c.getCallId().contentEquals(all_participants.get(i))) {
+ created.addParticipant(c);
+ mService.getCurrentConfs().get(tmp.getId()).removeParticipant(c.getCallId());
+ }
+ }
+ }
}
- intent.putExtra("newconf", created);
- mService.getCurrentConfs().put(confID, created);
- mService.sendBroadcast(intent);
- } catch (RemoteException e1) {
- e1.printStackTrace();
}
- Log.i(TAG, "current_confs size " + mService.getCurrentConfs().size());
+ intent.putExtra("newconf", created);
+ mService.getCurrentConfs().put(created.getId(), created);
+ mService.sendBroadcast(intent);
}
-
+
@Override
- public void on_incoming_message(String ID, String from, String msg){
- Log.w(TAG,"on_incoming_message:"+msg);
+ 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 intent = new Intent(INCOMING_TEXT);
intent.putExtra("com.savoirfairelinux.sflphone.service.newtext", bundle);
- if (mService.getCurrentCalls().get(ID) != null) {
- mService.getCurrentCalls().get(ID).addSipMessage(new SipMessage(true, msg));
- } else if (mService.getCurrentConfs().get(ID) != null) {
+ if (mService.getCurrentConfs().get(ID) != null) {
mService.getCurrentConfs().get(ID).addSipMessage(new SipMessage(true, msg));
- } else
- return;
+ } else {
+ Iterator<Map.Entry<String, Conference>> it = mService.getCurrentConfs().entrySet().iterator();
+ while (it.hasNext()) {
+ Conference tmp = it.next().getValue();
+ for (SipCall c : tmp.getParticipants()) {
+ if (c.getCallId().contentEquals(ID)) {
+ mService.getCurrentConfs().get(tmp.getId()).addSipMessage(new SipMessage(true, msg));
+ }
+ }
+ }
+
+ }
mService.sendBroadcast(intent);
}
-
+
@Override
- public void on_conference_removed(String confID){
+ public void on_conference_removed(String confID) {
Intent intent = new Intent(CONF_REMOVED);
intent.putExtra("confID", confID);
- Conference toDestroy = mService.getCurrentConfs().get(confID);
- for (int i = 0; i < toDestroy.getParticipants().size(); ++i) {
+ Conference toReInsert = mService.getCurrentConfs().get(confID);
+ /*for (int i = 0; i < toDestroy.getParticipants().size(); ++i) {
mService.getCurrentCalls().put(toDestroy.getParticipants().get(i).getCallId(), toDestroy.getParticipants().get(i));
- }
+ }*/
mService.getCurrentConfs().remove(confID);
+ mService.getCurrentConfs().put(toReInsert.getId(), toReInsert);
mService.sendBroadcast(intent);
}
-
+
@Override
- public void on_conference_state_changed(String confID, String state){
+ public void on_conference_state_changed(String confID, String state) {
+
Intent intent = new Intent(CONF_CHANGED);
intent.putExtra("confID", confID);
intent.putExtra("State", state);
ArrayList<String> all_participants;
- try {
+/* try {
all_participants = (ArrayList<String>) mBinder.getParticipantList(intent.getStringExtra("confID"));
for (String participant : all_participants) {
if (mService.getCurrentConfs().get(confID).getParticipants().size() < all_participants.size()
@@ -281,17 +292,17 @@
}
} catch (RemoteException e) {
e.printStackTrace();
- }
+ }*/
Log.i(TAG, "Received" + intent.getAction());
if (mService.getCurrentConfs().get(confID) != null) {
- mService.getCurrentConfs().get(confID).setState(intent.getStringExtra("State"));
+ mService.getCurrentConfs().get(confID).setCallState(confID, state);
mService.sendBroadcast(intent);
}
}
-
+
@Override
- public void on_record_playback_filepath(String id, String filename){
+ public void on_record_playback_filepath(String id, String filename) {
Intent intent = new Intent(RECORD_STATE_CHANGED);
intent.putExtra("id", id);
intent.putExtra("file", filename);
diff --git a/src/org/sflphone/service/ConfigurationManagerCallback.java b/src/org/sflphone/service/ConfigurationManagerCallback.java
index 0a02925..32c2e9c 100644
--- a/src/org/sflphone/service/ConfigurationManagerCallback.java
+++ b/src/org/sflphone/service/ConfigurationManagerCallback.java
@@ -22,21 +22,17 @@
*/
package org.sflphone.service;
-import android.content.Context;
import android.content.Intent;
-import android.support.v4.content.LocalBroadcastManager;
public class ConfigurationManagerCallback extends ConfigurationCallback {
// private static final String TAG = "ConfigurationManagerCallback";
-private final ISipService.Stub mBinder;
private SipService mService;
static public final String ACCOUNTS_CHANGED = "accounts-changed";
static public final String ACCOUNT_STATE_CHANGED = "account-state-changed";
- public ConfigurationManagerCallback(SipService context, ISipService.Stub bind) {
+ public ConfigurationManagerCallback(SipService context) {
mService = context;
- mBinder = bind;
}
@Override
diff --git a/src/org/sflphone/service/ISipService.aidl b/src/org/sflphone/service/ISipService.aidl
index c4c5e18..cb8b64c 100644
--- a/src/org/sflphone/service/ISipService.aidl
+++ b/src/org/sflphone/service/ISipService.aidl
@@ -74,16 +74,13 @@
void unholdConference(in String confID);
boolean isConferenceParticipant(in String callID);
Map getConferenceList();
- Map getCallList();
List getParticipantList(in String confID);
String getConferenceId(in String callID);
String getConferenceDetails(in String callID);
Conference getCurrentCall();
List getConcurrentCalls();
-
-
- /* */
-
- SipCall getCall(String callID);
+
+ Conference getConference(in String id);
+
}
diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java
index c76ad97..bfc6ac2 100644
--- a/src/org/sflphone/service/SipService.java
+++ b/src/org/sflphone/service/SipService.java
@@ -49,7 +49,6 @@
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
-import android.support.v4.content.LocalBroadcastManager;
import android.util.Log;
public class SipService extends Service {
@@ -57,9 +56,19 @@
static final String TAG = "SipService";
private SipServiceExecutor mExecutor;
private static HandlerThread executorThread;
+
+ public CallManager getCallManagerJNI() {
+ return callManagerJNI;
+ }
+
private CallManager callManagerJNI;
private ManagerImpl managerImpl;
private CallManagerCallBack callManagerCallBack;
+
+ public ConfigurationManager getConfigurationManagerJNI() {
+ return configurationManagerJNI;
+ }
+
private ConfigurationManager configurationManagerJNI;
private ConfigurationManagerCallback configurationManagerCallback;
private boolean isPjSipStackStarted = false;
@@ -67,16 +76,16 @@
public SipNotifications notificationManager;
public MediaManager mediaManager;
- private HashMap<String, SipCall> current_calls = new HashMap<String, SipCall>();
+ /*private HashMap<String, SipCall> current_calls = new HashMap<String, SipCall>();*/
private HashMap<String, Conference> current_confs = new HashMap<String, Conference>();
public HashMap<String, Conference> getCurrentConfs() {
return current_confs;
}
- public HashMap<String, SipCall> getCurrentCalls() {
+ /*public HashMap<String, SipCall> getCurrentCalls() {
return current_calls;
- }
+ }*/
@Override
public boolean onUnbind(Intent i) {
@@ -144,28 +153,27 @@
public SipServiceExecutor getExecutor() {
// create mExecutor lazily
if (mExecutor == null) {
- mExecutor = new SipServiceExecutor(this);
+ mExecutor = new SipServiceExecutor();
}
return mExecutor;
}
// Executes immediate tasks in a single executorThread.
public static class SipServiceExecutor extends Handler {
- WeakReference<SipService> handlerService;
- SipServiceExecutor(SipService s) {
+ SipServiceExecutor() {
super(createLooper());
- handlerService = new WeakReference<SipService>(s);
}
public void execute(Runnable task) {
// TODO: add wakelock
- Message.obtain(this, 0/* don't care */, task).sendToTarget();
+ Message.obtain(SipServiceExecutor.this, 0/* don't care */, task).sendToTarget();
Log.w(TAG, "SenT!");
}
@Override
public void handleMessage(Message msg) {
+ Log.w(TAG, "handleMessage");
if (msg.obj instanceof Runnable) {
executeInternal((Runnable) msg.obj);
} else {
@@ -216,11 +224,11 @@
// managerImpl.setPath(getApplication().getFilesDir().getAbsolutePath());
callManagerJNI = new CallManager();
- callManagerCallBack = new CallManagerCallBack(this, mBinder);
+ callManagerCallBack = new CallManagerCallBack(this);
SFLPhoneservice.setCallbackObject(callManagerCallBack);
configurationManagerJNI = new ConfigurationManager();
- configurationManagerCallback = new ConfigurationManagerCallback(this, mBinder);
+ configurationManagerCallback = new ConfigurationManagerCallback(this);
SFLPhoneservice.setConfigurationCallbackObject(configurationManagerCallback);
managerImpl.init("");
@@ -255,7 +263,7 @@
Object obj = null;
boolean done = false;
- protected abstract Object doRun() throws SameThreadException;
+ protected abstract Object doRun() throws SameThreadException, RemoteException;
public Object getVal() {
return obj;
@@ -273,6 +281,8 @@
done = true;
} catch (SameThreadException e) {
Log.e(TAG, "Not done from same thread");
+ } catch (RemoteException e) {
+ Log.e(TAG, e.toString());
}
}
}
@@ -311,7 +321,8 @@
HashMap<String, String> details = SwigNativeConverter.convertCallDetailsToNative(callManagerJNI.getCallDetails(call.getCallId()));
// watchout timestamp stored by sflphone is in seconds
call.setTimestamp_start(Long.parseLong(details.get(ServiceConstants.call.TIMESTAMP_START)));
- getCurrentCalls().put(call.getCallId(), call);
+ Conference toAdd = new Conference(call);
+ current_confs.put(toAdd.getId(), toAdd);
mediaManager.obtainAudioFocus(false);
}
});
@@ -647,7 +658,7 @@
// Generate a CONF_CREATED callback
}
});
-
+ Log.i(TAG, "After joining participants");
}
@Override
@@ -688,7 +699,8 @@
Conference tmp = it.next().getValue();
Log.i(TAG, "conf has " + tmp.getParticipants().size() + " participants");
if (tmp.contains(callID)) {
- current_calls.put(callID, tmp.getCall(callID));
+ Conference toDetach = new Conference(tmp.getCallById(callID));
+ current_confs.put(toDetach.getId(), toDetach);
Log.i(TAG, "Call found and put in current_calls");
}
}
@@ -796,7 +808,7 @@
class PartList extends SipRunnableWithReturn {
@Override
protected StringVect doRun() throws SameThreadException {
- Log.i(TAG, "SipService.getAccountList() thread running...");
+ Log.i(TAG, "SipService.getParticipantList() thread running...");
return callManagerJNI.getParticipantList(confID);
}
}
@@ -804,10 +816,10 @@
PartList runInstance = new PartList();
getExecutor().execute(runInstance);
while (!runInstance.isDone()) {
- // Log.w(TAG, "Waiting for getConferenceList");
+ Log.w(TAG, "getParticipantList");
}
StringVect swigvect = (StringVect) runInstance.getVal();
-
+ Log.w(TAG, "After that");
ArrayList<String> nativelist = new ArrayList<String>();
for (int i = 0; i < swigvect.size(); i++)
@@ -873,17 +885,14 @@
Log.i(TAG, "SipService.toggleRecordingCall() thread running...");
boolean result = callManagerJNI.toggleRecording(id);
- if (getCurrentCalls().containsKey(id)) {
- getCurrentCalls().get(id).setRecording(result);
- } else if (getCurrentConfs().containsKey(id)) {
+ if (getCurrentConfs().containsKey(id)) {
getCurrentConfs().get(id).setRecording(result);
} else {
- // A call in a conference has been put on hold
Iterator<Conference> it = getCurrentConfs().values().iterator();
while (it.hasNext()) {
Conference c = it.next();
- if (c.getCall(id) != null)
- c.getCall(id).setRecording(result);
+ if (c.getCallById(id) != null)
+ c.getCallById(id).setRecording(result);
}
}
return result;
@@ -940,9 +949,7 @@
protected void doRun() throws SameThreadException, RemoteException {
Log.i(TAG, "SipService.sendTextMessage() thread running...");
callManagerJNI.sendTextMessage(callID, message.comment);
- if (getCurrentCalls().get(callID) != null)
- getCurrentCalls().get(callID).addSipMessage(message);
- else if (getCurrentConfs().get(callID) != null)
+ if (getCurrentConfs().get(callID) != null)
getCurrentConfs().get(callID).addSipMessage(message);
}
});
@@ -964,10 +971,6 @@
results.add(new Codec(active_payloads.get(i), configurationManagerJNI.getAudioCodecDetails(active_payloads.get(i)), true));
}
-
- // if (results.get(active_payloads.get(i)) != null) {
- // results.get(active_payloads.get(i)).setEnabled(true);
-
IntVect payloads = configurationManagerJNI.getAudioCodecList();
for (int i = 0; i < payloads.size(); ++i) {
@@ -984,11 +987,6 @@
}
- // if (!results.containsKey(payloads.get(i))) {
- // results.put(payloads.get(i), new Codec(payloads.get(i), configurationManagerJNI.getAudioCodecDetails(payloads.get(i)), false));
- // Log.i(TAG, "Other, Adding:" + results.get((payloads.get(i))).getName());
- // }
-
return results;
}
}
@@ -1040,84 +1038,46 @@
});
}
- @Override
- public HashMap<String, SipCall> getCallList() throws RemoteException {
- // class CallList extends SipRunnableWithReturn {
- //
- // @Override
- // protected StringVect doRun() throws SameThreadException {
- // Log.i(TAG, "SipService.getCallList() thread running...incoming");
- // return callManagerJNI.getCallList();
- // }
- // }
- //
- // CallList runInstance = new CallList();
- // getExecutor().execute(runInstance);
- // while (!runInstance.isDone()) {
- // Log.w(TAG, "Waiting for getAudioCodecList");
- // }
- // StringVect swigmap = (StringVect) runInstance.getVal();
- //
- // ArrayList<String> nativemap = new ArrayList<String>();
- // for (int i = 0; i < swigmap.size(); ++i) {
- //
- // String t = swigmap.get(i);
- // nativemap.add(t);
- // }
- // if(callManagerJNI == null)
- // return new HashMap<String, SipCall>();
- //
- //
- // HashMap<String, SipCall> results = new HashMap<String, SipCall>();
- // StringVect calls = callManagerJNI.getCallList();
- // for(int i = 0 ; i < calls.size(); ++i){
- // results.put(calls.get(i), new SipCall(calls.get(i), callManagerJNI.getCallDetails(calls.get(i))));
- // }
-
- return getCurrentCalls();
- }
-
- @Override
- public SipCall getCall(String callID) throws RemoteException {
- return getCurrentCalls().get(callID);
- }
+/* @Override
+ public Conference getCallById(String callID) throws RemoteException {
+ if(current_confs.containsKey(callID))
+ return current_confs.get(callID);
+ else{
+ Iterator<Conference> it = getCurrentConfs().values().iterator();
+ while (it.hasNext()) {
+ Conference c = it.next();
+ if (c.getCallById(callID) != null)
+ return c;
+ }
+ }
+ return null;
+ }*/
/***********************
* Notification API
***********************/
@Override
public void createNotification() throws RemoteException {
- notificationManager.makeNotification(getCurrentCalls());
}
@Override
public void destroyNotification() throws RemoteException {
- notificationManager.removeNotification();
}
@Override
public Conference getCurrentCall() throws RemoteException {
- for (SipCall i : current_calls.values()) {
-
- // Incoming >> Ongoing
- if (i.isIncoming()) {
- Conference tmp = new Conference("-1");
- tmp.getParticipants().add(i);
- return tmp;
- }
-
- if (i.isOngoing()) {
- Conference tmp = new Conference("-1");
- tmp.getParticipants().add(i);
- return tmp;
- }
+ for (Conference conf : current_confs.values()) {
+ if (conf.isIncoming())
+ return conf;
}
- if (!current_confs.isEmpty()) {
- return (Conference) current_confs.values().toArray()[0];
+ for (Conference conf : current_confs.values()) {
+ if (conf.isOnGoing())
+ return conf;
}
+
return null;
}
@@ -1134,19 +1094,12 @@
@Override
public List getConcurrentCalls() throws RemoteException {
- ArrayList<Conference> toReturn = new ArrayList<Conference>();
+ return new ArrayList(current_confs.values());
+ }
- for (SipCall sip : current_calls.values()) {
- if (!sip.isCurrent()) {
- Conference tmp = new Conference("-1");
- tmp.getParticipants().add(sip);
- toReturn.add(tmp);
- }
- }
-
- Log.i(TAG, "toReturn SIZE " + toReturn.size());
-
- return toReturn;
+ @Override
+ public Conference getConference(String id) throws RemoteException {
+ return current_confs.get(id);
}
@Override