* #30152: added CallDetails API
diff --git a/src/com/savoirfairelinux/sflphone/account/CallDetailsHandler.java b/src/com/savoirfairelinux/sflphone/account/CallDetailsHandler.java
new file mode 100644
index 0000000..1731113
--- /dev/null
+++ b/src/com/savoirfairelinux/sflphone/account/CallDetailsHandler.java
@@ -0,0 +1,25 @@
+package com.savoirfairelinux.sflphone.account;
+
+import java.util.HashMap;
+
+import com.savoirfairelinux.sflphone.service.ServiceConstants;
+import com.savoirfairelinux.sflphone.service.StringMap;
+
+public class CallDetailsHandler {
+
+ public static HashMap<String, String> convertSwigToNative(StringMap swigmap) {
+
+ HashMap<String, String> entry = new HashMap<String, String>();
+
+ entry.put(ServiceConstants.call.CALL_TYPE, swigmap.get(ServiceConstants.call.CALL_TYPE));
+ entry.put(ServiceConstants.call.PEER_NUMBER, swigmap.get(ServiceConstants.call.PEER_NUMBER));
+ entry.put(ServiceConstants.call.DISPLAY_NAME, swigmap.get(ServiceConstants.call.DISPLAY_NAME));
+ entry.put(ServiceConstants.call.CALL_STATE, swigmap.get(ServiceConstants.call.CALL_STATE));
+ entry.put(ServiceConstants.call.CONF_ID, swigmap.get(ServiceConstants.call.CONF_ID));
+ entry.put(ServiceConstants.call.TIMESTAMP_START, swigmap.get(ServiceConstants.call.TIMESTAMP_START));
+ entry.put(ServiceConstants.call.ACCOUNTID, swigmap.get(ServiceConstants.call.ACCOUNTID));
+
+ return entry;
+ }
+
+}
diff --git a/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java b/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
index 9be19a4..130ef31 100644
--- a/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
+++ b/src/com/savoirfairelinux/sflphone/account/HistoryHandler.java
@@ -29,16 +29,16 @@
for (int i = 0; i < swigmap.size(); ++i) {
HashMap<String, String> entry = new HashMap<String, String>();
- entry.put(ServiceConstants.HISTORY_ACCOUNT_ID_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_ACCOUNT_ID_KEY));
- entry.put(ServiceConstants.HISTORY_CALLID_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_CALLID_KEY));
- entry.put(ServiceConstants.HISTORY_CONFID_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_CONFID_KEY));
- entry.put(ServiceConstants.HISTORY_DISPLAY_NAME_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_DISPLAY_NAME_KEY));
- entry.put(ServiceConstants.HISTORY_PEER_NUMBER_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_PEER_NUMBER_KEY));
- entry.put(ServiceConstants.HISTORY_RECORDING_PATH_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_RECORDING_PATH_KEY));
- entry.put(ServiceConstants.HISTORY_STATE_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_STATE_KEY));
- entry.put(ServiceConstants.HISTORY_TIMESTAMP_START_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_TIMESTAMP_START_KEY));
- entry.put(ServiceConstants.HISTORY_TIMESTAMP_STOP_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_TIMESTAMP_STOP_KEY));
- entry.put(ServiceConstants.HISTORY_AUDIO_CODEC_KEY, tryToGet(swigmap.get(i), ServiceConstants.HISTORY_AUDIO_CODEC_KEY));
+ entry.put(ServiceConstants.history.ACCOUNT_ID_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.ACCOUNT_ID_KEY));
+ entry.put(ServiceConstants.history.CALLID_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.CALLID_KEY));
+ entry.put(ServiceConstants.history.CONFID_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.CONFID_KEY));
+ entry.put(ServiceConstants.history.DISPLAY_NAME_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.DISPLAY_NAME_KEY));
+ entry.put(ServiceConstants.history.PEER_NUMBER_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.PEER_NUMBER_KEY));
+ entry.put(ServiceConstants.history.RECORDING_PATH_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.RECORDING_PATH_KEY));
+ entry.put(ServiceConstants.history.STATE_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.STATE_KEY));
+ entry.put(ServiceConstants.history.TIMESTAMP_START_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.TIMESTAMP_START_KEY));
+ entry.put(ServiceConstants.history.TIMESTAMP_STOP_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.TIMESTAMP_STOP_KEY));
+ entry.put(ServiceConstants.history.AUDIO_CODEC_KEY, tryToGet(swigmap.get(i), ServiceConstants.history.AUDIO_CODEC_KEY));
nativemap.add(entry);
}
diff --git a/src/com/savoirfairelinux/sflphone/loaders/HistoryLoader.java b/src/com/savoirfairelinux/sflphone/loaders/HistoryLoader.java
index ad33d90..719dcde 100644
--- a/src/com/savoirfairelinux/sflphone/loaders/HistoryLoader.java
+++ b/src/com/savoirfairelinux/sflphone/loaders/HistoryLoader.java
@@ -47,19 +47,19 @@
// Log.i(TAG, "history size:" + history.size());
CallContact.ContactBuilder builder = new CallContact.ContactBuilder();
for (HashMap<String, String> entry : history) {
- entry.get(ServiceConstants.HISTORY_ACCOUNT_ID_KEY);
- long timestampEnd = Long.parseLong(entry.get(ServiceConstants.HISTORY_TIMESTAMP_STOP_KEY));
- long timestampStart = Long.parseLong(entry.get(ServiceConstants.HISTORY_TIMESTAMP_START_KEY));
- String call_state = entry.get(ServiceConstants.HISTORY_STATE_KEY);
+ entry.get(ServiceConstants.history.ACCOUNT_ID_KEY);
+ long timestampEnd = Long.parseLong(entry.get(ServiceConstants.history.TIMESTAMP_STOP_KEY));
+ long timestampStart = Long.parseLong(entry.get(ServiceConstants.history.TIMESTAMP_START_KEY));
+ String call_state = entry.get(ServiceConstants.history.STATE_KEY);
- String number_called = entry.get(ServiceConstants.HISTORY_PEER_NUMBER_KEY);
+ String number_called = entry.get(ServiceConstants.history.PEER_NUMBER_KEY);
-// Log.w(TAG, "----------------------Record" + entry.get(ServiceConstants.HISTORY_RECORDING_PATH_KEY));
+// Log.w(TAG, "----------------------Record" + entry.get(ServiceConstants.history.RECORDING_PATH_KEY));
CallContact c = null;
if (historyEntries.containsKey(number_called)) {
historyEntries.get(number_called).addHistoryCall(
new HistoryCall(timestampStart, timestampEnd, number_called, call_state, entry
- .get(ServiceConstants.HISTORY_RECORDING_PATH_KEY)));
+ .get(ServiceConstants.history.RECORDING_PATH_KEY)));
} else {
Pattern p = Pattern.compile("<sip:([^@]+)@([^>]+)>");
@@ -87,9 +87,9 @@
} else {
c = ContactBuilder.buildUnknownContact(number_called);
}
- HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.HISTORY_ACCOUNT_ID_KEY), c);
+ HistoryEntry e = new HistoryEntry(entry.get(ServiceConstants.history.ACCOUNT_ID_KEY), c);
e.addHistoryCall(new HistoryCall(timestampStart, timestampEnd, number_called, call_state, entry
- .get(ServiceConstants.HISTORY_RECORDING_PATH_KEY)));
+ .get(ServiceConstants.history.RECORDING_PATH_KEY)));
historyEntries.put(number_called, e);
}
diff --git a/src/com/savoirfairelinux/sflphone/model/HistoryEntry.java b/src/com/savoirfairelinux/sflphone/model/HistoryEntry.java
index 860bc16..bc1c0de 100644
--- a/src/com/savoirfairelinux/sflphone/model/HistoryEntry.java
+++ b/src/com/savoirfairelinux/sflphone/model/HistoryEntry.java
@@ -106,9 +106,9 @@
public void addHistoryCall(HistoryCall historyCall) {
calls.put(historyCall.call_start, historyCall);
- if(historyCall.getState().contentEquals(ServiceConstants.HISTORY_MISSED_STRING)){
+ if(historyCall.getState().contentEquals(ServiceConstants.history.MISSED_STRING)){
++missed_sum;
- } else if(historyCall.getState().contentEquals(ServiceConstants.HISTORY_INCOMING_STRING)){
+ } else if(historyCall.getState().contentEquals(ServiceConstants.history.INCOMING_STRING)){
++incoming_sum;
} else {
++outgoing_sum;
diff --git a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
index cd65f2d..71684f2 100644
--- a/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
+++ b/src/com/savoirfairelinux/sflphone/service/ISipService.aidl
@@ -4,7 +4,8 @@
import com.savoirfairelinux.sflphone.model.Conference;
interface ISipService {
- /*void placeCall(String accountID, in String callID, in String to);*/
+
+ Map getCallDetails(in String callID);
void placeCall(in SipCall call);
void refuse(in String callID);
void accept(in String callID);
diff --git a/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java b/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java
index be47f34..0641f87 100644
--- a/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java
+++ b/src/com/savoirfairelinux/sflphone/service/ServiceConstants.java
@@ -1,25 +1,35 @@
package com.savoirfairelinux.sflphone.service;
public final class ServiceConstants {
-
+
public static final String INTENT_SIP_SERVICE = "com.savoirfairelinux.sflphone.service.SipService";
public static final String EXTRA_OUTGOING_ACTIVITY = "outgoing_activity";
- public static final String HISTORY_ACCOUNT_ID_KEY = "accountid";
- public static final String HISTORY_CALLID_KEY = "callid";
- public static final String HISTORY_CONFID_KEY = "confid";
- public static final String HISTORY_DISPLAY_NAME_KEY = "display_name";
- public static final String HISTORY_PEER_NUMBER_KEY = "peer_number";
- public static final String HISTORY_RECORDING_PATH_KEY = "recordfile";
- public static final String HISTORY_STATE_KEY = "state";
- public static final String HISTORY_TIMESTAMP_START_KEY = "timestamp_start";
- public static final String HISTORY_TIMESTAMP_STOP_KEY = "timestamp_stop";
- public static final String HISTORY_AUDIO_CODEC_KEY = "audio_codec";
- public static final String HISTORY_VIDEO_CODEC_KEY = "video_codec";
-
- public static final String HISTORY_MISSED_STRING = "missed";
- public static final String HISTORY_INCOMING_STRING = "incoming";
- public static final String HISTORY_OUTGOING_STRING = "outgoing";
+ public interface history {
+ public static final String ACCOUNT_ID_KEY = "accountid";
+ public static final String CALLID_KEY = "callid";
+ public static final String CONFID_KEY = "confid";
+ public static final String DISPLAY_NAME_KEY = "display_name";
+ public static final String PEER_NUMBER_KEY = "peer_number";
+ public static final String RECORDING_PATH_KEY = "recordfile";
+ public static final String STATE_KEY = "state";
+ public static final String TIMESTAMP_START_KEY = "timestamp_start";
+ public static final String TIMESTAMP_STOP_KEY = "timestamp_stop";
+ public static final String AUDIO_CODEC_KEY = "audio_codec";
+ public static final String VIDEO_CODEC_KEY = "video_codec";
+ public static final String MISSED_STRING = "missed";
+ public static final String INCOMING_STRING = "incoming";
+ public static final String OUTGOING_STRING = "outgoing";
+ }
+ public interface call {
+ public static final String CALL_TYPE = "CALL_TYPE";
+ public static final String PEER_NUMBER = "PEER_NUMBER";
+ public static final String DISPLAY_NAME = "DISPLAY_NAME";
+ public static final String CALL_STATE = "CALL_STATE";
+ public static final String CONF_ID = "CONF_ID";
+ public static final String TIMESTAMP_START = "TIMESTAMP_START";
+ public static final String ACCOUNTID = "ACCOUNTID";
+ }
}
diff --git a/src/com/savoirfairelinux/sflphone/service/SipService.java b/src/com/savoirfairelinux/sflphone/service/SipService.java
index 9f5746d..5ca1d9a 100644
--- a/src/com/savoirfairelinux/sflphone/service/SipService.java
+++ b/src/com/savoirfairelinux/sflphone/service/SipService.java
@@ -55,6 +55,7 @@
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.account.AccountDetailBasic;
import com.savoirfairelinux.sflphone.account.AccountDetailsHandler;
+import com.savoirfairelinux.sflphone.account.CallDetailsHandler;
import com.savoirfairelinux.sflphone.account.HistoryHandler;
import com.savoirfairelinux.sflphone.client.SFLPhoneHomeActivity;
import com.savoirfairelinux.sflphone.client.SFLphoneApplication;
@@ -416,6 +417,35 @@
}
});
}
+
+ @Override
+ public HashMap<String, String> getCallDetails(String callID) throws RemoteException {
+ class CallDetails extends SipRunnableWithReturn {
+ private String id;
+
+ CallDetails(String callID) {
+ id = callID;
+ }
+
+ @Override
+ protected StringMap doRun() throws SameThreadException {
+ Log.i(TAG, "SipService.getAccountDetails() thread running...");
+ return callManagerJNI.getCallDetails(id);
+ }
+ }
+
+ CallDetails runInstance = new CallDetails(callID);
+ getExecutor().execute(runInstance);
+
+ while (!runInstance.isDone()) {
+ }
+ StringMap swigmap = (StringMap) runInstance.getVal();
+
+ HashMap<String, String> nativemap = CallDetailsHandler.convertSwigToNative(swigmap);
+
+ return nativemap;
+
+ }
@Override
public void setAudioPlugin(final String audioPlugin) {