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());
}
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org