Example #1
0
 @Override
 public void hangup() throws CallStateException {
   synchronized (SipPhone.class) {
     if (SCN_DBG)
       log(
           "hangup: conn="
               + mPeer.getUriString()
               + ": "
               + mState
               + ": on phone "
               + getPhone().getPhoneName());
     if (!mState.isAlive()) return;
     try {
       SipAudioCall sipAudioCall = mSipAudioCall;
       if (sipAudioCall != null) {
         sipAudioCall.setListener(null);
         sipAudioCall.endCall();
       }
     } catch (SipException e) {
       throw new CallStateException("hangup(): " + e);
     } finally {
       mAdapter.onCallEnded(
           ((mState == Call.State.INCOMING) || (mState == Call.State.WAITING))
               ? DisconnectCause.INCOMING_REJECTED
               : DisconnectCause.LOCAL);
     }
   }
 }
Example #2
0
 @Override
 protected void onCallEnded(DisconnectCause cause) {
   if (getDisconnectCause() != DisconnectCause.LOCAL) {
     setDisconnectCause(cause);
   }
   synchronized (SipPhone.class) {
     setState(Call.State.DISCONNECTED);
     SipAudioCall sipAudioCall = mSipAudioCall;
     // FIXME: This goes null and is synchronized, but many uses aren't sync'd
     mSipAudioCall = null;
     String sessionState = (sipAudioCall == null) ? "" : (sipAudioCall.getState() + ", ");
     if (SCN_DBG)
       log(
           "[SipAudioCallAdapter] onCallEnded: "
               + mPeer.getUriString()
               + ": "
               + sessionState
               + "cause: "
               + getDisconnectCause()
               + ", on phone "
               + getPhone());
     if (sipAudioCall != null) {
       sipAudioCall.setListener(null);
       sipAudioCall.close();
     }
     mOwner.onConnectionEnded(SipConnection.this);
   }
 }
Example #3
0
 void dial() throws SipException {
   setState(Call.State.DIALING);
   mSipAudioCall = mSipManager.makeAudioCall(mProfile, mPeer, null, TIMEOUT_MAKE_CALL);
   mSipAudioCall.setListener(mAdapter);
 }
Example #4
0
 void initIncomingCall(SipAudioCall sipAudioCall, Call.State newState) {
   setState(newState);
   mSipAudioCall = sipAudioCall;
   sipAudioCall.setListener(mAdapter); // call back to set state
   mIncoming = true;
 }