diff options
author | Joshua Colp <jcolp@digium.com> | 2017-03-07 13:37:52 +0000 |
---|---|---|
committer | Richard Mudgett <rmudgett@digium.com> | 2017-03-08 14:38:40 -0600 |
commit | 2a85888262da036cecf2d767eb07e53205e1860e (patch) | |
tree | f9ef30607bae59ec05d67dd7e1d91872e11f373c /res/res_pjsip_outbound_registration.c | |
parent | a860bf63e15b6a7baf8067f34ea38bd4cbee128d (diff) |
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
Diffstat (limited to 'res/res_pjsip_outbound_registration.c')
-rw-r--r-- | res/res_pjsip_outbound_registration.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c index 7a0b60ac8..ee1894ffb 100644 --- a/res/res_pjsip_outbound_registration.c +++ b/res/res_pjsip_outbound_registration.c @@ -1087,7 +1087,7 @@ static int sip_dialog_create_contact(pj_pool_t *pool, pj_str_t *contact, const c 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; pj_strdup_with_null(pool, &tmp, target); @@ -1099,20 +1099,20 @@ static int sip_dialog_create_contact(pj_pool_t *pool, pj_str_t *contact, const c sip_uri = pjsip_uri_get_uri(uri); + 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 (pj_strchr(&sip_uri->host, ':')) { - type = (pjsip_transport_type_e)(((int)type) + PJSIP_TRANSPORT_IPV6); + type |= PJSIP_TRANSPORT_IPV6; } if (pjsip_tpmgr_find_local_addr(pjsip_endpt_get_tpmgr(ast_sip_get_pjsip_endpoint()), @@ -1121,7 +1121,7 @@ static int sip_dialog_create_contact(pj_pool_t *pool, pj_str_t *contact, const c } if (!pj_strchr(&sip_uri->host, ':') && pj_strchr(&local_addr, ':')) { - type = (pjsip_transport_type_e)(((int)type) + PJSIP_TRANSPORT_IPV6); + type |= PJSIP_TRANSPORT_IPV6; } contact->ptr = pj_pool_alloc(pool, PJSIP_MAX_URL_SIZE); |