private void updateCallState(CallInfo ci) { TextView tvPeer = (TextView) findViewById(R.id.textViewPeer); TextView tvState = (TextView) findViewById(R.id.textViewCallState); Button buttonHangup = (Button) findViewById(R.id.buttonHangup); Button buttonAccept = (Button) findViewById(R.id.buttonAccept); String call_state = ""; if (ci.getRole() == pjsip_role_e.PJSIP_ROLE_UAC) { buttonAccept.setVisibility(View.GONE); } if (ci.getState().swigValue() < pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue()) { if (ci.getRole() == pjsip_role_e.PJSIP_ROLE_UAS) { call_state = "Incoming call.."; /* Default button texts are already 'Accept' & 'Reject' */ } else { buttonHangup.setText("Cancel"); call_state = ci.getStateText(); } } else if (ci.getState().swigValue() >= pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED.swigValue()) { buttonAccept.setVisibility(View.GONE); call_state = ci.getStateText(); if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED) { buttonHangup.setText("Hangup"); } else if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) { buttonHangup.setText("OK"); call_state = "Call disconnected: " + ci.getLastReason(); MainActivity.currentCall = null; } } tvPeer.setText(ci.getRemoteUri()); tvState.setText(call_state); }