diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 6e6ec1b5de..37b0922c7a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -2053,8 +2053,8 @@ const sipdns_tports[SIPDNS_TRANSPORTS] = { { "tcp", "5060", "_sip._tcp.", "SIP+D2T" }, { "sctp", "5060", "_sip._sctp.", "SIP+D2S" }, { "tls", "5061", "_sips._tcp.", "SIPS+D2T" }, - { "ws", "5066", "_sips._ws.", "SIP+D2W" }, - { "wss", "5067", "_sips._wss.", "SIPS+D2W" }, + { "ws", "5080", "_sips._ws.", "SIP+D2W" }, + { "wss", "5081", "_sips._wss.", "SIPS+D2W" }, }; static char const * const tports_sip[] = diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c index c63455fc91..8ff2684881 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_params.c @@ -1248,6 +1248,14 @@ int nua_handle_save_tags(nua_handle_t *nh, tagi_t *tags) else if (t->t_tag == nutag_sips_url) { url = (url_string_t *)t->t_value; } + /* NUTAG_WS_URL_REF(url) */ + else if (t->t_tag == nutag_ws_url) { + url = (url_string_t *)t->t_value; + } + /* NUTAG_WSS_URL_REF(url) */ + else if (t->t_tag == nutag_wss_url) { + url = (url_string_t *)t->t_value; + } } su_home_auto(tmphome, sizeof tmphome); @@ -1314,6 +1322,8 @@ static int nua_handle_param_filter(tagi_t const *f, tagi_t const *t) if (t->t_tag == nutag_url || t->t_tag == nutag_sips_url || + t->t_tag == nutag_ws_url || + t->t_tag == nutag_wss_url || t->t_tag == nutag_identity) return 0; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c index d71c910dca..c28389c0c3 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c @@ -1149,12 +1149,16 @@ int nua_stack_init_transport(nua_t *nua, tagi_t const *tags) { url_string_t const *contact1 = NULL, *contact2 = NULL; + url_string_t const *contact3 = NULL, *contact4 = NULL; char const *name1 = "sip", *name2 = "sip"; + char const *name3 = "sip", *name4 = "sip"; char const *certificate_dir = NULL; tl_gets(tags, NUTAG_URL_REF(contact1), NUTAG_SIPS_URL_REF(contact2), + NUTAG_WS_URL_REF(contact3), + NUTAG_WSS_URL_REF(contact4), NUTAG_CERTIFICATE_DIR_REF(certificate_dir), TAG_END()); @@ -1173,6 +1177,18 @@ nua_stack_init_transport(nua_t *nua, tagi_t const *tags) : contact2->us_url->url_type == url_sips)) name2 = "sips"; + if (contact3 && + (url_is_string(contact3) + ? su_casenmatch(contact3->us_str, "sips:", 5) + : contact3->us_url->url_type == url_sips)) + name3 = "sips"; + + if (contact4 && + (url_is_string(contact4) + ? su_casenmatch(contact4->us_str, "sips:", 5) + : contact4->us_url->url_type == url_sips)) + name4 = "sips"; + if (!contact1 /* && !contact2 */) { if (nta_agent_add_tport(nua->nua_nta, NULL, TPTAG_IDENT("sip"), @@ -1207,6 +1223,20 @@ nua_stack_init_transport(nua_t *nua, tagi_t const *tags) TPTAG_CERTIFICATE(certificate_dir), TAG_NEXT(nua->nua_args)) < 0) return -1; + + if (contact3 && + nta_agent_add_tport(nua->nua_nta, contact3, + TPTAG_IDENT(name3), + TPTAG_CERTIFICATE(certificate_dir), + TAG_NEXT(nua->nua_args)) < 0) + return -1; + + if (contact4 && + nta_agent_add_tport(nua->nua_nta, contact4, + TPTAG_IDENT(name4), + TPTAG_CERTIFICATE(certificate_dir), + TAG_NEXT(nua->nua_args)) < 0) + return -1; } diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c index 9e0c8d85ca..7670b93268 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_tag.c @@ -1621,6 +1621,55 @@ tag_typedef_t nutag_sips_url = URLTAG_TYPEDEF(sips_url); * Reference tag for NUTAG_SIPS_URL(). */ +/**@def NUTAG_WS_URL(x) + * + * Local WS url. + * + * The application can specify an alternative local address for + * NUA user agent engine. Usually the alternative address is a + * SIP URI (WS) used with websocket transport. + * + * @par Used with + * nua_create() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_WS_URL_REF(). + */ +tag_typedef_t nutag_ws_url = URLTAG_TYPEDEF(ws_url); + +/**@def NUTAG_WS_URL_REF(x) + * Reference tag for NUTAG_WS_URL(). + */ + + +/**@def NUTAG_WSS_URL(x) + * + * Local WSS url. + * + * The application can specify an alternative local address for + * NUA user agent engine. Usually the alternative address is a + * secure SIP URI (WSS) used with secure websocket transport. + * + * @par Used with + * nua_create() + * + * @par Parameter type + * char const * + * + * @par Values + * + * Corresponding tag taking reference parameter is NUTAG_WSS_URL_REF(). + */ +tag_typedef_t nutag_wss_url = URLTAG_TYPEDEF(wss_url); + +/**@def NUTAG_WSS_URL_REF(x) + * Reference tag for NUTAG_WSS_URL(). + */ + /**@def NUTAG_CERTIFICATE_DIR(x) * diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h b/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h index be909d6911..2c3a72ca04 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h +++ b/libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h @@ -286,6 +286,16 @@ SOFIAPUBVAR tag_typedef_t nutag_sips_url; #define NUTAG_SIPS_URL_REF(x) nutag_sips_url_ref, urltag_url_vr(&(x)) SOFIAPUBVAR tag_typedef_t nutag_sips_url_ref; +#define NUTAG_WS_URL(x) nutag_ws_url, urltag_url_v(x) +SOFIAPUBVAR tag_typedef_t nutag_ws_url; +#define NUTAG_WS_URL_REF(x) nutag_ws_url_ref, urltag_url_vr(&(x)) +SOFIAPUBVAR tag_typedef_t nutag_ws_url_ref; + +#define NUTAG_WSS_URL(x) nutag_wss_url, urltag_url_v(x) +SOFIAPUBVAR tag_typedef_t nutag_wss_url; +#define NUTAG_WSS_URL_REF(x) nutag_wss_url_ref, urltag_url_vr(&(x)) +SOFIAPUBVAR tag_typedef_t nutag_wss_url_ref; + #define NUTAG_PROXY(x) NTATAG_DEFAULT_PROXY(x) #define NUTAG_PROXY_REF(x) NTATAG_DEFAULT_PROXY_REF(x) #define nutag_proxy ntatag_default_proxy