Symmetric NAT and port forwarding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm trying to use port forwarding on the router as an alternative to
solving the problem with transporting the audio through symmetric NAT,
without needing a media relay, but I don't know if I'm doing it right.

I'm using pjsua2_lib to create my classes.

To start the lib;
...
pj::TransportConfig tcfg;
tcfg.publicAddress = getAppProperties()->getMyPublicIpAddress();
tcfg.port = udpPort; //Set local port for SIP transport. Default is
5060 for UDP and TCP, and 5061 for TLS.

try
{
    pj::Endpoint::instance().libCreate();
    pj::Endpoint::instance().libInit(endpointConfig);
    pj::Endpoint::instance().transportCreate(PJSIP_TRANSPORT_UDP, tcfg);
    pj::Endpoint::instance().codecSetPriority("opus/48000", 131);
    pj::Endpoint::instance().libStart();
} catch (pj::Error & error)
{
    std::cout << error.reason;
}
...

To register my account on the server I'm using "class MyAccount :
public pj::Account" and I set the transportConfig properties.
...
MyAccount:: MyAccount(string server, string user, string password)
{
    pj::AccountConfig acc_cfg;

    pj::AuthCredInfo aci_cfg("digest", "*",
                             std::string(user),
                             0,
                             std::string(password));

    acc_cfg.idUri = String("sip:" + user + "@" + server).toStdString();
    acc_cfg.regConfig.registrarUri = ("sip:" + server).toStdString();
    acc_cfg.sipConfig.authCreds.push_back(*&aci_cfg);

    acc_cfg.presConfig.publishEnabled = PJ_TRUE;

    acc_cfg.mediaConfig.transportConfig.publicAddress =
getAppProperties()->getMyPublicIpAddress();
    acc_cfg.mediaConfig.transportConfig.port =
getAppProperties().getUserSettings()->getMediaTransportRtpPort();
    acc_cfg.mediaConfig.transportConfig.portRange = 10;

    this->setDefault();
    create(acc_cfg);
}
...
At each endpoint I set up a different localport and rtpport (range).
And on the router I forwarded the respective ports to the respective
endpoints. However, I believe we will not need to forward the
localport.

Both endpoints are on the same network and the SIP server is in the
cloud (public ip).

In this test STUN and ICE are disabled.

Should that work?

If anyone can help me,
Thanks
.
Thiago Guimarães

_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux