Changed stun
This commit is contained in:
parent
dbde035d77
commit
85df6e096f
@ -1 +1 @@
|
|||||||
Subproject commit 8fca354e65c2fd37414d1527e60800ed4669ea07
|
Subproject commit 1a18e5809c467954c9d46783269387e492312851
|
@ -123,7 +123,9 @@ bool config::web::activated;
|
|||||||
std::deque<std::tuple<std::string, std::string, std::string>> config::web::ssl::certificates;
|
std::deque<std::tuple<std::string, std::string, std::string>> config::web::ssl::certificates;
|
||||||
uint16_t config::web::webrtc_port_max;
|
uint16_t config::web::webrtc_port_max;
|
||||||
uint16_t config::web::webrtc_port_min;
|
uint16_t config::web::webrtc_port_min;
|
||||||
deque<string> config::web::ice_servers;
|
bool config::web::stun_enabled;
|
||||||
|
std::string config::web::stun_host;
|
||||||
|
uint16_t config::web::stun_port;
|
||||||
bool config::web::enable_upnp;
|
bool config::web::enable_upnp;
|
||||||
|
|
||||||
size_t config::log::vs_size;
|
size_t config::log::vs_size;
|
||||||
@ -495,26 +497,6 @@ vector<string> config::parseConfig(const std::string& path) {
|
|||||||
auto bindings = create_bindings();
|
auto bindings = create_bindings();
|
||||||
read_bindings(config, bindings);
|
read_bindings(config, bindings);
|
||||||
build_comments(comments, bindings);
|
build_comments(comments, bindings);
|
||||||
|
|
||||||
for(const auto& entry : config::web::ice_servers) {
|
|
||||||
auto dp = entry.find(':');
|
|
||||||
if(dp == string::npos) {
|
|
||||||
errors.emplace_back("Invalid ice server entry! Missing port");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
auto host = entry.substr(0, dp);
|
|
||||||
auto port = entry.substr(dp + 1);
|
|
||||||
if(port.find_last_not_of("0123456789") != string::npos) {
|
|
||||||
errors.push_back("Invalid ice server entry! Invalid port (" + port + ")");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
stoi(port);
|
|
||||||
} catch(std::exception& ex) {
|
|
||||||
errors.push_back("Invalid ice server entry! Invalid port (" + port + ")");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto currentVersion = config::server::default_version();
|
auto currentVersion = config::server::default_version();
|
||||||
@ -1490,9 +1472,22 @@ std::deque<std::shared_ptr<EntryBinding>> config::create_bindings() {
|
|||||||
ADD_NOTE("These ports must opened to use the voice bridge (Protocol: UDP)");
|
ADD_NOTE("These ports must opened to use the voice bridge (Protocol: UDP)");
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
CREATE_BINDING("webrtc.ice", 0);
|
CREATE_BINDING("webrtc.stun.enabled", 0);
|
||||||
BIND_VECTOR(config::web::ice_servers, {"stun.l.google.com:19302"});
|
BIND_INTEGRAL(config::web::stun_enabled, false, false, true);
|
||||||
ADD_DESCRIPTION("A list of possible offered ice servers");
|
ADD_DESCRIPTION("Whatever to use a STUN server");
|
||||||
|
ADD_NOTE_RELOADABLE();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
CREATE_BINDING("webrtc.stun.host", 0);
|
||||||
|
BIND_STRING(config::web::stun_host, "stun.l.google.com");
|
||||||
|
ADD_DESCRIPTION("Stun hostname");
|
||||||
|
ADD_NOTE_RELOADABLE();
|
||||||
|
}
|
||||||
|
{
|
||||||
|
CREATE_BINDING("webrtc.stun.port", 0);
|
||||||
|
BIND_INTEGRAL(config::web::stun_port, 19302, 1, 65565);
|
||||||
|
ADD_DESCRIPTION("Port of the stun server");
|
||||||
|
ADD_NOTE_RELOADABLE();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
@ -208,8 +208,12 @@ namespace ts::config {
|
|||||||
|
|
||||||
extern uint16_t webrtc_port_min;
|
extern uint16_t webrtc_port_min;
|
||||||
extern uint16_t webrtc_port_max;
|
extern uint16_t webrtc_port_max;
|
||||||
extern std::deque<std::string> ice_servers;
|
|
||||||
extern bool enable_upnp;
|
extern bool enable_upnp;
|
||||||
|
|
||||||
|
extern bool stun_enabled;
|
||||||
|
extern std::string stun_host;
|
||||||
|
extern uint16_t stun_port;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace threads {
|
namespace threads {
|
||||||
|
@ -69,20 +69,8 @@ VoiceBridge::VoiceBridge(const shared_ptr<WebClient>& owner) : _owner(owner) {
|
|||||||
config->nice_config = make_shared<rtc::NiceWrapper::Config>();
|
config->nice_config = make_shared<rtc::NiceWrapper::Config>();
|
||||||
|
|
||||||
config->nice_config->ice_port_range = {config::web::webrtc_port_min, config::web::webrtc_port_max};
|
config->nice_config->ice_port_range = {config::web::webrtc_port_min, config::web::webrtc_port_max};
|
||||||
for(const auto& entry : config::web::ice_servers) {
|
if(config::web::stun_enabled)
|
||||||
auto dp = entry.find(':');
|
config->nice_config->stun_server = { config::web::stun_host, config::web::stun_port };
|
||||||
if(dp == string::npos) continue;
|
|
||||||
auto host = entry.substr(0, dp);
|
|
||||||
auto port = entry.substr(dp + 1);
|
|
||||||
if(port.find_last_not_of("0123456789") != string::npos) continue;
|
|
||||||
|
|
||||||
if(host == "stun.l.google.com" && port == "9302")
|
|
||||||
port = "19302"; /* fix for the invalid config value until 1.3.14beta1 :) */
|
|
||||||
|
|
||||||
try {
|
|
||||||
config->nice_config->stun_server = {host,(uint16_t) stoi(port)};
|
|
||||||
} catch(std::exception& ex) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
config->nice_config->allow_ice_udp = true;
|
config->nice_config->allow_ice_udp = true;
|
||||||
config->nice_config->allow_ice_tcp = false;
|
config->nice_config->allow_ice_tcp = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user