[Python] Calling pj_thread_register from python

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to use pjsip via pjsua2 in python. I have a problem with threading.

    import pjsua2 as pj
    import threading

    # pjsua2 test function
    def pjsua2_test():
    # Create and initialize the library
    ep = pj.Endpoint()
    ep.libCreate()

    if __name__ == "__main__":
    pjsuadaemonthread = threading.Thread(name='PJSUA',
    target=pjsua2_test)
    pjsuadaemonthread.start()
    ep = pj.Endpoint()
    ep.libHandleEvents(10)


    I get this error:

    python3: ../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.


    How do I call pj_thread_register(), from python?

    Continue reading...

Compartilhe esta Página