Search in sources :

Example 1 with SipPhone

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

the class CallManager method conference.

/**
     * Conferences holding and active. Conference occurs asynchronously
     * and may fail. Final notification occurs via
     * {@link #registerForPreciseCallStateChanged(android.os.Handler, int,
     * java.lang.Object) registerForPreciseCallStateChanged()}.
     *
     * @exception CallStateException if canConference() would return false.
     * In these cases, this operation may not be performed.
     */
public void conference(Call heldCall) throws CallStateException {
    if (VDBG) {
        Log.d(LOG_TAG, "conference(" + heldCall + ")");
        Log.d(LOG_TAG, this.toString());
    }
    Phone fgPhone = getFgPhone();
    if (fgPhone instanceof SipPhone) {
        ((SipPhone) fgPhone).conference(heldCall);
    } else if (canConference(heldCall)) {
        fgPhone.conference();
    } else {
        throw (new CallStateException("Can't conference foreground and selected background call"));
    }
    if (VDBG) {
        Log.d(LOG_TAG, "End conference(" + heldCall + ")");
        Log.d(LOG_TAG, this.toString());
    }
}
Also used : SipPhone(com.android.internal.telephony.sip.SipPhone) SipPhone(com.android.internal.telephony.sip.SipPhone)

Example 2 with SipPhone

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

the class CallManager method setAudioMode.

public void setAudioMode() {
    Context context = getContext();
    if (context == null)
        return;
    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    int mode = AudioManager.MODE_NORMAL;
    switch(getState()) {
        case RINGING:
            mode = AudioManager.MODE_RINGTONE;
            break;
        case OFFHOOK:
            Phone fgPhone = getFgPhone();
            // ALERTING, ACTIVE and DISCONNECTING state
            if (getActiveFgCallState() != Call.State.IDLE && getActiveFgCallState() != Call.State.DISCONNECTED) {
                if (fgPhone instanceof SipPhone) {
                    // enable IN_COMMUNICATION audio mode for sipPhone
                    mode = AudioManager.MODE_IN_COMMUNICATION;
                } else {
                    // enable IN_CALL audio mode for telephony
                    mode = AudioManager.MODE_IN_CALL;
                }
            }
            break;
    }
    // time seems to break the audio recorder in in-call mode
    if (audioManager.getMode() != mode)
        audioManager.setMode(mode);
}
Also used : Context(android.content.Context) AudioManager(android.media.AudioManager) SipPhone(com.android.internal.telephony.sip.SipPhone) SipPhone(com.android.internal.telephony.sip.SipPhone)

Aggregations

SipPhone (com.android.internal.telephony.sip.SipPhone)2 Context (android.content.Context)1 AudioManager (android.media.AudioManager)1