0

我正在尝试在 pabx sip 上注册 pjsua2“(pjsip)”,当没有 nat 时,这个注册器可以正常工作,但是当有 nat 时它不注册。我正在使用 demo 使用的标准设置

bool SipAccount::start(){
    this->ep.libCreate();
    // Initialize endpoint
    this->ep.libInit(this->ep_cfg );

    // Create SIP transport. Error handling sample is shown
    this->tcfg.port = this->port;
    try {
        this->ep.transportCreate(PJSIP_TRANSPORT_UDP, this->tcfg);
    } catch (Error &err) {
        std::cout << err.info() << std::endl;
        return false;
    }

    // Start the library (worker threads etc)
    this->ep.libStart();
    std::cout << "*** PJSUA2 STARTED ***" << std::endl;

    // Configure an AccountConfig


    this->acfg.idUri = idUri.toLatin1().data();
    this->acfg.regConfig.registrarUri =  regUri.toLatin1().data();

    this->acfg.callConfig.timerMinSESec = 120;
    this->acfg.callConfig.timerSessExpiresSec = 1800;

    this->cred.username = this->username.toLatin1().data();
    this->cred.scheme = "digest";
    this->cred.realm = "*";
    this->cred.dataType = 0;
    this->cred.data = this->password.toLatin1().data();

    this->acfg.sipConfig.authCreds.push_back( this->cred );

    // Setup the account
    SipLine *l = new SipLine();
    l->setHandler(this->handler);
    l->create(acfg);

    // Here we don't have anything else to do..
    this->line = l;
    // pj_thread_sleep(10000);
    return true;
}

我的问题是使用 pjsip 的 rport,我没有设置凭据,用于通信的端口无效。

这是测试中使用的标头中的示例

在此处输入图像描述

4

0 回答 0