res_pjsip_transport_websocket: Add support for IPv6.

This change adds a PJSIP patch (which has been contributed upstream)
to allow the registration of IPv6 transport types.

Using this the res_pjsip_transport_websocket module now registers
an IPv6 Websocket transport and uses it for the corresponding
traffic.

ASTERISK-26685

Change-Id: Id1f9126f995b31dc38db8fdb58afd289b4ad1647
This commit is contained in:
Joshua Colp
2017-03-07 13:37:52 +00:00
committed by Richard Mudgett
parent ff0569740a
commit 4e3b0cedba
4 changed files with 100 additions and 32 deletions

View File

@@ -2757,7 +2757,7 @@ static int sip_dialog_create_from(pj_pool_t *pool, pj_str_t *from, const char *u
pj_str_t tmp, local_addr;
pjsip_uri *uri;
pjsip_sip_uri *sip_uri;
pjsip_transport_type_e type = PJSIP_TRANSPORT_UNSPECIFIED;
pjsip_transport_type_e type;
int local_port;
char default_user[PJSIP_MAX_URL_SIZE];
@@ -2777,21 +2777,21 @@ static int sip_dialog_create_from(pj_pool_t *pool, pj_str_t *from, const char *u
sip_uri = pjsip_uri_get_uri(uri);
/* Determine the transport type to use */
type = pjsip_transport_get_type_from_name(&sip_uri->transport_param);
if (PJSIP_URI_SCHEME_IS_SIPS(sip_uri)) {
type = PJSIP_TRANSPORT_TLS;
if (type == PJSIP_TRANSPORT_UNSPECIFIED
|| !(pjsip_transport_get_flag_from_type(type) & PJSIP_TRANSPORT_SECURE)) {
type = PJSIP_TRANSPORT_TLS;
}
} else if (!sip_uri->transport_param.slen) {
type = PJSIP_TRANSPORT_UDP;
} else {
type = pjsip_transport_get_type_from_name(&sip_uri->transport_param);
}
if (type == PJSIP_TRANSPORT_UNSPECIFIED) {
} else if (type == PJSIP_TRANSPORT_UNSPECIFIED) {
return -1;
}
/* If the host is IPv6 turn the transport into an IPv6 version */
if (pj_strchr(&sip_uri->host, ':') && type < PJSIP_TRANSPORT_START_OTHER) {
type = (pjsip_transport_type_e)(((int)type) + PJSIP_TRANSPORT_IPV6);
if (pj_strchr(&sip_uri->host, ':')) {
type |= PJSIP_TRANSPORT_IPV6;
}
if (!ast_strlen_zero(domain)) {
@@ -2815,8 +2815,8 @@ static int sip_dialog_create_from(pj_pool_t *pool, pj_str_t *from, const char *u
}
/* If IPv6 was specified in the transport, set the proper type */
if (pj_strchr(&local_addr, ':') && type < PJSIP_TRANSPORT_START_OTHER) {
type = (pjsip_transport_type_e)(((int)type) + PJSIP_TRANSPORT_IPV6);
if (pj_strchr(&local_addr, ':')) {
type |= PJSIP_TRANSPORT_IPV6;
}
from->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE);