Reputation: 328
I'm using pjsua2 with Android build version 2.2.1. I can put a call on hold using:
CallOpParam prm = new CallOpParam();
prm.setOptions(pjsua_call_flag.PJSUA_CALL_UPDATE_CONTACT.swigValue());
try {
currentCall.setHold(prm)
} catch(Exception e) {
e.printStackTrace();
}
To unhold call I tried this, but does not work:
CallOpParam prm = new CallOpParam();
prm.setOptions(pjsua_call_flag.PJSUA_CALL_UNHOLD.swigValue());
try {
currentCall.reinvite(prm);
} catch(Exception e) {
e.printStackTrace();
}
Is that a bug of pjsua? How should I call the reinvite method?
Upvotes: 3
Views: 3260
Reputation: 2140
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.
Upvotes: 1
Reputation: 765
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);
Upvotes: 3
Reputation: 116
Look my 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();
}
}
According to this issue, it's necessary to set flag on CallOpParam
.
The constant PJSUA_CALL_UNHOLD == 1
, but I couldn't use PJSUA_CALL_UNHOLD
directly.
I'm using Asterisk and it's working.
Upvotes: 10