'PJSUA call_make_call returned a result with an error set

i have a problem when use PJSUA module with the python3, when i make the call is always have a error:

SystemError:<built-in function call_make_call> returned a result with an error set

and a PiCallCallback class:

class PiCallCallback(pj.CallCallback):

def __init__(self, call=None):
    pj.CallCallback.__init__(self, call)
    
def on_media_state(self):
    print("Call info: " , self.call.info())
    if self.call.info().media_state == pj.MediaState.ACTIVE:
        # Connect the call to sound device
        call_slot = self.call.info().conf_slot
        pj.Lib.instance().conf_connect(call_slot, 0)
        pj.Lib.instance().conf_connect(0, call_slot)
        print("Media is now active")
    else:
        print("Media is inactive")
        
def on_state(self):
    print("On state: ", self.call)
    print(self.call.dump_status())
    

and the last one PiAccountCallback class:

class PiAccountCallback(pj.AccountCallback):
sem=None
def __init__(self, account = None):
    pj.AccountCallback.__init__(self, account)

def wait(self):
    self.sem = threading.Semaphore(0,verbose=True)
    self.sem.acquire()
def on_reg_state(self):
    if self.sem:
        if self.account.info().reg_status >= 200:
            self.sem.release()
def on_incoming_call(self, call):
    cb = PiCallCallback(call)
    call.set_callback(cb)
    call.answer(200,'') 

Error screen



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source