You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By initializing an ICE client and using its built in STUN to send a stun request to a server, I am able to receive back a public IP and port via the stun handler. However, when I switch to a TURN server to get a relay address, I get no response (except an eventual timeout from the turn handler). It doesn't seem like the ICE client has a built in TURN, so I have to manually allocate when using turnc_alloc.
If I remove the ICE client implementation completely, the TURN client successfully receives a response from the server with a relay address. I'm worried that, because the ICE client and the TURN client both use the same UDP socket, it is causing issues. Shouldn't they be using the same socket so that the addresses received by the TURN client are valid when added to the list of the ICE clients?
// initialize ice session
uint64_t tiebrk = 2;
err = icem_alloc(&m_icem, ICE_ROLE_CONTROLLING, IPPROTO_UDP, 0,
tiebrk, "longufragthatislongenA", "areallylongpasswordthatisdefinitelylongenoughA",
ice_conncheck_handler, this);
if (err) {
ESP_LOGI(TAG,"icem_alloc failed: %d", err);
return;
} else {
ESP_LOGI(TAG,"icem_alloc success");
}
// Assign name, UDP socket, and local address to the ICE client
icem_set_name(m_icem, "A");
err = icem_comp_add(m_icem, 1, m_sock);
if (err) {
ESP_LOGE(TAG, "icem_comp_add failed: %d", err);
return;
} else {
ESP_LOGI(TAG, "icem_comp_add success");
}
err = icem_lcand_add_base(m_icem, ICE_CAND_TYPE_HOST, 1, 0, "host", ICE_TRANSP_UDP, &laddr);
if (err) {
ESP_LOGE(TAG, "icem_lcand_add_base failed: %d", err);
return;
} else {
ESP_LOGI(TAG, "icem_lcand_add_base success");
}
// Allocate TURN to get relay and srflx addresses
struct sa turn_server_addr;
sa_set_str(&turn_server_addr, "178.254.39.50", 3478); // or 64.233.163.127:3478, 74.125.250.129:19302 50.39.254.178
// Use freestun.net credentials
const char* turn_user = "free";
const char* turn_pass = "free";
err = turnc_alloc(&m_turnc, stun_conf(icem_stun(m_icem)), IPPROTO_UDP, m_sock, 0,
&turn_server_addr, turn_user, turn_pass, 60,
turn_handler, this);
if (err) {
ESP_LOGE(TAG, "turnc_alloc failed: %d", err);
m_turnc = NULL;
} else {
ESP_LOGI(TAG, "TURN client allocation initiated to get RELAY and SRFLX candidates.");
}
// Associate the TURN client with the ICE media object for component 1.
// This allows ICE to use the TURN client to create relay candidates.
err = icem_set_turn_client(m_icem, 1, m_turnc);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
By initializing an ICE client and using its built in STUN to send a stun request to a server, I am able to receive back a public IP and port via the stun handler. However, when I switch to a TURN server to get a relay address, I get no response (except an eventual timeout from the turn handler). It doesn't seem like the ICE client has a built in TURN, so I have to manually allocate when using turnc_alloc.
If I remove the ICE client implementation completely, the TURN client successfully receives a response from the server with a relay address. I'm worried that, because the ICE client and the TURN client both use the same UDP socket, it is causing issues. Shouldn't they be using the same socket so that the addresses received by the TURN client are valid when added to the list of the ICE clients?
Beta Was this translation helpful? Give feedback.
All reactions