Search code examples
androidsippjsippjsua2

Exception while ending calls - "pjsua_conf_disconnect(id, sink.id) error: Invalid value or argument"


My application using pjsua library is working great. But, always an exception like below appear while hanging up the calls.

this is the part of the code where exception is raised in MyApp.java class, where amr refers to AudioMediaRecorder, and am refers to AudioMedia classes.

if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) {


try {
    if (am != null) {
    if(amr != null) {

       am.stopTransmit(amr);

       MyApp.ep.audDevManager().getCaptureDevMedia().stopTransmit(amr);

       amr.delete();
    }

       MyApp.ep.audDevManager().getCaptureDevMedia().stopTransmit(am);

       am.stopTransmit(MyApp.ep.audDevManager().getPlaybackDevMedia());
       am.delete();

     }
} catch (Exception e) {
       e.printStackTrace();
}
MyApp.ep.utilLogWrite(3, "MyCall", this.dump(true, ""));

}
MyApp.observer.notifyCallState(this);
}

This is always showing an exception as follows. The problem is with stopping the Media transmissions to the ports. Can anyone please suggest me the proper way to close these classes.

W/System.err: java.lang.Exception: Title: pjsua_conf_disconnect(id, sink.id)
W/System.err: Code:        70004
W/System.err: Description: Invalid value or argument (PJ_EINVAL)
W/System.err: Location:    ../src/pjsua2/media.cpp:234
W/System.err:     at org.pjsip.pjsua2.pjsua2JNI.AudioMedia_stopTransmit(Native Method)
W/System.err:     at org.pjsip.pjsua2.AudioMedia.stopTransmit(AudioMedia.java:60)
W/System.err:     at com.xtendsip.MyCall.onCallState(MyApp.java:166)
W/System.err:     at org.pjsip.pjsua2.pjsua2JNI.SwigDirector_Call_onCallState(pjsua2JNI.java:2918)

Solution

  • You wouldn't need to stop the transmission since it's handled by the library. You can see the sample app (MyApp.java) on how to handle call disconnection.