pjproject
pjproject copied to clipboard
PJSUA2 - Example Pythons Script Unsolicited NOTIFY caused core dump
Describe the bug
import pjsua2 as pj import time import threading
class Account(pj.Account): def onRegState(self, prm): print("***OnRegState: " + prm.reason)
def onMwiInfo(self, prm):
print("OnMwiState: " + prm.reason)
def onBuddyState(self, prm):
print("OnBuddyState: " + prm.reason)
def onIncommingSubscribe(self, prm):
print("OnSubscribeState: " + prm.reason)
def initalise_sip_stack():
ep_cfg = pj.EpConfig()
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:[email protected]"
acfg.regConfig.registrarUri = "sip:192.168.1.10"
creds = pj.AuthCredInfo("digest", "ccmsipline", "iann", 0, "12345")
acfg.sipConfig.authCreds.append(creds)
acc = Account()
acc.create(acfg)
return ep
if name == "main":
ep = initalise_sip_stack()
time.sleep(100)
ep.libDestroy()
Steps to reproduce
Copy and paste the example python script in to main.py and run it with a valid account on a Cisco CUCM 12.5. After the sip registers the CUCM sends an up solicited NOTIFY to update VM MWI (I think). The code count seem to be able to fins the account in an internal list to map the Notify to one of the 3 accounts
pjsua_acc.c ..No available account to handle Request msg NOTIFY/cseq=101 (rdata0x7f76a4009158) python3: ../src/pjsua-lib/pjsua_acc.c:623: pjsua_acc_get_user_data: Assertion `acc_id>=0 && acc_id<(int)(sizeof(pjsua_var.acc)/sizeof(pjsua_var.acc[0]))' failed. Aborted (core dumped)
PJSIP version
2.12 dev
Context
Ununtu linux
Log, call stack, etc
--end msg--
11:53:26.692 pjsua_core.c .RX 469 bytes Response msg 200/REGISTER/cseq=46185 (rdata0x7f76a4009158) from UDP 192.168.1.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.240:5060;rport;branch=z9hG4bKPjN-9m5VPz52iWm87GpZE.sHj5hJxW9pA2
From: <sip:[email protected]>;tag=LQW2bOIjzUDvppJv4ZKLx2fhjjbtcqOU
To: <sip:[email protected]>;tag=1321046574
Date: Mon, 27 Jun 2022 11:53:26 GMT
Call-ID: YydNaedCQCYQZKppoFtDZaZvM8q2PG2B
Server: Cisco-CUCM12.5
CSeq: 46185 REGISTER
Expires: 120
Contact: <sip:[email protected]:5060;ob>;x-cisco-newreg
Supported: X-cisco-sis-9.2.0
Content-Length: 0
--end msg--
11:53:26.692 pjsua_core.c .RX 520 bytes Request msg NOTIFY/cseq=101 (rdata0x7f76a4009158) from UDP 192.168.1.10:5060:
NOTIFY sip:[email protected]:5060;ob SIP/2.0
Via: SIP/2.0/UDP 192.168.1.10:5060;branch=z9hG4bK16874e2d5
From: <sip:[email protected]>;tag=1590501128
To: <sip:[email protected]>
Call-ID: [email protected]
CSeq: 101 NOTIFY
Max-Forwards: 70
Date: Mon, 27 Jun 2022 11:53:26 GMT
User-Agent: Cisco-CUCM12.5
Event: message-summary
Subscription-State: active
Contact: <sip:[email protected]:5060>
Content-Type: application/simple-message-summary
Content-Length: 22
Messages-Waiting: no
--end msg--
11:53:26.692 pjsua_pres.c .Got unsolicited NOTIFY from 192.168.1.10:5060..
11:53:26.693 pjsua_core.c ...TX 286 bytes Response msg 200/NOTIFY/cseq=101 (tdta0x7f76a40067e8) to UDP 192.168.1.10:5060:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.1.10:5060;received=192.168.1.10;branch=z9hG4bK16874e2d5
Call-ID: [email protected]
From: <sip:[email protected]>;tag=1590501128
To: <sip:[email protected]>;tag=z9hG4bK16874e2d5
CSeq: 101 NOTIFY
Content-Length: 0
--end msg--
11:53:26.693 pjsua_acc.c ..No available account to handle Request msg NOTIFY/cseq=101 (rdata0x7f76a4009158)
python3: ../src/pjsua-lib/pjsua_acc.c:623: pjsua_acc_get_user_data: Assertion `acc_id>=0 && acc_id<(int)(sizeof(pjsua_var.acc)/sizeof(pjsua_var.acc[0]))' failed.
Aborted (core dumped)
iann@clipper-3d:~/call_test$