1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-06 11:35:32 +00:00

sip: origin: Allow using a local port of 0

Using a port of 0 let's the operating system decide to which port to bind to.
Additionally refuse to use priviliged ports and print a warning.
This commit is contained in:
Evangelos Ribeiro Tzaras 2021-04-11 00:22:57 +02:00
parent f7626e532f
commit 166ea8b21a
2 changed files with 7 additions and 7 deletions

View file

@ -867,6 +867,12 @@ calls_sip_origin_set_property (GObject *object,
break;
case PROP_SIP_LOCAL_PORT:
if (g_value_get_int (value) > 0 && g_value_get_int (value) < 1025) {
g_warning ("Tried setting a priviliged port as the local port to bind to: %d\n"
"Continue using old 'local-port' value: %d (using 0 let's the OS decide)",
g_value_get_int (value), self->local_port);
return;
}
self->local_port = g_value_get_int (value);
break;
@ -1070,7 +1076,7 @@ calls_sip_origin_class_init (CallsSipOriginClass *klass)
g_param_spec_int ("local-port",
"Local port",
"The local port to which the SIP stack binds to",
1025, 65535, 5060,
0, 65535, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_SIP_LOCAL_PORT, props[PROP_SIP_LOCAL_PORT]);

View file

@ -149,12 +149,6 @@ calls_sip_provider_load_accounts (CallsSipProvider *self)
else
port = 5060;
}
if (local_port == 0) {
if (g_strcmp0 (protocol, "TLS") == 0)
local_port = 5061;
else
local_port = 5060;
}
g_debug ("Adding origin for SIP account %s", groups[i]);