I am using Python 3.8 with pjsua2 using swig (built using the files given in the pjsip source code)
I can make calls fine.
However, when I attempt to answer a call (using 180 or 200), like so:
def onIncomingCall(self, prm):
c = Call(self, call_id=prm.callId)
call_prm = pj.CallOpParam()
call_prm.statusCode = 180
c.answer(call_prm)
I get the following in the console log (set to 5):
10:27:04.033 pjsua_call.c ...Answering call 0: code=180
10:27:04.033 pjsua_call.c ....Pending answering call 0 upon completion of media transport
10:27:04.033 pjsua_call.c ...Call 0 hanging up: code=0..
10:27:04.033 pjsua_call.c ....Pending call 0 hangup upon completion of media transport
10:27:04.033 pjsua_call.c ...Call 0 hanging up: code=500..
10:27:04.033 pjsua_call.c ....Pending call 0 hangup upon completion of media transport
The logs just show immediate hangup with no clue what the issue is.
Can anyone help with this issue? I did the same logic of code in Java with the library and that seemed to work fine, but I really need to use Python.
Many thanks
This turned out to be the Python garbage collection prematurely removing the call object.
Which is documented on the PJSUA2 docs here
To fix the issue I created a class to store pjsip call objects so it was still referenced, and then removed them when needed.