mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-09-28 23:05:32 +00:00
sip-origin: Always include the transport parameter in sip URLs
This simplifies the code as well as fixes issues with newer sofia requiring the 'transport=tls' to be present for SIPS. Closes: #482
This commit is contained in:
parent
1cff3a46cb
commit
3069a4af50
1 changed files with 16 additions and 28 deletions
|
@ -953,8 +953,8 @@ setup_nua (CallsSipOrigin *self)
|
||||||
const char *ipv4_bind = "0.0.0.0";
|
const char *ipv4_bind = "0.0.0.0";
|
||||||
const char *uuid = NULL;
|
const char *uuid = NULL;
|
||||||
g_autofree char *urn_uuid = NULL;
|
g_autofree char *urn_uuid = NULL;
|
||||||
g_autofree char *sip_url = NULL;
|
g_autofree char *url = NULL;
|
||||||
g_autofree char *sips_url = NULL;
|
g_autofree char *protocol_lower = NULL;
|
||||||
g_autofree char *from_str = NULL;
|
g_autofree char *from_str = NULL;
|
||||||
|
|
||||||
if (!STR_IS_NULL_OR_EMPTY (sip_test_env)) {
|
if (!STR_IS_NULL_OR_EMPTY (sip_test_env)) {
|
||||||
|
@ -969,6 +969,7 @@ setup_nua (CallsSipOrigin *self)
|
||||||
urn_uuid = g_strdup_printf ("urn:uuid:%s", uuid);
|
urn_uuid = g_strdup_printf ("urn:uuid:%s", uuid);
|
||||||
|
|
||||||
self->protocol_prefix = get_protocol_prefix (self->transport_protocol);
|
self->protocol_prefix = get_protocol_prefix (self->transport_protocol);
|
||||||
|
protocol_lower = g_ascii_strdown (self->transport_protocol, -1);
|
||||||
|
|
||||||
self->address = g_strconcat (self->user, "@", self->host, NULL);
|
self->address = g_strconcat (self->user, "@", self->host, NULL);
|
||||||
from_str = g_strconcat (self->protocol_prefix, ":", self->address, NULL);
|
from_str = g_strconcat (self->protocol_prefix, ":", self->address, NULL);
|
||||||
|
@ -978,37 +979,24 @@ setup_nua (CallsSipOrigin *self)
|
||||||
use_sips = check_sips (from_str);
|
use_sips = check_sips (from_str);
|
||||||
use_ipv6 = check_ipv6 (self->host);
|
use_ipv6 = check_ipv6 (self->host);
|
||||||
|
|
||||||
if (self->local_port > 0) {
|
if (self->local_port > 0)
|
||||||
sip_url = g_strdup_printf ("sip:%s:%d",
|
url = g_strdup_printf ("%s:%s:%d;transport=%s",
|
||||||
use_ipv6 ? ipv6_bind : ipv4_bind,
|
self->protocol_prefix,
|
||||||
self->local_port);
|
use_ipv6 ? ipv6_bind : ipv4_bind,
|
||||||
sips_url = g_strdup_printf ("sips:%s:%d",
|
self->local_port,
|
||||||
use_ipv6 ? ipv6_bind : ipv4_bind,
|
protocol_lower);
|
||||||
self->local_port);
|
else
|
||||||
} else {
|
url = g_strdup_printf ("%s:%s:*;transport=%s",
|
||||||
sip_url = g_strdup_printf ("sip:%s:*",
|
self->protocol_prefix,
|
||||||
use_ipv6 ? ipv6_bind : ipv4_bind);
|
use_ipv6 ? ipv6_bind : ipv4_bind,
|
||||||
sips_url = g_strdup_printf ("sips:%s:*",
|
protocol_lower);
|
||||||
use_ipv6 ? ipv6_bind : ipv4_bind);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** For TLS nua_create() will error if NUTAG_URL includes ";transport=tls"
|
|
||||||
* In that case NUTAG_SIPS_URL should be used and NUTAG_URL should be as usual
|
|
||||||
* Since UDP is the default we only need to append the suffix in the TCP case
|
|
||||||
*/
|
|
||||||
if (g_ascii_strcasecmp (self->transport_protocol, "TCP") == 0) {
|
|
||||||
char *temp = sip_url;
|
|
||||||
|
|
||||||
sip_url = g_strdup_printf ("%s;transport=%s", temp, self->transport_protocol);
|
|
||||||
g_free (temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
nua = nua_create (self->ctx->root,
|
nua = nua_create (self->ctx->root,
|
||||||
sip_callback,
|
sip_callback,
|
||||||
self,
|
self,
|
||||||
NUTAG_USER_AGENT (APP_DATA_NAME),
|
NUTAG_USER_AGENT (APP_DATA_NAME),
|
||||||
TAG_IF (!use_sips, NUTAG_URL (sip_url)),
|
TAG_IF (!use_sips, NUTAG_URL (url)),
|
||||||
TAG_IF (use_sips, NUTAG_SIPS_URL (sips_url)),
|
TAG_IF (use_sips, NUTAG_SIPS_URL (url)),
|
||||||
SIPTAG_FROM_STR (from_str),
|
SIPTAG_FROM_STR (from_str),
|
||||||
NUTAG_ALLOW ("INVITE, ACK, BYE, CANCEL, OPTIONS, UPDATE"),
|
NUTAG_ALLOW ("INVITE, ACK, BYE, CANCEL, OPTIONS, UPDATE"),
|
||||||
NUTAG_SUPPORTED ("replaces, gruu, outbound"),
|
NUTAG_SUPPORTED ("replaces, gruu, outbound"),
|
||||||
|
|
Loading…
Reference in a new issue