* #31301: added ui warning before call
diff --git a/src/org/sflphone/account/AccountDetailAdvanced.java b/src/org/sflphone/account/AccountDetailAdvanced.java
index 27e5027..60b00e1 100644
--- a/src/org/sflphone/account/AccountDetailAdvanced.java
+++ b/src/org/sflphone/account/AccountDetailAdvanced.java
@@ -166,7 +166,6 @@
return value;
}
}
-
return value;
}
diff --git a/src/org/sflphone/fragments/HistoryFragment.java b/src/org/sflphone/fragments/HistoryFragment.java
index 0602859..22b26b6 100644
--- a/src/org/sflphone/fragments/HistoryFragment.java
+++ b/src/org/sflphone/fragments/HistoryFragment.java
@@ -197,14 +197,6 @@
entryView.outgoing = (TextView) rowView.findViewById(R.id.outgoings);
entryView.replay = (Button) rowView.findViewById(R.id.replay);
entryView.call_button = (ImageButton) rowView.findViewById(R.id.action_call);
- entryView.call_button.setOnClickListener(new OnClickListener() {
-
- @Override
- public void onClick(View v) {
- mContext.makeNewCall(pos);
-
- }
- });
rowView.setTag(entryView);
} else {
entryView = (HistoryView) rowView.getTag();
@@ -250,6 +242,14 @@
entryView.date.setText(dataset.get(pos).getCalls().lastEntry().getValue().getDate("hh:mm dd/MM/yyyy"));
entryView.duration.setText(dataset.get(pos).getTotalDuration());
+ entryView.call_button.setOnClickListener(new OnClickListener() {
+
+ @Override
+ public void onClick(View v) {
+ mContext.makeNewCall(pos);
+
+ }
+ });
return rowView;
diff --git a/src/org/sflphone/model/Account.java b/src/org/sflphone/model/Account.java
index f6f3560..67ff67f 100644
--- a/src/org/sflphone/model/Account.java
+++ b/src/org/sflphone/model/Account.java
@@ -103,17 +103,19 @@
public void writeToParcel(Parcel dest, int arg1) {
dest.writeString(accountID);
- // dest.writeString(host);
- // dest.writeString(registered_state);
- // dest.writeString(alias);
+ dest.writeSerializable(basicDetails.getDetailsHashMap());
+ dest.writeSerializable(advancedDetails.getDetailsHashMap());
+ dest.writeSerializable(tlsDetails.getDetailsHashMap());
+ dest.writeSerializable(srtpDetails.getDetailsHashMap());
}
private void readFromParcel(Parcel in) {
accountID = in.readString();
- // host = in.readString();
- // registered_state = in.readString();
- // alias = in.readString();
+ basicDetails = new AccountDetailBasic((HashMap<String, String>) in.readSerializable());
+ advancedDetails = new AccountDetailAdvanced((HashMap<String, String>) in.readSerializable());
+ srtpDetails = new AccountDetailSrtp((HashMap<String, String>) in.readSerializable());
+ tlsDetails = new AccountDetailTls((HashMap<String, String>) in.readSerializable());
}
public static final Parcelable.Creator<Account> CREATOR = new Parcelable.Creator<Account>() {
@@ -180,4 +182,9 @@
return results;
}
+ public boolean isRegistered() {
+ // FIXME Hardcoded values
+ return (getRegistered_state().contentEquals("REGISTERED") || getRegistered_state().contentEquals("OK"));
+ }
+
}
diff --git a/src/org/sflphone/model/SipCall.java b/src/org/sflphone/model/SipCall.java
index d69999b..0839f78 100644
--- a/src/org/sflphone/model/SipCall.java
+++ b/src/org/sflphone/model/SipCall.java
@@ -44,7 +44,7 @@
private static final String TAG = SipCall.class.getSimpleName();
private String mCallID = "";
- private String mAccountID = "";
+ private Account mAccount = null;
private CallContact contact = null;
private boolean isRecording = false;
private long timestamp_start = 0;
@@ -63,7 +63,7 @@
ArrayList<String> list = in.createStringArrayList();
mCallID = list.get(0);
- mAccountID = list.get(1);
+ mAccount = in.readParcelable(Account.class.getClassLoader());
contact = in.readParcelable(CallContact.class.getClassLoader());
isRecording = in.readByte() == 1;
mCallType = in.readInt();
@@ -72,17 +72,15 @@
timestamp_start = in.readLong();
}
-
- public SipCall(String id, String account, int call_type, int call_state, int media_state, CallContact c) {
+ public SipCall(String id, Account account, int call_type, int call_state, int media_state, CallContact c) {
mCallID = id;
- mAccountID = account;
+ mAccount = account;
mCallType = call_type;
mCallState = call_state;
mMediaState = media_state;
contact = c;
}
-
public interface state {
public static final int CALL_TYPE_UNDETERMINED = 0;
public static final int CALL_TYPE_INCOMING = 1;
@@ -114,11 +112,11 @@
public void writeToParcel(Parcel out, int flags) {
ArrayList<String> list = new ArrayList<String>();
- // Don't mess with this order!!!
list.add(mCallID);
- list.add(mAccountID);
out.writeStringList(list);
+ out.writeParcelable(mAccount, 0);
+
out.writeParcelable(contact, 0);
out.writeByte((byte) (isRecording ? 1 : 0));
out.writeInt(mCallType);
@@ -149,18 +147,16 @@
return timestamp_start;
}
-
public void setTimestamp_start(long timestamp_start) {
this.timestamp_start = timestamp_start;
}
-
- public void setAccountID(String accountID) {
- mAccountID = accountID;
+ public void setAccount(Account account) {
+ mAccount = account;
}
- public String getAccountID() {
- return mAccountID;
+ public Account getAccount() {
+ return mAccount;
}
public void setCallType(int callType) {
@@ -198,14 +194,6 @@
this.mCallID = mCallID;
}
- public String getmAccountID() {
- return mAccountID;
- }
-
- public void setmAccountID(String mAccountID) {
- this.mAccountID = mAccountID;
- }
-
public CallContact getContact() {
return contact;
}
@@ -285,7 +273,7 @@
public static class SipCallBuilder {
private String bCallID = "";
- private String bAccountID = "";
+ private Account bAccount = null;
private CallContact bContact = null;
private int bCallType = state.CALL_TYPE_UNDETERMINED;
@@ -321,9 +309,8 @@
return this;
}
- public SipCallBuilder setAccountID(String h) {
- Log.i(TAG, "setAccountID" + h);
- bAccountID = h;
+ public SipCallBuilder setAccount(Account a) {
+ bAccount = a;
return this;
}
@@ -333,10 +320,10 @@
}
public SipCall build() throws Exception {
- if (bCallID.contentEquals("") || bAccountID.contentEquals("") || bContact == null) {
+ if (bCallID.contentEquals("") || bAccount == null || bContact == null) {
throw new Exception("SipCallBuilder's parameters missing");
}
- return new SipCall(bCallID, bAccountID, bCallType, bCallState, bMediaState, bContact);
+ return new SipCall(bCallID, bAccount, bCallType, bCallState, bMediaState, bContact);
}
public static SipCallBuilder getInstance() {
@@ -344,7 +331,7 @@
}
public static SipCall buildMyselfCall(ContentResolver cr, String displayName) {
- return new SipCall("default", "default", SipCall.state.CALL_TYPE_UNDETERMINED, state.CALL_STATE_NONE, state.MEDIA_STATE_NONE,
+ return new SipCall("default", null, SipCall.state.CALL_TYPE_UNDETERMINED, state.CALL_STATE_NONE, state.MEDIA_STATE_NONE,
CallContact.ContactBuilder.buildUserContact(cr, displayName));
}
@@ -353,7 +340,7 @@
public void printCallInfo() {
Log.i(TAG, "CallInfo: CallID: " + mCallID);
- Log.i(TAG, " AccountID: " + mAccountID);
+ Log.i(TAG, " AccountID: " + mAccount.getAccountID());
Log.i(TAG, " CallState: " + mCallState);
Log.i(TAG, " CallType: " + mCallType);
}
@@ -414,7 +401,6 @@
}
-
public boolean isOngoing() {
if (mCallState == state.CALL_STATE_RINGING || mCallState == state.CALL_STATE_NONE || mCallState == state.CALL_STATE_FAILURE
|| mCallState == state.CALL_STATE_BUSY || mCallState == state.CALL_STATE_HUNGUP)
@@ -427,7 +413,6 @@
return mCallState == state.CALL_STATE_HOLD;
}
-
public boolean isCurrent() {
return mCallState == state.CALL_STATE_CURRENT;
}
diff --git a/src/org/sflphone/receivers/IncomingReceiver.java b/src/org/sflphone/receivers/IncomingReceiver.java
index b55da8d..4083e2e 100644
--- a/src/org/sflphone/receivers/IncomingReceiver.java
+++ b/src/org/sflphone/receivers/IncomingReceiver.java
@@ -5,6 +5,7 @@
import java.util.Iterator;
import java.util.Map.Entry;
+import org.sflphone.model.Account;
import org.sflphone.model.CallContact;
import org.sflphone.model.Conference;
import org.sflphone.model.SipCall;
@@ -58,18 +59,24 @@
Bundle b = intent.getBundleExtra("com.savoirfairelinux.sflphone.service.newcall");
SipCall.SipCallBuilder callBuilder = SipCall.SipCallBuilder.getInstance();
- callBuilder.startCallCreation(b.getString("CallID")).setAccountID(b.getString("AccountID"))
- .setCallState(SipCall.state.CALL_STATE_RINGING).setCallType(SipCall.state.CALL_TYPE_INCOMING);
- callBuilder.setContact(CallContact.ContactBuilder.buildUnknownContact(b.getString("From")));
- Intent toSend = new Intent(CallManagerCallBack.INCOMING_CALL);
+ Account acc;
try {
+ acc = new Account(b.getString("AccountID"), (HashMap<String, String>) mBinder.getAccountDetails(b.getString("AccountID")));
+ callBuilder.startCallCreation(b.getString("CallID")).setAccount(acc).setCallState(SipCall.state.CALL_STATE_RINGING)
+ .setCallType(SipCall.state.CALL_TYPE_INCOMING);
+ callBuilder.setContact(CallContact.ContactBuilder.buildUnknownContact(b.getString("From")));
+
+ Intent toSend = new Intent(CallManagerCallBack.INCOMING_CALL);
+
SipCall newCall = callBuilder.build();
toSend.putExtra("newcall", newCall);
HashMap<String, String> details = (HashMap<String, String>) mBinder.getCallDetails(b.getString("CallID"));
newCall.setTimestamp_start(Long.parseLong(details.get(ServiceConstants.call.TIMESTAMP_START)));
callback.getCurrent_calls().put(newCall.getCallId(), newCall);
callback.sendBroadcast(toSend);
+ } catch (RemoteException e1) {
+ e1.printStackTrace();
} catch (Exception e) {
Log.e(TAG, e.toString());
}
diff --git a/src/org/sflphone/service/SipService.java b/src/org/sflphone/service/SipService.java
index 10d708b..09403a3 100644
--- a/src/org/sflphone/service/SipService.java
+++ b/src/org/sflphone/service/SipService.java
@@ -357,7 +357,7 @@
@Override
protected void doRun() throws SameThreadException {
Log.i(TAG, "SipService.placeCall() thread running...");
- callManagerJNI.placeCall(call.getAccountID(), call.getCallId(), call.getContact().getPhones().get(0).getNumber());
+ callManagerJNI.placeCall(call.getAccount().getAccountID(), call.getCallId(), call.getContact().getPhones().get(0).getNumber());
HashMap<String, String> details = CallDetailsHandler.convertSwigToNative(callManagerJNI.getCallDetails(call.getCallId()));
// watchout timestamp stored by sflphone is in seconds