0

2次我需要将外部线程注册到pjsip。当我第一次注册线程以调用 pjsip 注册函数注册到星号服务器时,注册一切顺利,用户也注册到星号服务器。但是当我第二次尝试注册线程以调用 pjsip 的 make_call 函数进行调用时,应用程序在 pj_thread_registe 行上崩溃。请帮我解决这个问题。

4

1 回答 1

0

当您尝试发起新呼叫时,您必须在进行新注册之前检查当前线程是否已经注册。您的注册线程方法可能如下面的代码所示。

-(void)registerThread{
    pj_status_t status;
    pj_thread_desc aPJThreadDesc;
    if (!pj_thread_is_registered()) {
        pj_thread_t *pjThread;
        status = pj_thread_register(NULL, aPJThreadDesc, &pjThread);
        if (status != PJ_SUCCESS) {
            NSString *errorMsg = @"Error registering thread at PJSUA";
            ALog(@"%@", errorMsg);
        }
    }
}
于 2017-07-27T14:25:09.947 回答