Skip to content
Snippets Groups Projects
Commit e9dc899f authored by Alexandre Savard's avatar Alexandre Savard
Browse files

#17001: Add Call Type (incomming/outgoing) to call state

parent 48240e8f
No related branches found
No related tags found
No related merge requests found
......@@ -90,6 +90,8 @@ public class CallActivity extends Activity implements OnClickListener
findViewById(R.id.buttonanswer).setOnClickListener(this);
findViewById(R.id.buttonhangup).setOnClickListener(this);
findViewById(R.id.buttonhold).setOnClickListener(this);
findViewById(R.id.buttonunhold).setOnClickListener(this);
setCallStateDisplay(mCall.getCallStateString());
......@@ -129,7 +131,6 @@ public class CallActivity extends Activity implements OnClickListener
case R.id.buttonhangup:
if((mCall.getCallStateInt() == SipCall.CALL_STATE_NONE) ||
(mCall.getCallStateInt() == SipCall.CALL_STATE_CURRENT)) {
mCall.notifyServiceHangup(service);
finish();
}
......@@ -138,6 +139,18 @@ public class CallActivity extends Activity implements OnClickListener
finish();
}
break;
case R.id.buttonhold:
Log.i(TAG, "HOLDBUTTONCLICK call state " + mCall.getCallStateString());
if(mCall.getCallStateInt() == SipCall.CALL_STATE_CURRENT) {
mCall.notifyServiceHold(service);
}
break;
case R.id.buttonunhold:
Log.i(TAG, "UNHOLDBUTTONCLICK call state " + mCall.getCallStateString());
if(mCall.getCallStateInt() == SipCall.CALL_STATE_HOLD) {
mCall.notifyServiceUnhold(service);
}
break;
default:
Log.e(TAG, "Invalid button clicked");
}
......@@ -149,21 +162,29 @@ public class CallActivity extends Activity implements OnClickListener
String newState = bundle.getString("State");
if(newState.equals("INCOMING")) {
mCall.setCallState(SipCall.CALL_STATE_INCOMING);
setCallStateDisplay(newState);
} else if(newState.equals("RINGING")) {
mCall.setCallState(SipCall.CALL_STATE_RINGING);
setCallStateDisplay(newState);
} else if(newState.equals("CURRENT")) {
mCall.setCallState(SipCall.CALL_STATE_CURRENT);
setCallStateDisplay(newState);
} else if(newState.equals("HUNGUP")) {
mCall.setCallState(SipCall.CALL_STATE_HUNGUP);
setCallStateDisplay(newState);
finish();
} else if(newState.equals("BUSY")) {
mCall.setCallState(SipCall.CALL_STATE_BUSY);
setCallStateDisplay(newState);
} else if(newState.equals("FAILURE")) {
mCall.setCallState(SipCall.CALL_STATE_FAILURE);
setCallStateDisplay(newState);
} else if(newState.equals("HOLD")) {
mCall.setCallState(SipCall.CALL_STATE_HOLD);
setCallStateDisplay(newState);
} else if(newState.equals("UNHOLD")) {
mCall.setCallState(SipCall.CALL_STATE_UNHOLD);
setCallStateDisplay(newState);
}
}
......
......@@ -332,6 +332,23 @@ public class SipCall
}
}
public void notifyServiceHold(ISipService service)
{
try {
service.hold(mCallInfo.mCallID);
} catch (RemoteException e) {
Log.e(TAG, "Cannot call service method", e);
}
}
public void notifyServiceUnhold(ISipService service)
{
try {
service.unhold(mCallInfo.mCallID);
} catch (RemoteException e) {
Log.e(TAG, "Cannot call service method", e);
}
}
public void addToConference()
{
......
......@@ -5,6 +5,8 @@ interface ISipService {
void refuse(in String callID);
void accept(in String callID);
void hangUp(in String callID);
void hold(in String callID);
void unhold(in String callID);
List getAccountList();
String addAccount(in Map accountDetails);
void removeAccount(in String accoundId);
......
......@@ -109,6 +109,28 @@ public class SipService extends Service {
});
}
@Override
public void hold(final String callID) {
getExecutor().execute(new SipRunnable() {
@Override
protected void doRun() throws SameThreadException {
Log.i(TAG, "SipService.hold() thread running...");
callManagerJNI.hold(callID);
}
});
}
@Override
public void unhold(final String callID) {
getExecutor().execute(new SipRunnable() {
@Override
protected void doRun() throws SameThreadException {
Log.i(TAG, "SipService.unhold() thread running...");
callManagerJNI.unhold(callID);
}
});
}
@Override
public void setAudioPlugin(final String audioPlugin) {
getExecutor().execute(new SipRunnable() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment