SIGSEGV, Segmentation fault в простом примере pjsip на python
Thread 11 "python" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f6fff885640 (LWP 147247)]
0x00007f701420f0ae in PyType_GenericAlloc () from /usr/lib/libpython3.9.so.1.0
(gdb) backtrace
#0 0x00007f701420f0ae in PyType_GenericAlloc () at /usr/lib/libpython3.9.so.1.0
#1 0x00007f7013384331 in SWIG_Python_NewShadowInstance (swig_this=0x7f7013748570, data=0x5573a205ded0) at pjsua2_wrap.cpp:2288
#2 SWIG_Python_NewPointerObj(void*, swig_type_info*, int, PyObject*) (ptr=<optimized out>, type=<optimized out>, flags=flags@entry=0, self=0x0) at pjsua2_wrap.cpp:2395
#3 0x00007f70133b44dc in SwigDirector_Account::onRegState(pj::OnRegStateParam&) (this=0x5573a217dfe0, prm=<optimized out>) at pjsua2_wrap.cpp:8779
#4 0x00007f70132086ba in pj::Endpoint::on_reg_state2(int, pjsua_reg_info*) (acc_id=<optimized out>, info=0x7f6fff883d30) at ../src/pjsua2/endpoint.cpp:801
#5 0x00007f7012f300d1 in regc_cb () at ../lib/libpjsua.so.2
#6 0x00007f70137a0f37 in regc_tsx_callback () at ../lib/libpjsip-ua.so.2
#7 0x00007f7012ed9bac in tsx_set_state () at ../lib/libpjsip.so.2
#8 0x00007f7012edacf4 in tsx_on_state_proceeding_uac () at ../lib/libpjsip.so.2
#9 0x00007f7012edb3f5 in tsx_on_state_calling () at ../lib/libpjsip.so.2
#10 0x00007f7012edd6be in pjsip_tsx_recv_msg () at ../lib/libpjsip.so.2
#11 0x00007f7012edd7c5 in mod_tsx_layer_on_rx_response () at ../lib/libpjsip.so.2
#12 0x00007f7012ec44e7 in pjsip_endpt_process_rx_data () at ../lib/libpjsip.so.2
#13 0x00007f7012ec46a6 in endpt_on_rx_msg () at ../lib/libpjsip.so.2
#14 0x00007f7012ecb2b4 in pjsip_tpmgr_receive_packet () at ../lib/libpjsip.so.2
#15 0x00007f7012ecefaf in udp_on_read_complete () at ../lib/libpjsip.so.2
#16 0x00007f7012d9662f in ioqueue_dispatch_read_event () at ../lib/libpj.so.2
#17 0x00007f7012d9807f in pj_ioqueue_poll () at ../lib/libpj.so.2
#18 0x00007f7012ec4166 in pjsip_endpt_handle_events2 () at ../lib/libpjsip.so.2
#19 0x00007f7012f3ea05 in pjsua_handle_events () at ../lib/libpjsua.so.2
#20 0x00007f7012f3ea4a in worker_thread () at ../lib/libpjsua.so.2
#21 0x00007f7012d9964a in thread_main () at ../lib/libpj.so.2
#22 0x00007f7013f09259 in start_thread () at /usr/lib/libpthread.so.0
#23 0x00007f70140265e3 in clone () at /usr/lib/libc.so.6
Код работает до момента успешной авторизации
12:17:24.693 pjsua_acc.c ....SIP outbound status for acc 0 is not active
12:17:24.693 pjsua_acc.c ....sip:[email protected]: registration success, status=200 (OK), will re-register in 299 seconds
12:17:24.693 pjsua_acc.c ....Keep-alive timer started for acc 0, destination:45.139.24.57:8160, interval:15s
и потом грохается. Сам код
import pjsua2 as pj
import time
class Account(pj.Account):
def onRegState(self, prm):
print(prm)
def onIncomingCall(self, prm):
c = pj.Call(self, call_id=prm.callId)
call_prm = pj.CallOpParam()
call_prm.statusCode = 180
c.answer(call_prm)
ci = c.getInfo()
print(ci)
call_prm.statusCode = 200
c.answer(call_prm)
def main():
ep_cfg = pj.EpConfig()
ep = pj.Endpoint()
ep.libCreate()
ep.libInit(ep_cfg)
sipTpConfig = pj.TransportConfig()
sipTpConfig.port = 9060
ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig)
ep.libStart()
acfg = pj.AccountConfig()
acfg.idUri = "sip:[email protected]"
acfg.regConfig.registrarUri = "sip:sip2.eri.su:8160"
cred = pj.AuthCredInfo("digest", "*", "894377", 0, "Tc3YjU2MTkxN")
acfg.sipConfig.authCreds.append( cred )
# Create the account
acc = Account()
acc.create(acfg)
time.sleep(60)
# Destroy the library
ep.libDestroy()
if __name__ == "__main__":
main()