Hi,
When I try following python code, getting segment fault (refer to console log below).
Note:
Any help?
Thanks
------Code----------------------------------------------------------------------------------------------------------
import pjsua2 as pj
import time
class Account(pj.Account):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
def onRegStarted(self, prm):
print ("Registration started callback received >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
def onRegState(self, prm):
print ("***OnRegState: " )
def pjsua2_test():
ep_cfg = pj.EpConfig()
ep_cfg.logConfig.level = 5;
ep_cfg.uaConfig.maxCalls = 4;
#ep_cfg.mediaConfig.sndClockRate = 16000; #Giving error.
ep = pj.Endpoint()
ep.libCreate()
ep.libInit(ep_cfg)
sipTpConfig = pj.TransportConfig();
sipTpConfig.port = 5060;
ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig);
ep.libStart();
acfg = pj.AccountConfig();
acfg.idUri = "sip:user@sip2sip.info:5060";
acfg.regConfig.registrarUri = "sip:proxy.sipthor.net:5060";
#acfg.proxies[0] = ("sip:proxy.sipthor.net:5060");
cred = pj.AuthCredInfo("digest", "*", "user", 0, "pass");
acfg.sipConfig.authCreds.append( cred );
acc = Account();
print ("Calling registration >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " )
acc.create(acfg);
print ("Registration Initiated >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " )
time.sleep(20);
#ep.libDestroy()
if name == "main":
pjsua2_test()
---------------------------------Error message----------------------------------------------------------------------
$ python3 test.py
06:59:18.940 os_core_unix.c !pjlib 2.8-svn for POSIX initialized
06:59:18.942 sip_endpoint.c .Creating endpoint instance...
06:59:18.942 pjlib .select() I/O Queue created (0x15288f18)
06:59:18.942 sip_endpoint.c .Module "mod-msg-print" registered
06:59:18.943 sip_transport.c .Transport manager created.
06:59:18.943 pjsua_core.c .PJSUA state changed: NULL --> CREATED
06:59:18.943 sip_endpoint.c .Module "mod-pjsua-log" registered
06:59:18.943 sip_endpoint.c .Module "mod-tsx-layer" registered
06:59:18.943 sip_endpoint.c .Module "mod-stateful-util" registered
06:59:18.943 sip_endpoint.c .Module "mod-ua" registered
06:59:18.943 sip_endpoint.c .Module "mod-100rel" registered
06:59:18.943 sip_endpoint.c .Module "mod-pjsua" registered
06:59:18.943 sip_endpoint.c .Module "mod-invite" registered
06:59:19.027 alsa_dev.c ..ALSA driver found 7 devices
06:59:19.027 alsa_dev.c ..ALSA initialized
06:59:19.027 pjlib ..select() I/O Queue created (0x152dea08)
06:59:19.040 sip_endpoint.c .Module "mod-evsub" registered
06:59:19.040 sip_endpoint.c .Module "mod-presence" registered
06:59:19.040 sip_endpoint.c .Module "mod-mwi" registered
06:59:19.040 sip_endpoint.c .Module "mod-refer" registered
06:59:19.040 sip_endpoint.c .Module "mod-pjsua-pres" registered
06:59:19.040 sip_endpoint.c .Module "mod-pjsua-im" registered
06:59:19.040 sip_endpoint.c .Module "mod-pjsua-options" registered
06:59:19.041 pjsua_core.c .1 SIP worker threads created
06:59:19.041 pjsua_core.c .pjsua version 2.8-svn for Linux-4.19/aarch64/glibc-2.27 initialized
06:59:19.041 pjsua_core.c .PJSUA state changed: CREATED --> INIT
06:59:19.042 pjsua_core.c SIP UDP socket reachable at 192.168.1.11:5060
06:59:19.042 udp0x15127990 SIP UDP transport started, published address is 192.168.1.11:5060
06:59:19.042 pjsua_core.c PJSUA state changed: INIT --> STARTING
06:59:19.042 sip_endpoint.c .Module "mod-unsolicited-mwi" registered
06:59:19.042 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING
Calling registration >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
06:59:19.043 pjsua_acc.c Adding account: id=sip:USERXXXXX@sip2sip.info:5060
06:59:19.043 pjsua_acc.c .Account sip:USERXXXXX@sip2sip.info:5060 added with id 0
06:59:19.043 pjsua_acc.c .Acc 0: setting registration..
06:59:19.686 pjsua_core.c ...TX 519 bytes Request msg REGISTER/cseq=22074 (tdta0x152a7828) to UDP 81.23.228.129:5060:
REGISTER sip:proxy.sipthor.net:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.11:5060;rport;branch=z9hG4bKPjbe03e2c7-26a8-473c-915b-c52fb5c7ebe3
Max-Forwards: 70
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22074 REGISTER
Contact: sip:USERXXXXX@192.168.1.11:5060;ob
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0
--end msg--
Registration started callback received >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
06:59:19.687 pjsua_acc.c ..Acc 0: Registration sent
Registration Initiated >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
06:59:19.833 pjsua_core.c .RX 526 bytes Response msg 401/REGISTER/cseq=22074 (rdata0x152a3448) from UDP 81.23.228.129:5060:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.11:5060;received=192.168.1.11;rport=5060;branch=z9hG4bKPjbe03e2c7-26a8-473c-915b-c52fb5c7ebe3
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info;tag=e7d4d6b46afb9bf88242924a8d869ebf.429b
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22074 REGISTER
WWW-Authenticate: Digest realm="sip2sip.info", nonce="5c271b65a6ae547b3af27622dae9fc546bb6808d"
Server: SIP Thor on OpenSIPS XS 1.11
Content-Length: 0
--end msg--
06:59:19.834 pjsua_core.c ....TX 714 bytes Request msg REGISTER/cseq=22075 (tdta0x152a7828) to UDP 81.23.228.129:5060:
REGISTER sip:proxy.sipthor.net:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.11:5060;rport;branch=z9hG4bKPjc2034788-dc95-4433-9c20-73b64baffe15
Max-Forwards: 70
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22075 REGISTER
Contact: sip:USERXXXXX@192.168.1.11:5060;ob
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username="USERXXXXX", realm="sip2sip.info", nonce="5c271b65a6ae547b3af27622dae9fc546bb6808d", uri="sip:proxy.sipthor.net:5060", response="66b9f9d0dc0390af41274c8de4f26ffe"
Content-Length: 0
--end msg--
06:59:20.036 pjsua_core.c .RX 792 bytes Response msg 200/REGISTER/cseq=22075 (rdata0xffff80008798) from UDP 81.23.228.129:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.11:5060;received=192.168.1.11;rport=5060;branch=z9hG4bKPjc2034788-dc95-4433-9c20-73b64baffe15
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info;tag=e7d4d6b46afb9bf88242924a8d869ebf.1ca9
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22075 REGISTER
Contact: sip:USERXXXXX@192.168.1.11:5060;ob;expires=300;received="sip:81.23.228.129:5060;target=%73%69%70:%32%32%33.%32%32%39.%32%34%34.%32%30%38:%35%30%36%30", sip:02581793@192.168.1.10:36279;transport=tls;expires=376;received="sip:81.23.228.129:5060;target=%73%69%70:%32%32%33.%32%32%39.%32%34%34.%32%30%38:%33%34%37%38%35%3b%74%72%61%6e%73%70%6f%72%74%3d%74%6c%73"
Server: SIP Thor on OpenSIPS XS 1.11
Content-Length: 0
--end msg--
06:59:20.037 pjsua_acc.c ....SIP outbound status for acc 0 is not active
06:59:20.037 pjsua_acc.c ....sip:USERXXXXX@sip2sip.info:5060: registration success, status=200 (OK), will re-register in 300 seconds
06:59:20.037 pjsua_acc.c ....Keep-alive timer started for acc 0, destination:81.23.228.129:5060:15, interval:1430523921s
Segmentation fault
I had problems with core dumps as well and had to set number of threads to 0
ep_cfg.uaConfig.threadCnt = 0
After this change then you need to use ep.libHandleEvents (delay_in_ms) instead of any blocking delay function in your main loop.
I got that information from following part of the documentation https://www.pjsip.org/docs/book-latest/html/intro_pjsua2.html#threading:
..."Often though, especially if you use PJSUA2 with high level languages such as Python, it is required to disable PJSUA2 internal worker threads by setting EpConfig.uaConfig.threadCnt to 0, because the high level environment doesn't like to be called by external thread (such as PJSIP's worker thread)."...
Hope it helps
/ Mats
From: pjsip [mailto:pjsip-bounces@lists.pjsip.org] On Behalf Of Sekar S
Sent: den 29 december 2018 08:10
To: pjsip@lists.pjsip.org
Subject: [pjsip] Python account registration call back issue : aarch64 installation
Hi,
When I try following python code, getting segment fault (refer to console log below).
Note:
Any help?
Thanks
------Code----------------------------------------------------------------------------------------------------------
import pjsua2 as pj
import time
class Account(pj.Account):
def init(self, *args, **kwargs):
super().init(*args, **kwargs)
def onRegStarted(self, prm):
print ("Registration started callback received >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
def onRegState(self, prm):
print ("***OnRegState: " )
def pjsua2_test():
ep_cfg = pj.EpConfig()
ep_cfg.logConfig.level = 5;
ep_cfg.uaConfig.maxCalls = 4;
#ep_cfg.mediaConfig.sndClockRate = 16000; #Giving error.
ep = pj.Endpoint()
ep.libCreate()
ep.libInit(ep_cfg)
sipTpConfig = pj.TransportConfig();
sipTpConfig.port = 5060;
ep.transportCreate(pj.PJSIP_TRANSPORT_UDP, sipTpConfig);
ep.libStart();
acfg = pj.AccountConfig();
acfg.idUri = "sip:user@sip2sip.info:5060";
acfg.regConfig.registrarUri = "sip:proxy.sipthor.net:5060";
#acfg.proxies[0] = ("sip:proxy.sipthor.net:5060");
cred = pj.AuthCredInfo("digest", "*", "user", 0, "pass");
acfg.sipConfig.authCreds.append( cred );
acc = Account();
print ("Calling registration >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " )
acc.create(acfg);
print ("Registration Initiated >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " )
time.sleep(20);
#ep.libDestroy()
if name == "main":
pjsua2_test()
---------------------------------Error message----------------------------------------------------------------------
$ python3 test.py
06:59:18.940 os_core_unix.c !pjlib 2.8-svn for POSIX initialized
06:59:18.942 sip_endpoint.c .Creating endpoint instance...
06:59:18.942 pjlib .select() I/O Queue created (0x15288f18)
06:59:18.942 sip_endpoint.c .Module "mod-msg-print" registered
06:59:18.943 sip_transport.c .Transport manager created.
06:59:18.943 pjsua_core.c .PJSUA state changed: NULL --> CREATED
06:59:18.943 sip_endpoint.c .Module "mod-pjsua-log" registered
06:59:18.943 sip_endpoint.c .Module "mod-tsx-layer" registered
06:59:18.943 sip_endpoint.c .Module "mod-stateful-util" registered
06:59:18.943 sip_endpoint.c .Module "mod-ua" registered
06:59:18.943 sip_endpoint.c .Module "mod-100rel" registered
06:59:18.943 sip_endpoint.c .Module "mod-pjsua" registered
06:59:18.943 sip_endpoint.c .Module "mod-invite" registered
06:59:19.027 alsa_dev.c ..ALSA driver found 7 devices
06:59:19.027 alsa_dev.c ..ALSA initialized
06:59:19.027 pjlib ..select() I/O Queue created (0x152dea08)
06:59:19.040 sip_endpoint.c .Module "mod-evsub" registered
06:59:19.040 sip_endpoint.c .Module "mod-presence" registered
06:59:19.040 sip_endpoint.c .Module "mod-mwi" registered
06:59:19.040 sip_endpoint.c .Module "mod-refer" registered
06:59:19.040 sip_endpoint.c .Module "mod-pjsua-pres" registered
06:59:19.040 sip_endpoint.c .Module "mod-pjsua-im" registered
06:59:19.040 sip_endpoint.c .Module "mod-pjsua-options" registered
06:59:19.041 pjsua_core.c .1 SIP worker threads created
06:59:19.041 pjsua_core.c .pjsua version 2.8-svn for Linux-4.19/aarch64/glibc-2.27 initialized
06:59:19.041 pjsua_core.c .PJSUA state changed: CREATED --> INIT
06:59:19.042 pjsua_core.c SIP UDP socket reachable at 192.168.1.11:5060
06:59:19.042 udp0x15127990 SIP UDP transport started, published address is 192.168.1.11:5060
06:59:19.042 pjsua_core.c PJSUA state changed: INIT --> STARTING
06:59:19.042 sip_endpoint.c .Module "mod-unsolicited-mwi" registered
06:59:19.042 pjsua_core.c .PJSUA state changed: STARTING --> RUNNING
Calling registration >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
06:59:19.043 pjsua_acc.c Adding account: id=sip:USERXXXXX@sip2sip.info:5060
06:59:19.043 pjsua_acc.c .Account sip:USERXXXXX@sip2sip.info:5060 added with id 0
06:59:19.043 pjsua_acc.c .Acc 0: setting registration..
06:59:19.686 pjsua_core.c ...TX 519 bytes Request msg REGISTER/cseq=22074 (tdta0x152a7828) to UDP 81.23.228.129:5060:
REGISTER sip:proxy.sipthor.net:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.11:5060;rport;branch=z9hG4bKPjbe03e2c7-26a8-473c-915b-c52fb5c7ebe3
Max-Forwards: 70
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22074 REGISTER
Contact: sip:USERXXXXX@192.168.1.11:5060;ob
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0
--end msg--
Registration started callback received >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
06:59:19.687 pjsua_acc.c ..Acc 0: Registration sent
Registration Initiated >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
06:59:19.833 pjsua_core.c .RX 526 bytes Response msg 401/REGISTER/cseq=22074 (rdata0x152a3448) from UDP 81.23.228.129:5060:
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 192.168.1.11:5060;received=192.168.1.11;rport=5060;branch=z9hG4bKPjbe03e2c7-26a8-473c-915b-c52fb5c7ebe3
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info;tag=e7d4d6b46afb9bf88242924a8d869ebf.429b
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22074 REGISTER
WWW-Authenticate: Digest realm="sip2sip.info", nonce="5c271b65a6ae547b3af27622dae9fc546bb6808d"
Server: SIP Thor on OpenSIPS XS 1.11
Content-Length: 0
--end msg--
06:59:19.834 pjsua_core.c ....TX 714 bytes Request msg REGISTER/cseq=22075 (tdta0x152a7828) to UDP 81.23.228.129:5060:
REGISTER sip:proxy.sipthor.net:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.1.11:5060;rport;branch=z9hG4bKPjc2034788-dc95-4433-9c20-73b64baffe15
Max-Forwards: 70
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22075 REGISTER
Contact: sip:USERXXXXX@192.168.1.11:5060;ob
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username="USERXXXXX", realm="sip2sip.info", nonce="5c271b65a6ae547b3af27622dae9fc546bb6808d", uri="sip:proxy.sipthor.net:5060", response="66b9f9d0dc0390af41274c8de4f26ffe"
Content-Length: 0
--end msg--
06:59:20.036 pjsua_core.c .RX 792 bytes Response msg 200/REGISTER/cseq=22075 (rdata0xffff80008798) from UDP 81.23.228.129:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.11:5060;received=192.168.1.11;rport=5060;branch=z9hG4bKPjc2034788-dc95-4433-9c20-73b64baffe15
From: sip:USERXXXXX@sip2sip.info;tag=25125e72-4ef2-4dc1-b7f2-db00dc029ef2
To: sip:USERXXXXX@sip2sip.info;tag=e7d4d6b46afb9bf88242924a8d869ebf.1ca9
Call-ID: 3bfb393d-7383-405b-8fca-e06299cffecf
CSeq: 22075 REGISTER
Contact: sip:USERXXXXX@192.168.1.11:5060;ob;expires=300;received="sip:81.23.228.129:5060;target=%73%69%70:%32%32%33.%32%32%39.%32%34%34.%32%30%38:%35%30%36%30", sip:02581793@192.168.1.10:36279;transport=tls;expires=376;received="sip:81.23.228.129:5060;target=%73%69%70:%32%32%33.%32%32%39.%32%34%34.%32%30%38:%33%34%37%38%35%3b%74%72%61%6e%73%70%6f%72%74%3d%74%6c%73"
Server: SIP Thor on OpenSIPS XS 1.11
Content-Length: 0
--end msg--
06:59:20.037 pjsua_acc.c ....SIP outbound status for acc 0 is not active
06:59:20.037 pjsua_acc.c ....sip:USERXXXXX@sip2sip.info:5060: registration success, status=200 (OK), will re-register in 300 seconds
06:59:20.037 pjsua_acc.c ....Keep-alive timer started for acc 0, destination:81.23.228.129:5060:15, interval:1430523921s
Segmentation fault