Question

J'utilise pjsua2 avec la version 2.2.1 d'Android.Je peux mettre un appel en attente en utilisant :

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

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

Pour reprendre l'appel, j'ai essayé ceci, mais cela ne fonctionne pas :

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

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

Est-ce un bug de pjsua ?Comment dois-je appeler la méthode de réinvitation ?

Était-ce utile?

La solution

Regarde mon code :

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();
    }
}

Selon ce problème, il faut mettre le drapeau sur CallOpParam.

La constante PJSUA_CALL_UNHOLD == 1, mais je ne pouvais pas utiliser PJSUA_CALL_UNHOLD directement.

J'utilise Asterisk et ça fonctionne.

Autres conseils

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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top