Search in sources :

Example 1 with CallStateException

use of com.android.internal.telephony.CallStateException in project XobotOS by xamarin.

the class CdmaCallTracker method acceptCall.

void acceptCall() throws CallStateException {
    if (ringingCall.getState() == CdmaCall.State.INCOMING) {
        Log.i("phone", "acceptCall: incoming...");
        // Always unmute when answering a new call
        setMute(false);
        cm.acceptCall(obtainCompleteMessage());
    } else if (ringingCall.getState() == CdmaCall.State.WAITING) {
        CdmaConnection cwConn = (CdmaConnection) (ringingCall.getLatestConnection());
        // Since there is no network response for supplimentary
        // service for CDMA, we assume call waiting is answered.
        // ringing Call state change to idle is in CdmaCall.detach
        // triggered by updateParent.
        cwConn.updateParent(ringingCall, foregroundCall);
        cwConn.onConnectedInOrOut();
        updatePhoneState();
        switchWaitingOrHoldingAndActive();
    } else {
        throw new CallStateException("phone not ringing");
    }
}
Also used : CallStateException(com.android.internal.telephony.CallStateException)

Example 2 with CallStateException

use of com.android.internal.telephony.CallStateException in project XobotOS by xamarin.

the class GsmCallTracker method hangupAllConnections.

void hangupAllConnections(GsmCall call) throws CallStateException {
    try {
        int count = call.connections.size();
        for (int i = 0; i < count; i++) {
            GsmConnection cn = (GsmConnection) call.connections.get(i);
            cm.hangupConnection(cn.getGSMIndex(), obtainCompleteMessage());
        }
    } catch (CallStateException ex) {
        Log.e(LOG_TAG, "hangupConnectionByIndex caught " + ex);
    }
}
Also used : GsmConnection(com.android.internal.telephony.gsm.GsmConnection) CallStateException(com.android.internal.telephony.CallStateException)

Example 3 with CallStateException

use of com.android.internal.telephony.CallStateException in project XobotOS by xamarin.

the class SipPhone method dialInternal.

private Connection dialInternal(String dialString) throws CallStateException {
    clearDisconnected();
    if (!canDial()) {
        throw new CallStateException("cannot dial in current state");
    }
    if (foregroundCall.getState() == SipCall.State.ACTIVE) {
        switchHoldingAndActive();
    }
    if (foregroundCall.getState() != SipCall.State.IDLE) {
        //we should have failed in !canDial() above before we get here
        throw new CallStateException("cannot dial in current state");
    }
    foregroundCall.setMute(false);
    try {
        Connection c = foregroundCall.dial(dialString);
        return c;
    } catch (SipException e) {
        Log.e(LOG_TAG, "dial()", e);
        throw new CallStateException("dial error: " + e);
    }
}
Also used : CallStateException(com.android.internal.telephony.CallStateException) Connection(com.android.internal.telephony.Connection) SipException(android.net.sip.SipException)

Example 4 with CallStateException

use of com.android.internal.telephony.CallStateException in project XobotOS by xamarin.

the class GsmCallTracker method acceptCall.

void acceptCall() throws CallStateException {
    if (ringingCall.getState() == GsmCall.State.INCOMING) {
        Log.i("phone", "acceptCall: incoming...");
        // Always unmute when answering a new call
        setMute(false);
        cm.acceptCall(obtainCompleteMessage());
    } else if (ringingCall.getState() == GsmCall.State.WAITING) {
        setMute(false);
        switchWaitingOrHoldingAndActive();
    } else {
        throw new CallStateException("phone not ringing");
    }
}
Also used : CallStateException(com.android.internal.telephony.CallStateException)

Example 5 with CallStateException

use of com.android.internal.telephony.CallStateException in project XobotOS by xamarin.

the class GsmCallTracker method dispose.

public void dispose() {
    //Unregister for all events
    cm.unregisterForCallStateChanged(this);
    cm.unregisterForOn(this);
    cm.unregisterForNotAvailable(this);
    for (GsmConnection c : connections) {
        try {
            if (c != null)
                hangup(c);
        } catch (CallStateException ex) {
            Log.e(LOG_TAG, "unexpected error on hangup during dispose");
        }
    }
    try {
        if (pendingMO != null)
            hangup(pendingMO);
    } catch (CallStateException ex) {
        Log.e(LOG_TAG, "unexpected error on hangup during dispose");
    }
    clearDisconnected();
}
Also used : GsmConnection(com.android.internal.telephony.gsm.GsmConnection) CallStateException(com.android.internal.telephony.CallStateException)

Aggregations

CallStateException (com.android.internal.telephony.CallStateException)8 GsmConnection (com.android.internal.telephony.gsm.GsmConnection)4 Connection (com.android.internal.telephony.Connection)3 RegistrantList (android.os.RegistrantList)2 DriverCall (com.android.internal.telephony.DriverCall)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 SipException (android.net.sip.SipException)1