Reputation: 515
I try to create multiple sip accounts which should work with different severs but only with one simultaneously, when one of the servers will be available. I easily can create accounts with different IP and SIP numbers and it's working OK. But in the case, where I create an account number with different server IPs but SAME SIP accounts pjsip crashes with this error:
A/DEBUG(200): Abort message: '../src/pj/os_core_unix.c:692: pj_thread_this: assertion "!"Calling pjlib from unknown/external thread. You must " "register external threads with pj_thread_register() " "before calling any pjlib functions."" failed'
I am new with pjsip and SIP altogether, the question is it possible at all??
Upvotes: 4
Views: 1160
Reputation: 550
This crash can be caused either because you call PJSUA2 from unregisterer thread, or because an object was not destroyed manually and GC cleaned it from its thread, which is also not registered.
To check whether your thread is registered:
libIsThreadRegistered()
To register the thread:
libRegisterThread(const string &name)
See pjsua2 reference.
Make sure you destroy objects manually according to documentation:
... application ‘’‘MUST immediately destroy PJSUA2 objects using object’s delete()
method (in Java)’‘’, instead of relying on the GC to clean up the object
So you MUST delete PjSip objects manually, for example:
account.delete();
Upvotes: 1