使用 pjsua2 文档,演示代码如下:
// Configure an AccountConfig
AccountConfig acfg;
acfg.idUri = "sip:test@pjsip.org";
acfg.regConfig.registrarUri = "sip:pjsip.org";
AuthCredInfo cred("digest", "*", "test", 0, "secret");
acfg.sipConfig.authCreds.push_back( cred );
// Create the account
MyAccount *acc = new MyAccount;
acc->create(acfg);
// Here we don't have anything else to do..
pj_thread_sleep(10000);
// Delete the account. This will unregister from server
delete acc;
// This will implicitly shutdown the library
return 0;
它pj_thread_sleep(10000)
用于避免应用程序退出。
我需要 pjsua2 应用程序始终作为服务器端运行,不应该退出。
所以我应该使用这个函数来代替pj_thread_sleep
,比如“loop_forever”,谢谢。