Frage

Ich verwende pjsua2 mit der Android-Build-Version 2.2.1.Ich kann einen Anruf halten, indem ich Folgendes verwende:

    CallOpParam prm = new CallOpParam();
    prm.setOptions(pjsua_call_flag.PJSUA_CALL_UPDATE_CONTACT.swigValue());

    try {
        currentCall.setHold(prm)
    } catch(Exception e) {
        e.printStackTrace();
    }

Um den Anruf zurückzuhalten, habe ich Folgendes versucht, aber es funktioniert nicht:

    CallOpParam prm = new CallOpParam();
    prm.setOptions(pjsua_call_flag.PJSUA_CALL_UNHOLD.swigValue());

    try {
        currentCall.reinvite(prm);
    } catch(Exception e) {
        e.printStackTrace();
    }

Ist das ein Pyjama-Fehler?Wie soll ich die Reinvite-Methode aufrufen?

War es hilfreich?

Lösung

Schauen Sie sich meinen Code an:

public void holdCall() {
    CallOpParam prm = new CallOpParam(true);

    try {
        currentCall.setHold(prm);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

public void unHoldCall() {
    CallOpParam prm = new CallOpParam(true);

    prm.getOpt().setFlag(1);
    try {
        currentCall.reinvite(prm);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

Entsprechend dieses Problem, muss das Flag aktiviert werden CallOpParam.

Die Konstante PJSUA_CALL_UNHOLD == 1, aber ich konnte es nicht verwenden PJSUA_CALL_UNHOLD direkt.

Ich verwende Asterisk und es funktioniert.

Andere Tipps

To unhold the call I need this in version 2.4.5:

CallOpParam prm = new CallOpParam();
CallSetting opt = prm.getOpt();
opt.setAudioCount(1);
opt.setVideoCount(0);
opt.setFlag(pjsua_call_flag.PJSUA_CALL_UNHOLD.swigValue());
call.reinvite(prm);

Here is another example:

public void setHold(boolean hold) {
    CallOpParam param = new CallOpParam();

    try {
        if (hold) {
            setHold(param);
        } else {
            CallSetting opt = param.getOpt();
            opt.setAudioCount(1);
            opt.setVideoCount(0);
            opt.setFlag(pjsua_call_flag.PJSUA_CALL_UNHOLD.swigValue());
            reinvite(param);
        }
    } catch (Exception exc) {
        String operation = hold ? "hold" : "unhold";
        Logger.error(LOG_TAG, "Error : ", exc);
    }
}

You can find here the full implementation.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top