#16928: Added call state in CallList and CallActivity
diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
index 6c4c4c7..7332025 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
@@ -45,6 +45,7 @@
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
+import android.widget.TextView;
import com.savoirfairelinux.sflphone.R;
import com.savoirfairelinux.sflphone.client.SipCall;
@@ -66,6 +67,7 @@
if(signalName.equals(CallManagerCallBack.NEW_CALL_CREATED)) {
} else if(signalName.equals(CallManagerCallBack.CALL_STATE_CHANGED)) {
+ processCallStateChangedSignal(intent);
} else if(signalName.equals(CallManagerCallBack.INCOMING_CALL)) {
}
}
@@ -122,4 +124,31 @@
finish();
}
}
+
+ private void processCallStateChangedSignal(Intent intent) {
+ TextView textView = (TextView)findViewById(R.id.callstate);
+
+ // Bundle bundle = intent.getExtras();
+ Bundle bundle = intent.getBundleExtra("com.savoirfairelinux.sflphone.service.newstate");
+ String callID = bundle.getString("CallID");
+ String newState = bundle.getString("State");
+
+ if(newState.equals("INCOMING")) {
+ textView.setText("Call State: " + newState);
+ } else if(newState.equals("RINGING")) {
+ textView.setText("Call State: " + newState);
+ } else if(newState.equals("CURRENT")) {
+ textView.setText("Call State: " + newState);
+ } else if(newState.equals("HUNGUP")) {
+ textView.setText("Call State: " + newState);
+ } else if(newState.equals("BUSY")) {
+ textView.setText("Call State: " + newState);
+ } else if(newState.equals("FAILURE")) {
+ textView.setText("Call State: " + newState);
+ } else if(newState.equals("HOLD")) {
+ textView.setText("Call State: " + newState);
+ } else if(newState.equals("UNHOLD")) {
+ textView.setText("Call State: " + newState);
+ }
+ }
}
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
index 15db90d..982c91f 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
@@ -484,7 +484,6 @@
callOnGoing = true;
buttonCall.setEnabled(false);
buttonHangup.setEnabled(true);
- launchCallActivity();
//}
}
@@ -492,14 +491,31 @@
Log.e(TAG, "Cannot call service method", e);
}
*/
-
- Random random = new Random();
- String callID = Integer.toString(random.nextInt());
- SipCall.CallInfo info = new SipCall.CallInfo();
- info.mCallID = callID;
+ try {
+ String accountID = mAccountList.currentAccountID;
+ EditText editText = (EditText) findViewById(R.id.editTo);
+ String to = "147"; // editText.getText().toString();
+
+ Random random = new Random();
+ String callID = Integer.toString(random.nextInt());
+ SipCall.CallInfo info = new SipCall.CallInfo();
- SipCall call = CallList.getCallInstance(info);
- call.launchCallActivity(this);
+ info.mCallID = callID;
+ info.mDisplayName = "Cool Guy!";
+ info.mPhone = to;
+ info.mEmail = "coolGuy@coolGuy.com";
+
+ SipCall call = CallList.getCallInstance(info);
+ call.launchCallActivity(this);
+
+ Log.d(TAG, "service.placeCall(" + accountID + ", " + callID + ", " + to + ");");
+ service.placeCall(accountID, callID, to);
+ callOnGoing = true;
+ buttonCall.setEnabled(false);
+ buttonHangup.setEnabled(true);
+ } catch (RemoteException e) {
+ Log.e(TAG, "Cannot call service method", e);
+ }
}
public void processingHangUpAction() {
diff --git a/src/com/savoirfairelinux/sflphone/client/SipCall.java b/src/com/savoirfairelinux/sflphone/client/SipCall.java
index ea775fd..e630672 100644
--- a/src/com/savoirfairelinux/sflphone/client/SipCall.java
+++ b/src/com/savoirfairelinux/sflphone/client/SipCall.java
@@ -48,14 +48,14 @@
public static CallElementList mCallElementList = null;
public CallInfo mCallInfo;
- public static int CALL_STATE_INVALID = 0; // The call is not existent in SFLphone service
- public static int CALL_STATE_NULL = 1; // Before any action performed
- public static int CALL_STATE_CALLING = 2; // After INVITE is sent
- public static int CALL_STATE_INCOMING = 3; // After INVITE is received
- public static int CALL_STATE_EARLY = 4; // After response with To tag
- public static int CALL_STATE_CONNECTING = 5; // After 2xx is sent/received
- public static int CALL_STATE_CONFIRMED = 6; // After ACK is sent/received
- public static int CALL_STATE_DISCONNECTED = 7; // Session is terminated
+ public static int CALL_STATE_NULL = 0;
+ public static int CALL_STATE_INCOMING = 1;
+ public static int CALL_STATE_RINGING = 2;
+ public static int CALL_STATE_CURRENT = 3;
+ public static int CALL_STATE_BUSY = 4;
+ public static int CALL_STATE_FAILURE = 5;
+ public static int CALL_STATE_HOLD = 6;
+ public static int CALL_STATE_UNHOLD = 7;
public static int MEDIA_STATE_NONE = 0; // No media currently
public static int MEDIA_STATE_ACTIVE = 1; // Media is active
@@ -137,6 +137,62 @@
mCallElementList = list;
}
+ public void setCallID(String callID) {
+ mCallInfo.mCallID = callID;
+ }
+
+ public String getCallId() {
+ return mCallInfo.mCallID;
+ }
+
+ public void setDisplayName(String displayName) {
+ mCallInfo.mDisplayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return mCallInfo.mDisplayName;
+ }
+
+ public void setPhone(String phone) {
+ mCallInfo.mPhone = phone;
+ }
+
+ public String getPhone() {
+ return mCallInfo.mPhone;
+ }
+
+ public void setEmail(String email) {
+ mCallInfo.mEmail = email;
+ }
+
+ public String getEmail() {
+ return mCallInfo.mEmail;
+ }
+
+ public void setRemoteContact(String remoteContact) {
+ mCallInfo.mRemoteContact = remoteContact;
+ }
+
+ public String getRemoteContact() {
+ return mCallInfo.mRemoteContact;
+ }
+
+ public void setCallState(int callState) {
+ mCallInfo.mCallState = callState;
+ }
+
+ public int getCallState() {
+ return mCallInfo.mCallState;
+ }
+
+ public void setMediaState(int mediaState) {
+ mCallInfo.mMediaState = mediaState;
+ }
+
+ public int getMediaState() {
+ return mCallInfo.mMediaState;
+ }
+
public void placeCall()
{
if(mCallElementList != null)