NAT64 on iOS

IN
Igor Nazarov
Wed, Feb 21, 2018 12:25 PM

Apple requires that applications should support IPv6 DNS64/NAT64 networks.
PJSIP recommends to enable ICE and use a dual stack TURN server (
https://trac.pjsip.org/repos/wiki/IPv6#NAT64). I've set up such a server
and configured it in my iOS application in the next way:

bool enableTurn = SIPConfig::getInstance()->getEnableTurn();

if (enableTurn)

{

    mPjsuaMediaConfig.enable_turn = PJ_TRUE;



    turnServer = SIPConfig::getInstance()->getTurnServer();

    int turnPort = SIPConfig::getInstance()->getTurnPort();

    bool useTcpForTurn = SIPConfig::getInstance()->getTcpForTURN();

    turnRealm = SIPConfig::getInstance()->getTurnRealm();

    turnUser = SIPConfig::getInstance()->getTurnUser();

    turnPassword = SIPConfig::getInstance()->getTurnPassword();



    LOG_INFO("PJSIP", " Setting TURN with server address: %s, port: %d,

realm: %s, username: %s,  use TCP: %d", turnServer.c_str(), turnPort,
turnRealm.c_str(), turnUser.c_str(), useTcpForTurn);

    char turn_server_and_port[4096];

    sprintf(turn_server_and_port, "%s:%d", turnServer.c_str(),

turnPort);

    pj_str_t turn_server = pj_str((char *)turn_server_and_port);

    pj_strdup_with_null(PJSIPResources::getInstance()->getPool(), &

mPjsuaMediaConfig.turn_server, &turn_server);

    if (useTcpForTurn)

    {

        mPjsuaMediaConfig.turn_conn_type = PJ_TURN_TP_TCP;

    }



    mPjsuaMediaConfig.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC;

    mPjsuaMediaConfig.turn_auth_cred.data.static_cred.realm = pj_str((

char *)turnRealm.c_str());

    mPjsuaMediaConfig.turn_auth_cred.data.static_cred.username = pj_str

((char *)turnUser.c_str());

    mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data_type =

PJ_STUN_PASSWD_PLAIN;

    mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data = pj_str((

char *)turnPassword.c_str());

}

My app is able to register on NAT64 network. When I'm trying to make a call
it sends an INVITE message a few times, but the server doesn't respond for
this INVITE at all. The INVITE contains an IPv4 address (which is my iPhone
public IP address) in its "Via" and "Contact" fields in message headers.
The SDP contains a relayed IPv4 address 172.31.8.187 in its "Connection
Information" and "Media Attribute" fields and if I understand correctly
this is a reserved IP address and thus any ISP will drop a packet sent to
such and address. Am I right? Could this be a reason of my problem that the
server is not responding to my INVITE?

Any answer is highly appreciated. Thanks!

With Best Regards,
Igor Nazarov

Apple requires that applications should support IPv6 DNS64/NAT64 networks. PJSIP recommends to enable ICE and use a dual stack TURN server ( https://trac.pjsip.org/repos/wiki/IPv6#NAT64). I've set up such a server and configured it in my iOS application in the next way: bool enableTurn = SIPConfig::getInstance()->getEnableTurn(); if (enableTurn) { mPjsuaMediaConfig.enable_turn = PJ_TRUE; turnServer = SIPConfig::getInstance()->getTurnServer(); int turnPort = SIPConfig::getInstance()->getTurnPort(); bool useTcpForTurn = SIPConfig::getInstance()->getTcpForTURN(); turnRealm = SIPConfig::getInstance()->getTurnRealm(); turnUser = SIPConfig::getInstance()->getTurnUser(); turnPassword = SIPConfig::getInstance()->getTurnPassword(); LOG_INFO("PJSIP", " Setting TURN with server address: %s, port: %d, realm: %s, username: %s, use TCP: %d", turnServer.c_str(), turnPort, turnRealm.c_str(), turnUser.c_str(), useTcpForTurn); char turn_server_and_port[4096]; sprintf(turn_server_and_port, "%s:%d", turnServer.c_str(), turnPort); pj_str_t turn_server = pj_str((char *)turn_server_and_port); pj_strdup_with_null(PJSIPResources::getInstance()->getPool(), & mPjsuaMediaConfig.turn_server, &turn_server); if (useTcpForTurn) { mPjsuaMediaConfig.turn_conn_type = PJ_TURN_TP_TCP; } mPjsuaMediaConfig.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC; mPjsuaMediaConfig.turn_auth_cred.data.static_cred.realm = pj_str(( char *)turnRealm.c_str()); mPjsuaMediaConfig.turn_auth_cred.data.static_cred.username = pj_str ((char *)turnUser.c_str()); mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data_type = PJ_STUN_PASSWD_PLAIN; mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data = pj_str(( char *)turnPassword.c_str()); } My app is able to register on NAT64 network. When I'm trying to make a call it sends an INVITE message a few times, but the server doesn't respond for this INVITE at all. The INVITE contains an IPv4 address (which is my iPhone public IP address) in its "Via" and "Contact" fields in message headers. The SDP contains a relayed IPv4 address 172.31.8.187 in its "Connection Information" and "Media Attribute" fields and if I understand correctly this is a reserved IP address and thus any ISP will drop a packet sent to such and address. Am I right? Could this be a reason of my problem that the server is not responding to my INVITE? Any answer is highly appreciated. Thanks! *With Best Regards,* *Igor Nazarov*
S
sales
Wed, Feb 21, 2018 6:10 PM

Is your app on swift or objective c? if swift then which version?

On Wed, Feb 21, 2018 at 5:55 PM, Igor Nazarov <
igor.nazarov@greenfieldtech.net> wrote:

Apple requires that applications should support IPv6 DNS64/NAT64 networks.
PJSIP recommends to enable ICE and use a dual stack TURN server (
https://trac.pjsip.org/repos/wiki/IPv6#NAT64). I've set up such a server
and configured it in my iOS application in the next way:

bool enableTurn = SIPConfig::getInstance()->getEnableTurn();

 if (enableTurn)

 {

     mPjsuaMediaConfig.enable_turn = PJ_TRUE;



     turnServer = SIPConfig::getInstance()->getTurnServer();

     int turnPort = SIPConfig::getInstance()->getTurnPort();

     bool useTcpForTurn = SIPConfig::getInstance()->getTcpForTURN();

     turnRealm = SIPConfig::getInstance()->getTurnRealm();

     turnUser = SIPConfig::getInstance()->getTurnUser();

     turnPassword = SIPConfig::getInstance()->getTurnPassword();



     LOG_INFO("PJSIP", " Setting TURN with server address: %s, port:

%d, realm: %s, username: %s,  use TCP: %d", turnServer.c_str(), turnPort,
turnRealm.c_str(), turnUser.c_str(), useTcpForTurn);

     char turn_server_and_port[4096];

     sprintf(turn_server_and_port, "%s:%d", turnServer.c_str(),

turnPort);

     pj_str_t turn_server = pj_str((char *)turn_server_and_port);

     pj_strdup_with_null(PJSIPResources::getInstance()->getPool(), &

mPjsuaMediaConfig.turn_server, &turn_server);

     if (useTcpForTurn)

     {

         mPjsuaMediaConfig.turn_conn_type = PJ_TURN_TP_TCP;

     }



     mPjsuaMediaConfig.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC;

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.realm = pj_str((

char *)turnRealm.c_str());

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.username =

pj_str((char *)turnUser.c_str());

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data_type =

PJ_STUN_PASSWD_PLAIN;

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data = pj_str((

char *)turnPassword.c_str());

 }

My app is able to register on NAT64 network. When I'm trying to make a
call it sends an INVITE message a few times, but the server doesn't respond
for this INVITE at all. The INVITE contains an IPv4 address (which is my
iPhone public IP address) in its "Via" and "Contact" fields in message
headers. The SDP contains a relayed IPv4 address 172.31.8.187 in its
"Connection Information" and "Media Attribute" fields and if I understand
correctly this is a reserved IP address and thus any ISP will drop a packet
sent to such and address. Am I right? Could this be a reason of my
problem that the server is not responding to my INVITE?

Any answer is highly appreciated. Thanks!

With Best Regards,
Igor Nazarov


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

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

Is your app on swift or objective c? if swift then which version? On Wed, Feb 21, 2018 at 5:55 PM, Igor Nazarov < igor.nazarov@greenfieldtech.net> wrote: > Apple requires that applications should support IPv6 DNS64/NAT64 networks. > PJSIP recommends to enable ICE and use a dual stack TURN server ( > https://trac.pjsip.org/repos/wiki/IPv6#NAT64). I've set up such a server > and configured it in my iOS application in the next way: > > bool enableTurn = SIPConfig::getInstance()->getEnableTurn(); > > if (enableTurn) > > { > > mPjsuaMediaConfig.enable_turn = PJ_TRUE; > > > > turnServer = SIPConfig::getInstance()->getTurnServer(); > > int turnPort = SIPConfig::getInstance()->getTurnPort(); > > bool useTcpForTurn = SIPConfig::getInstance()->getTcpForTURN(); > > turnRealm = SIPConfig::getInstance()->getTurnRealm(); > > turnUser = SIPConfig::getInstance()->getTurnUser(); > > turnPassword = SIPConfig::getInstance()->getTurnPassword(); > > > > LOG_INFO("PJSIP", " Setting TURN with server address: %s, port: > %d, realm: %s, username: %s, use TCP: %d", turnServer.c_str(), turnPort, > turnRealm.c_str(), turnUser.c_str(), useTcpForTurn); > > > > char turn_server_and_port[4096]; > > sprintf(turn_server_and_port, "%s:%d", turnServer.c_str(), > turnPort); > > pj_str_t turn_server = pj_str((char *)turn_server_and_port); > > pj_strdup_with_null(PJSIPResources::getInstance()->getPool(), & > mPjsuaMediaConfig.turn_server, &turn_server); > > > > if (useTcpForTurn) > > { > > mPjsuaMediaConfig.turn_conn_type = PJ_TURN_TP_TCP; > > } > > > > mPjsuaMediaConfig.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC; > > mPjsuaMediaConfig.turn_auth_cred.data.static_cred.realm = pj_str(( > char *)turnRealm.c_str()); > > mPjsuaMediaConfig.turn_auth_cred.data.static_cred.username = > pj_str((char *)turnUser.c_str()); > > mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data_type = > PJ_STUN_PASSWD_PLAIN; > > mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data = pj_str(( > char *)turnPassword.c_str()); > > } > > My app is able to register on NAT64 network. When I'm trying to make a > call it sends an INVITE message a few times, but the server doesn't respond > for this INVITE at all. The INVITE contains an IPv4 address (which is my > iPhone public IP address) in its "Via" and "Contact" fields in message > headers. The SDP contains a relayed IPv4 address 172.31.8.187 in its > "Connection Information" and "Media Attribute" fields and if I understand > correctly this is a reserved IP address and thus any ISP will drop a packet > sent to such and address. Am I right? Could this be a reason of my > problem that the server is not responding to my INVITE? > > Any answer is highly appreciated. Thanks! > > *With Best Regards,* > *Igor Nazarov* > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >
IN
Igor Nazarov
Wed, Feb 21, 2018 6:18 PM

My app is on Objective C and C++, but actually it doesn't matter...

With Best Regards,
Igor Nazarov

On Wed, Feb 21, 2018 at 8:10 PM, sales sales@startelelogic.com wrote:

Is your app on swift or objective c? if swift then which version?

On Wed, Feb 21, 2018 at 5:55 PM, Igor Nazarov <
igor.nazarov@greenfieldtech.net> wrote:

Apple requires that applications should support IPv6 DNS64/NAT64
networks. PJSIP recommends to enable ICE and use a dual stack TURN server (
https://trac.pjsip.org/repos/wiki/IPv6#NAT64). I've set up such a server
and configured it in my iOS application in the next way:

bool enableTurn = SIPConfig::getInstance()->getEnableTurn();

 if (enableTurn)

 {

     mPjsuaMediaConfig.enable_turn = PJ_TRUE;



     turnServer = SIPConfig::getInstance()->getTurnServer();

     int turnPort = SIPConfig::getInstance()->getTurnPort();

     bool useTcpForTurn = SIPConfig::getInstance()->getTcpForTURN();

     turnRealm = SIPConfig::getInstance()->getTurnRealm();

     turnUser = SIPConfig::getInstance()->getTurnUser();

     turnPassword = SIPConfig::getInstance()->getTurnPassword();



     LOG_INFO("PJSIP", " Setting TURN with server address: %s, port:

%d, realm: %s, username: %s,  use TCP: %d", turnServer.c_str(),
turnPort, turnRealm.c_str(), turnUser.c_str(), useTcpForTurn);

     char turn_server_and_port[4096];

     sprintf(turn_server_and_port, "%s:%d", turnServer.c_str(),

turnPort);

     pj_str_t turn_server = pj_str((char *)turn_server_and_port);

     pj_strdup_with_null(PJSIPResources::getInstance()->getPool(), &

mPjsuaMediaConfig.turn_server, &turn_server);

     if (useTcpForTurn)

     {

         mPjsuaMediaConfig.turn_conn_type = PJ_TURN_TP_TCP;

     }



     mPjsuaMediaConfig.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC;

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.realm = pj_str

((char *)turnRealm.c_str());

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.username =

pj_str((char *)turnUser.c_str());

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data_type =

PJ_STUN_PASSWD_PLAIN;

     mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data = pj_str((

char *)turnPassword.c_str());

 }

My app is able to register on NAT64 network. When I'm trying to make a
call it sends an INVITE message a few times, but the server doesn't respond
for this INVITE at all. The INVITE contains an IPv4 address (which is my
iPhone public IP address) in its "Via" and "Contact" fields in message
headers. The SDP contains a relayed IPv4 address 172.31.8.187 in its
"Connection Information" and "Media Attribute" fields and if I understand
correctly this is a reserved IP address and thus any ISP will drop a packet
sent to such and address. Am I right? Could this be a reason of my
problem that the server is not responding to my INVITE?

Any answer is highly appreciated. Thanks!

With Best Regards,
Igor Nazarov


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

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

My app is on Objective C and C++, but actually it doesn't matter... *With Best Regards,* *Igor Nazarov* On Wed, Feb 21, 2018 at 8:10 PM, sales <sales@startelelogic.com> wrote: > Is your app on swift or objective c? if swift then which version? > > On Wed, Feb 21, 2018 at 5:55 PM, Igor Nazarov < > igor.nazarov@greenfieldtech.net> wrote: > >> Apple requires that applications should support IPv6 DNS64/NAT64 >> networks. PJSIP recommends to enable ICE and use a dual stack TURN server ( >> https://trac.pjsip.org/repos/wiki/IPv6#NAT64). I've set up such a server >> and configured it in my iOS application in the next way: >> >> bool enableTurn = SIPConfig::getInstance()->getEnableTurn(); >> >> if (enableTurn) >> >> { >> >> mPjsuaMediaConfig.enable_turn = PJ_TRUE; >> >> >> >> turnServer = SIPConfig::getInstance()->getTurnServer(); >> >> int turnPort = SIPConfig::getInstance()->getTurnPort(); >> >> bool useTcpForTurn = SIPConfig::getInstance()->getTcpForTURN(); >> >> turnRealm = SIPConfig::getInstance()->getTurnRealm(); >> >> turnUser = SIPConfig::getInstance()->getTurnUser(); >> >> turnPassword = SIPConfig::getInstance()->getTurnPassword(); >> >> >> >> LOG_INFO("PJSIP", " Setting TURN with server address: %s, port: >> %d, realm: %s, username: %s, use TCP: %d", turnServer.c_str(), >> turnPort, turnRealm.c_str(), turnUser.c_str(), useTcpForTurn); >> >> >> >> char turn_server_and_port[4096]; >> >> sprintf(turn_server_and_port, "%s:%d", turnServer.c_str(), >> turnPort); >> >> pj_str_t turn_server = pj_str((char *)turn_server_and_port); >> >> pj_strdup_with_null(PJSIPResources::getInstance()->getPool(), & >> mPjsuaMediaConfig.turn_server, &turn_server); >> >> >> >> if (useTcpForTurn) >> >> { >> >> mPjsuaMediaConfig.turn_conn_type = PJ_TURN_TP_TCP; >> >> } >> >> >> >> mPjsuaMediaConfig.turn_auth_cred.type = PJ_STUN_AUTH_CRED_STATIC; >> >> mPjsuaMediaConfig.turn_auth_cred.data.static_cred.realm = pj_str >> ((char *)turnRealm.c_str()); >> >> mPjsuaMediaConfig.turn_auth_cred.data.static_cred.username = >> pj_str((char *)turnUser.c_str()); >> >> mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data_type = >> PJ_STUN_PASSWD_PLAIN; >> >> mPjsuaMediaConfig.turn_auth_cred.data.static_cred.data = pj_str(( >> char *)turnPassword.c_str()); >> >> } >> >> My app is able to register on NAT64 network. When I'm trying to make a >> call it sends an INVITE message a few times, but the server doesn't respond >> for this INVITE at all. The INVITE contains an IPv4 address (which is my >> iPhone public IP address) in its "Via" and "Contact" fields in message >> headers. The SDP contains a relayed IPv4 address 172.31.8.187 in its >> "Connection Information" and "Media Attribute" fields and if I understand >> correctly this is a reserved IP address and thus any ISP will drop a packet >> sent to such and address. Am I right? Could this be a reason of my >> problem that the server is not responding to my INVITE? >> >> Any answer is highly appreciated. Thanks! >> >> *With Best Regards,* >> *Igor Nazarov* >> >> _______________________________________________ >> Visit our blog: http://blog.pjsip.org >> >> pjsip mailing list >> pjsip@lists.pjsip.org >> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org >> >> > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >