diff options
author | Sebastian Damm <damm@sipgate.de> | 2016-05-10 17:19:48 +0200 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2016-05-12 05:34:12 -0500 |
commit | d14d1ba826f8ac7f340fd67df41ed2c5dcd17539 (patch) | |
tree | 127fe8368aa7af53992cbbd99941417558ce7069 /res/res_pjsip_outbound_registration.c | |
parent | b4e10e7c901997ae2ee95fc819552cb557ecdbf1 (diff) |
res_pjsip_outbound_registration: generate correct Contact URI for TLS
There are two types of SIP URIs indicating a secure transport:
* sips:user@example.org
* sip:user@example.org;transport=tls
When using a sips URI, Asterisk checks incoming INVITEs and answers from
the other side for sips URIs, and rejects the packet if there are only
sip URIs. So Asterisk should only generate a sips Contact URI if the
other side supports it.
This patch makes Asterisk generate either a sip or sips Contact URI
depending on the format of the server URI.
If you want a sip URI, use:
server_uri=sip:example.org\;transport=tls
If you want a sips URI, use:
server_uri=sips:example.org
ASTERISK-25990 #close
Reported-by: Sebastian Damm
Change-Id: I5ae57d6531ce940b5fc64d5cd2673e60db0f9ba2
Diffstat (limited to 'res/res_pjsip_outbound_registration.c')
-rw-r--r-- | res/res_pjsip_outbound_registration.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index f85996ed5..815432d10 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -1096,7 +1096,7 @@ static int sip_dialog_create_contact(pj_pool_t *pool, pj_str_t *contact, const c contact->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); contact->slen = pj_ansi_snprintf(contact->ptr, PJSIP_MAX_URL_SIZE, "<%s:%s@%s%.*s%s:%d%s%s%s%s>", - (pjsip_transport_get_flag_from_type(type) & PJSIP_TRANSPORT_SECURE) ? "sips" : "sip", + ((pjsip_transport_get_flag_from_type(type) & PJSIP_TRANSPORT_SECURE) && PJSIP_URI_SCHEME_IS_SIPS(uri)) ? "sips" : "sip", user, (type & PJSIP_TRANSPORT_IPV6) ? "[" : "", (int)local_addr.slen, |