#16928: Add function to get call state as strings
diff --git a/src/com/savoirfairelinux/sflphone/client/CallActivity.java b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
index 7332025..d4f33d3 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallActivity.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallActivity.java
@@ -89,6 +89,8 @@
bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
findViewById(R.id.buttonhangup).setOnClickListener(this);
+
+ setCallStateDisplay(mCall.getCallStateString());
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter("new-call-created"));
LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, new IntentFilter("call-state-changed"));
@@ -97,6 +99,7 @@
@Override
protected void onDestroy() {
+ Log.i(TAG, "Destroying Call Activity for call " + mCall.getCallId());
LocalBroadcastManager.getInstance(this).unregisterReceiver(mMessageReceiver);
unbindService(mConnection);
super.onDestroy();
@@ -126,29 +129,32 @@
}
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);
+ setCallStateDisplay(newState);
} else if(newState.equals("RINGING")) {
- textView.setText("Call State: " + newState);
+ setCallStateDisplay(newState);
} else if(newState.equals("CURRENT")) {
- textView.setText("Call State: " + newState);
+ setCallStateDisplay(newState);
} else if(newState.equals("HUNGUP")) {
- textView.setText("Call State: " + newState);
+ setCallStateDisplay(newState);
} else if(newState.equals("BUSY")) {
- textView.setText("Call State: " + newState);
+ setCallStateDisplay(newState);
} else if(newState.equals("FAILURE")) {
- textView.setText("Call State: " + newState);
+ setCallStateDisplay(newState);
} else if(newState.equals("HOLD")) {
- textView.setText("Call State: " + newState);
+ setCallStateDisplay(newState);
} else if(newState.equals("UNHOLD")) {
- textView.setText("Call State: " + newState);
+ setCallStateDisplay(newState);
}
}
+
+ private void setCallStateDisplay(String newState) {
+ TextView textView = (TextView)findViewById(R.id.callstate);
+ textView.setText("Call State: " + newState);
+ }
}
diff --git a/src/com/savoirfairelinux/sflphone/client/CallElementList.java b/src/com/savoirfairelinux/sflphone/client/CallElementList.java
index a855b43..6f5159b 100644
--- a/src/com/savoirfairelinux/sflphone/client/CallElementList.java
+++ b/src/com/savoirfairelinux/sflphone/client/CallElementList.java
@@ -352,9 +352,9 @@
public void onListItemClick(ListView l, View v, int position, long id)
{
// Insert desired behavior here.
- Log.i(TAG, "Item clicked: " + id);
SipCall call = (SipCall) mAdapter.getItem(position);
- call.notifyServiceHangup(service);
+ Log.i(TAG, "Call Clicked: " + call.getCallId());
+ call.launchCallActivity(getActivity());
}
@Override
diff --git a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
index 9745636..9f9b06f 100644
--- a/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
+++ b/src/com/savoirfairelinux/sflphone/client/SFLPhoneHome.java
@@ -506,7 +506,7 @@
info.mEmail = "coolGuy@coolGuy.com";
SipCall call = CallList.getCallInstance(info);
- // call.launchCallActivity(this);
+ call.launchCallActivity(this);
call.printCallInfo();
call.placeCall();
diff --git a/src/com/savoirfairelinux/sflphone/client/SipCall.java b/src/com/savoirfairelinux/sflphone/client/SipCall.java
index 3ef8265..5c5c37f 100644
--- a/src/com/savoirfairelinux/sflphone/client/SipCall.java
+++ b/src/com/savoirfairelinux/sflphone/client/SipCall.java
@@ -48,21 +48,21 @@
public static CallElementList mCallElementList = null;
public CallInfo mCallInfo;
- 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_HUNGUP = 4;
- public static int CALL_STATE_BUSY = 5;
- public static int CALL_STATE_FAILURE = 6;
- public static int CALL_STATE_HOLD = 7;
- public static int CALL_STATE_UNHOLD = 8;
+ public static final int CALL_STATE_NULL = 0;
+ public static final int CALL_STATE_INCOMING = 1;
+ public static final int CALL_STATE_RINGING = 2;
+ public static final int CALL_STATE_CURRENT = 3;
+ public static final int CALL_STATE_HUNGUP = 4;
+ public static final int CALL_STATE_BUSY = 5;
+ public static final int CALL_STATE_FAILURE = 6;
+ public static final int CALL_STATE_HOLD = 7;
+ public static final int CALL_STATE_UNHOLD = 8;
- public static int MEDIA_STATE_NONE = 0; // No media currently
- public static int MEDIA_STATE_ACTIVE = 1; // Media is active
- public static int MEDIA_STATE_LOCAL_HOLD = 2; // Media is put on hold bu user
- public static int MEDIA_STATE_REMOTE_HOLD = 3; // Media is put on hold by peer
- public static int MEDIA_STATE_ERROR = 5; // Media is in error state
+ public static final int MEDIA_STATE_NONE = 0; // No media currently
+ public static final int MEDIA_STATE_ACTIVE = 1; // Media is active
+ public static final int MEDIA_STATE_LOCAL_HOLD = 2; // Media is put on hold bu user
+ public static final int MEDIA_STATE_REMOTE_HOLD = 3; // Media is put on hold by peer
+ public static final int MEDIA_STATE_ERROR = 5; // Media is in error state
public static class CallInfo implements Parcelable
{
@@ -193,10 +193,46 @@
mCallInfo.mCallState = callState;
}
- public int getCallState() {
+ public int getCallStateInt() {
return mCallInfo.mCallState;
}
+ public String getCallStateString() {
+ String state;
+
+ switch(mCallInfo.mCallState) {
+ case CALL_STATE_INCOMING:
+ state = "INCOMING";
+ break;
+ case CALL_STATE_RINGING:
+ state = "RINGING";
+ break;
+ case CALL_STATE_CURRENT:
+ state = "CURRENT";
+ break;
+ case CALL_STATE_HUNGUP:
+ state = "HUNGUP";
+ break;
+ case CALL_STATE_BUSY:
+ state = "BUSY";
+ break;
+ case CALL_STATE_FAILURE:
+ state = "FAILURE";
+ break;
+ case CALL_STATE_HOLD:
+ state = "HOLD";
+ break;
+ case CALL_STATE_UNHOLD:
+ state = "UNHOLD";
+ break;
+ default:
+ state = "NULL";
+ }
+
+ return state;
+ }
+
+
public void setMediaState(int mediaState) {
mCallInfo.mMediaState = mediaState;
}