<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6501">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Filter out non SIP(S) requests<br><br>Incoming requests with non sip(s) URIs in the Request, To, From<br>or Contact URIs are now rejected with<br>PJSIP_SC_UNSUPPORTED_URI_SCHEME (416). This is performed in<br>pjsip_message_filter (formerly pjsip_message_ip_updater) and is<br>done at pjproject's "TRANSPORT" layer before a request can even<br>reach the distributor.<br><br>URIs read by res_pjsip_outbound_publish from pjsip.conf are now<br>also checked for both length and sip(s) scheme. Those URIs read<br>by outbound registration and aor were already being checked for<br>scheme but their error messages needed to be updated to include<br>scheme failure as well as length failure.<br><br>Change-Id: Ibb2f9f1d2dc7549da562af4cbd9156c44ffdd460<br>---<br>M configs/samples/pjsip.conf.sample<br>M res/res_pjsip.c<br>M res/res_pjsip/include/res_pjsip_private.h<br>M res/res_pjsip/location.c<br>R res/res_pjsip/pjsip_message_filter.c<br>M res/res_pjsip_outbound_publish.c<br>M res/res_pjsip_outbound_registration.c<br>7 files changed, 204 insertions(+), 78 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample<br>index f983a87..a93e56d 100644<br>--- a/configs/samples/pjsip.conf.sample<br>+++ b/configs/samples/pjsip.conf.sample<br>@@ -1117,7 +1117,7 @@<br> <br> <br> ; MODULE PROVIDING BELOW SECTION(S): res_pjsip_outbound_publish<br>-;======================OUTBOUND_PUBLISHEN SECTION OPTIONS=====================<br>+;======================OUTBOUND_PUBLISH SECTION OPTIONS=====================<br> ; See https://wiki.asterisk.org/wiki/display/AST/Publishing+Extension+State<br> ; for more information.<br> ;[outbound-publish]<br>diff --git a/res/res_pjsip.c b/res/res_pjsip.c<br>index 2db0668..c8bde56 100644<br>--- a/res/res_pjsip.c<br>+++ b/res/res_pjsip.c<br>@@ -4581,7 +4581,7 @@<br> if (ast_pjsip_endpoint && serializer_pool[0]) {<br> ast_res_pjsip_cleanup_options_handling();<br> internal_sip_destroy_outbound_authentication();<br>- ast_res_pjsip_cleanup_message_ip_updater();<br>+ ast_res_pjsip_cleanup_message_filter();<br> ast_sip_destroy_distributor();<br> ast_res_pjsip_destroy_configuration();<br> ast_sip_destroy_system();<br>@@ -4762,7 +4762,7 @@<br> <br> ast_res_pjsip_init_options_handling(0);<br> <br>- if (ast_res_pjsip_init_message_ip_updater()) {<br>+ if (ast_res_pjsip_init_message_filter()) {<br> ast_log(LOG_ERROR, "Failed to initialize message IP updating. Aborting load\n");<br> goto error;<br> }<br>diff --git a/res/res_pjsip/include/res_pjsip_private.h b/res/res_pjsip/include/res_pjsip_private.h<br>index 5766325..2f3100a 100644<br>--- a/res/res_pjsip/include/res_pjsip_private.h<br>+++ b/res/res_pjsip/include/res_pjsip_private.h<br>@@ -212,7 +212,7 @@<br> * \retval 0 on success<br> * \retval other on failure<br> */<br>-int ast_res_pjsip_init_message_ip_updater(void);<br>+int ast_res_pjsip_init_message_filter(void);<br> <br> /*!<br> * \internal<br>@@ -281,7 +281,7 @@<br> * \internal<br> * \brief Clean up res_pjsip message ip updating handling<br> */<br>-void ast_res_pjsip_cleanup_message_ip_updater(void);<br>+void ast_res_pjsip_cleanup_message_filter(void);<br> <br> /*!<br> * \internal<br>diff --git a/res/res_pjsip/location.c b/res/res_pjsip/location.c<br>index ddde5c4..66fc85c 100644<br>--- a/res/res_pjsip/location.c<br>+++ b/res/res_pjsip/location.c<br>@@ -620,7 +620,7 @@<br> }<br> <br> if (ast_sip_validate_uri_length(contact_uri)) {<br>- ast_log(LOG_ERROR, "Contact uri or hostname length exceeds pjproject limit: %s\n", contact_uri);<br>+ ast_log(LOG_ERROR, "Contact uri or hostname length exceeds pjproject limit or is not a sip(s) uri: %s\n", contact_uri);<br> return -1;<br> }<br> <br>diff --git a/res/res_pjsip/pjsip_message_ip_updater.c b/res/res_pjsip/pjsip_message_filter.c<br>similarity index 60%<br>rename from res/res_pjsip/pjsip_message_ip_updater.c<br>rename to res/res_pjsip/pjsip_message_filter.c<br>index 099ecaa..63b8bd5 100644<br>--- a/res/res_pjsip/pjsip_message_ip_updater.c<br>+++ b/res/res_pjsip/pjsip_message_filter.c<br>@@ -27,72 +27,72 @@<br> <br> #define MOD_DATA_RESTRICTIONS "restrictions"<br> <br>-static pj_status_t multihomed_on_tx_message(pjsip_tx_data *tdata);<br>-static pj_bool_t multihomed_on_rx_message(pjsip_rx_data *rdata);<br>+static pj_status_t filter_on_tx_message(pjsip_tx_data *tdata);<br>+static pj_bool_t filter_on_rx_message(pjsip_rx_data *rdata);<br> <br> /*! \brief Outgoing message modification restrictions */<br>-struct multihomed_message_restrictions {<br>+struct filter_message_restrictions {<br> /*! \brief Disallow modification of the From domain */<br> unsigned int disallow_from_domain_modification;<br> };<br> <br>-static pjsip_module multihomed_module = {<br>- .name = { "Multihomed Routing", 18 },<br>+static pjsip_module filter_module = {<br>+ .name = { "Message Filtering", 17 },<br> .id = -1,<br>- .priority = PJSIP_MOD_PRIORITY_TSX_LAYER - 1,<br>- .on_tx_request = multihomed_on_tx_message,<br>- .on_tx_response = multihomed_on_tx_message,<br>- .on_rx_request = multihomed_on_rx_message,<br>+ .priority = PJSIP_MOD_PRIORITY_TRANSPORT_LAYER,<br>+ .on_tx_request = filter_on_tx_message,<br>+ .on_tx_response = filter_on_tx_message,<br>+ .on_rx_request = filter_on_rx_message,<br> };<br> <br> /*! \brief Helper function to get (or allocate if not already present) restrictions on a message */<br>-static struct multihomed_message_restrictions *multihomed_get_restrictions(pjsip_tx_data *tdata)<br>+static struct filter_message_restrictions *get_restrictions(pjsip_tx_data *tdata)<br> {<br>- struct multihomed_message_restrictions *restrictions;<br>+ struct filter_message_restrictions *restrictions;<br> <br>- restrictions = ast_sip_mod_data_get(tdata->mod_data, multihomed_module.id, MOD_DATA_RESTRICTIONS);<br>+ restrictions = ast_sip_mod_data_get(tdata->mod_data, filter_module.id, MOD_DATA_RESTRICTIONS);<br> if (restrictions) {<br> return restrictions;<br> }<br> <br>- restrictions = PJ_POOL_ALLOC_T(tdata->pool, struct multihomed_message_restrictions);<br>- ast_sip_mod_data_set(tdata->pool, tdata->mod_data, multihomed_module.id, MOD_DATA_RESTRICTIONS, restrictions);<br>+ restrictions = PJ_POOL_ALLOC_T(tdata->pool, struct filter_message_restrictions);<br>+ ast_sip_mod_data_set(tdata->pool, tdata->mod_data, filter_module.id, MOD_DATA_RESTRICTIONS, restrictions);<br> <br> return restrictions;<br> }<br> <br> /*! \brief Callback invoked on non-session outgoing messages */<br>-static void multihomed_outgoing_message(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, struct pjsip_tx_data *tdata)<br>+static void filter_outgoing_message(struct ast_sip_endpoint *endpoint, struct ast_sip_contact *contact, struct pjsip_tx_data *tdata)<br> {<br>- struct multihomed_message_restrictions *restrictions = multihomed_get_restrictions(tdata);<br>+ struct filter_message_restrictions *restrictions = get_restrictions(tdata);<br> <br> restrictions->disallow_from_domain_modification = !ast_strlen_zero(endpoint->fromdomain);<br> }<br> <br> /*! \brief PJSIP Supplement for tagging messages with restrictions */<br>-static struct ast_sip_supplement multihomed_supplement = {<br>+static struct ast_sip_supplement filter_supplement = {<br> .priority = AST_SIP_SUPPLEMENT_PRIORITY_FIRST,<br>- .outgoing_request = multihomed_outgoing_message,<br>- .outgoing_response = multihomed_outgoing_message,<br>+ .outgoing_request = filter_outgoing_message,<br>+ .outgoing_response = filter_outgoing_message,<br> };<br> <br> /*! \brief Callback invoked on session outgoing messages */<br>-static void multihomed_session_outgoing_message(struct ast_sip_session *session, struct pjsip_tx_data *tdata)<br>+static void filter_session_outgoing_message(struct ast_sip_session *session, struct pjsip_tx_data *tdata)<br> {<br>- struct multihomed_message_restrictions *restrictions = multihomed_get_restrictions(tdata);<br>+ struct filter_message_restrictions *restrictions = get_restrictions(tdata);<br> <br> restrictions->disallow_from_domain_modification = !ast_strlen_zero(session->endpoint->fromdomain);<br> }<br> <br> /*! \brief PJSIP Session Supplement for tagging messages with restrictions */<br>-static struct ast_sip_session_supplement multihomed_session_supplement = {<br>+static struct ast_sip_session_supplement filter_session_supplement = {<br> .priority = 1,<br>- .outgoing_request = multihomed_session_outgoing_message,<br>- .outgoing_response = multihomed_session_outgoing_message,<br>+ .outgoing_request = filter_session_outgoing_message,<br>+ .outgoing_response = filter_session_outgoing_message,<br> };<br> <br> /*! \brief Helper function which returns a UDP transport bound to the given address and port */<br>-static pjsip_transport *multihomed_get_udp_transport(pj_str_t *address, int port)<br>+static pjsip_transport *get_udp_transport(pj_str_t *address, int port)<br> {<br> struct ao2_container *transport_states = ast_sip_get_transport_states();<br> struct ast_sip_transport_state *transport_state;<br>@@ -121,7 +121,7 @@<br> }<br> <br> /*! \brief Helper function which determines if a transport is bound to any */<br>-static int multihomed_bound_any(pjsip_transport *transport)<br>+static int is_bound_any(pjsip_transport *transport)<br> {<br> pj_uint32_t loop6[4] = {0, 0, 0, 0};<br> <br>@@ -156,6 +156,19 @@<br> #define is_sip_uri(uri) \<br> (PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri))<br> <br>+static void print_sanitize_debug(char *msg, pjsip_uri_context_e context, pjsip_sip_uri *uri)<br>+{<br>+#ifdef AST_DEVMODE<br>+ char hdrbuf[512];<br>+ int hdrbuf_len;<br>+<br>+ hdrbuf_len = pjsip_uri_print(context, uri, hdrbuf, 512);<br>+ hdrbuf[hdrbuf_len] = '\0';<br>+ ast_debug(2, "%s: %s\n", msg, hdrbuf);<br>+#endif<br>+}<br>+<br>+/* If in DEVMODE, prevent inlining to assist in debugging */<br> #ifdef AST_DEVMODE<br> #define FUNC_ATTRS __attribute__ ((noinline))<br> #else<br>@@ -167,21 +180,12 @@<br> static const pj_str_t x_name = { AST_SIP_X_AST_TXP, AST_SIP_X_AST_TXP_LEN };<br> pjsip_param *x_transport;<br> pjsip_sip_uri *uri;<br>- pjsip_fromto_hdr *fromto;<br>- pjsip_contact_hdr *contact;<br> pjsip_hdr *hdr;<br>-#ifdef AST_DEVMODE<br>- char hdrbuf[512];<br>- int hdrbuf_len;<br>-#endif<br> <br> if (tdata->msg->type == PJSIP_REQUEST_MSG) {<br> if (is_sip_uri(tdata->msg->line.req.uri)) {<br> uri = pjsip_uri_get_uri(tdata->msg->line.req.uri);<br>-#ifdef AST_DEVMODE<br>- hdrbuf_len = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, uri, hdrbuf, 512);<br>- ast_debug(2, "Sanitizing Request: %s\n", hdrbuf);<br>-#endif<br>+ print_sanitize_debug("Sanitizing Request", PJSIP_URI_IN_REQ_URI, uri);<br> while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {<br> pj_list_erase(x_transport);<br> }<br>@@ -190,27 +194,17 @@<br> <br> for (hdr = tdata->msg->hdr.next; hdr != &tdata->msg->hdr; hdr = hdr->next) {<br> if (hdr->type == PJSIP_H_TO || hdr->type == PJSIP_H_FROM) {<br>- fromto = (pjsip_fromto_hdr *) hdr;<br>- if (is_sip_uri(fromto->uri)) {<br>- uri = pjsip_uri_get_uri(fromto->uri);<br>-#ifdef AST_DEVMODE<br>- hdrbuf_len = pjsip_uri_print(PJSIP_URI_IN_FROMTO_HDR, uri, hdrbuf, 512);<br>- hdrbuf[hdrbuf_len] = '\0';<br>- ast_debug(2, "Sanitizing From/To: %s\n", hdrbuf);<br>-#endif<br>+ if (is_sip_uri(((pjsip_fromto_hdr *) hdr)->uri)) {<br>+ uri = pjsip_uri_get_uri(((pjsip_fromto_hdr *) hdr)->uri);<br>+ print_sanitize_debug("Sanitizing From/To header", PJSIP_URI_IN_FROMTO_HDR, uri);<br> while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {<br> pj_list_erase(x_transport);<br> }<br> }<br> } else if (hdr->type == PJSIP_H_CONTACT) {<br>- contact = (pjsip_contact_hdr *) hdr;<br>- if (is_sip_uri(contact->uri)) {<br>- uri = pjsip_uri_get_uri(contact->uri);<br>-#ifdef AST_DEVMODE<br>- hdrbuf_len = pjsip_uri_print(PJSIP_URI_IN_CONTACT_HDR, uri, hdrbuf, 512);<br>- hdrbuf[hdrbuf_len] = '\0';<br>- ast_debug(2, "Sanitizing Contact: %s\n", hdrbuf);<br>-#endif<br>+ if (!((pjsip_contact_hdr *) hdr)->star && is_sip_uri(((pjsip_contact_hdr *) hdr)->uri)) {<br>+ uri = pjsip_uri_get_uri(((pjsip_contact_hdr *) hdr)->uri);<br>+ print_sanitize_debug("Sanitizing Contact header", PJSIP_URI_IN_CONTACT_HDR, uri);<br> while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {<br> pj_list_erase(x_transport);<br> }<br>@@ -221,9 +215,9 @@<br> pjsip_tx_data_invalidate_msg(tdata);<br> }<br> <br>-static pj_status_t multihomed_on_tx_message(pjsip_tx_data *tdata)<br>+static pj_status_t filter_on_tx_message(pjsip_tx_data *tdata)<br> {<br>- struct multihomed_message_restrictions *restrictions = ast_sip_mod_data_get(tdata->mod_data, multihomed_module.id, MOD_DATA_RESTRICTIONS);<br>+ struct filter_message_restrictions *restrictions = ast_sip_mod_data_get(tdata->mod_data, filter_module.id, MOD_DATA_RESTRICTIONS);<br> pjsip_tpmgr_fla2_param prm;<br> pjsip_cseq_hdr *cseq;<br> pjsip_via_hdr *via;<br>@@ -256,7 +250,7 @@<br> tdata->tp_info.transport->key.type == PJSIP_TRANSPORT_UDP6) {<br> pjsip_transport *transport;<br> <br>- transport = multihomed_get_udp_transport(&prm.ret_addr, prm.ret_port);<br>+ transport = get_udp_transport(&prm.ret_addr, prm.ret_port);<br> <br> if (transport) {<br> tdata->tp_info.transport = transport;<br>@@ -264,7 +258,7 @@<br> }<br> <br> /* If the chosen transport is not bound to any we can't use the source address as it won't get back to us */<br>- if (!multihomed_bound_any(tdata->tp_info.transport)) {<br>+ if (!is_bound_any(tdata->tp_info.transport)) {<br> pj_strassign(&prm.ret_addr, &tdata->tp_info.transport->local_name.host);<br> }<br> } else {<br>@@ -345,7 +339,104 @@<br> return PJ_SUCCESS;<br> }<br> <br>-static pj_bool_t multihomed_on_rx_message(pjsip_rx_data *rdata)<br>+enum uri_type {<br>+ URI_TYPE_REQUEST = -1,<br>+ URI_TYPE_TO = PJSIP_H_TO,<br>+ URI_TYPE_FROM = PJSIP_H_FROM,<br>+ URI_TYPE_CONTACT = PJSIP_H_CONTACT,<br>+};<br>+<br>+static void print_uri_debug(enum uri_type ut, pjsip_rx_data *rdata, pjsip_hdr *hdr)<br>+{<br>+#ifdef AST_DEVMODE<br>+ pjsip_uri *local_uri = NULL;<br>+ char hdrbuf[512];<br>+ int hdrbuf_len;<br>+ char *request_uri;<br>+ pjsip_uri_context_e context = PJSIP_URI_IN_OTHER;<br>+ char header_name[32];<br>+<br>+ switch (ut) {<br>+ case(URI_TYPE_REQUEST):<br>+ context = PJSIP_URI_IN_REQ_URI;<br>+ strcpy(header_name, "Request"); /* Safe */<br>+ local_uri = rdata->msg_info.msg->line.req.uri;<br>+ break;<br>+ case(PJSIP_H_FROM):<br>+ strcpy(header_name, "From"); /* Safe */<br>+ context = PJSIP_URI_IN_FROMTO_HDR;<br>+ local_uri = pjsip_uri_get_uri(((pjsip_from_hdr *)hdr)->uri);<br>+ break;<br>+ case(PJSIP_H_TO):<br>+ strcpy(header_name, "To"); /* Safe */<br>+ context = PJSIP_URI_IN_FROMTO_HDR;<br>+ local_uri = pjsip_uri_get_uri(((pjsip_to_hdr *)hdr)->uri);<br>+ break;<br>+ case(PJSIP_H_CONTACT):<br>+ strcpy(header_name, "Contact"); /* Safe */<br>+ context = PJSIP_URI_IN_CONTACT_HDR;<br>+ local_uri = pjsip_uri_get_uri(((pjsip_contact_hdr *)hdr)->uri);<br>+ break;<br>+ }<br>+<br>+ hdrbuf_len = pjsip_uri_print(PJSIP_URI_IN_REQ_URI, rdata->msg_info.msg->line.req.uri, hdrbuf, 512);<br>+ hdrbuf[hdrbuf_len] = '\0';<br>+ request_uri = ast_strdupa(hdrbuf);<br>+ hdrbuf_len = pjsip_uri_print(context, local_uri, hdrbuf, 512);<br>+ hdrbuf[hdrbuf_len] = '\0';<br>+<br>+ ast_debug(2, "There was a non sip(s) URI scheme in %s URI '%s' for request '%*.*s %s'\n",<br>+ header_name, hdrbuf,<br>+ (int)rdata->msg_info.msg->line.req.method.name.slen,<br>+ (int)rdata->msg_info.msg->line.req.method.name.slen,<br>+ rdata->msg_info.msg->line.req.method.name.ptr, request_uri);<br>+#endif<br>+}<br>+<br>+static pj_bool_t on_rx_process_uris(pjsip_rx_data *rdata)<br>+{<br>+ pjsip_contact_hdr *contact = NULL;<br>+<br>+ if (rdata->msg_info.msg->type != PJSIP_REQUEST_MSG) {<br>+ return PJ_FALSE;<br>+ }<br>+<br>+ if (!is_sip_uri(rdata->msg_info.msg->line.req.uri)) {<br>+ print_uri_debug(URI_TYPE_REQUEST, rdata, NULL);<br>+ pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,<br>+ PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);<br>+ return PJ_TRUE;<br>+ }<br>+<br>+ if (!is_sip_uri(rdata->msg_info.from->uri)) {<br>+ print_uri_debug(URI_TYPE_FROM, rdata, (pjsip_hdr *)rdata->msg_info.from);<br>+ pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,<br>+ PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);<br>+ return PJ_TRUE;<br>+ }<br>+<br>+ if (!is_sip_uri(rdata->msg_info.to->uri)) {<br>+ print_uri_debug(URI_TYPE_TO, rdata, (pjsip_hdr *)rdata->msg_info.to);<br>+ pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,<br>+ PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);<br>+ return PJ_TRUE;<br>+ }<br>+<br>+ while ((contact =<br>+ (pjsip_contact_hdr *) pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_CONTACT,<br>+ contact ? contact->next : NULL))) {<br>+ if (!contact->star && !is_sip_uri(contact->uri)) {<br>+ print_uri_debug(URI_TYPE_CONTACT, rdata, (pjsip_hdr *)contact);<br>+ pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,<br>+ PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);<br>+ return PJ_TRUE;<br>+ }<br>+ }<br>+<br>+ return PJ_FALSE;<br>+}<br>+<br>+static pj_bool_t on_rx_process_symmetric_transport(pjsip_rx_data *rdata)<br> {<br> pjsip_contact_hdr *contact;<br> pjsip_sip_uri *uri;<br>@@ -388,29 +479,46 @@<br> return PJ_FALSE;<br> }<br> <br>-void ast_res_pjsip_cleanup_message_ip_updater(void)<br>+static pj_bool_t filter_on_rx_message(pjsip_rx_data *rdata)<br> {<br>- ast_sip_unregister_service(&multihomed_module);<br>- ast_sip_unregister_supplement(&multihomed_supplement);<br>- ast_sip_session_unregister_supplement(&multihomed_session_supplement);<br>+ pj_bool_t rc;<br>+<br>+ rc = on_rx_process_uris(rdata);<br>+ if (rc == PJ_TRUE) {<br>+ return rc;<br>+ }<br>+<br>+ rc = on_rx_process_symmetric_transport(rdata);<br>+ if (rc == PJ_TRUE) {<br>+ return rc;<br>+ }<br>+<br>+ return PJ_FALSE;<br> }<br> <br>-int ast_res_pjsip_init_message_ip_updater(void)<br>+void ast_res_pjsip_cleanup_message_filter(void)<br> {<br>- if (ast_sip_session_register_supplement(&multihomed_session_supplement)) {<br>- ast_log(LOG_ERROR, "Could not register multihomed session supplement for outgoing requests\n");<br>+ ast_sip_unregister_service(&filter_module);<br>+ ast_sip_unregister_supplement(&filter_supplement);<br>+ ast_sip_session_unregister_supplement(&filter_session_supplement);<br>+}<br>+<br>+int ast_res_pjsip_init_message_filter(void)<br>+{<br>+ if (ast_sip_session_register_supplement(&filter_session_supplement)) {<br>+ ast_log(LOG_ERROR, "Could not register message filter session supplement for outgoing requests\n");<br> return -1;<br> }<br> <br>- if (ast_sip_register_supplement(&multihomed_supplement)) {<br>- ast_log(LOG_ERROR, "Could not register multihomed supplement for outgoing requests\n");<br>- ast_res_pjsip_cleanup_message_ip_updater();<br>+ if (ast_sip_register_supplement(&filter_supplement)) {<br>+ ast_log(LOG_ERROR, "Could not register message filter supplement for outgoing requests\n");<br>+ ast_res_pjsip_cleanup_message_filter();<br> return -1;<br> }<br> <br>- if (ast_sip_register_service(&multihomed_module)) {<br>- ast_log(LOG_ERROR, "Could not register multihomed module for incoming and outgoing requests\n");<br>- ast_res_pjsip_cleanup_message_ip_updater();<br>+ if (ast_sip_register_service(&filter_module)) {<br>+ ast_log(LOG_ERROR, "Could not register message filter module for incoming and outgoing requests\n");<br>+ ast_res_pjsip_cleanup_message_filter();<br> return -1;<br> }<br> <br>diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c<br>index f84f118..a9f9233 100644<br>--- a/res/res_pjsip_outbound_publish.c<br>+++ b/res/res_pjsip_outbound_publish.c<br>@@ -33,6 +33,7 @@<br> #include "asterisk/taskprocessor.h"<br> #include "asterisk/threadpool.h"<br> #include "asterisk/datastore.h"<br>+#include "res_pjsip/include/res_pjsip_private.h"<br> <br> /*** DOCUMENTATION<br> <configInfo name="res_pjsip_outbound_publish" language="en_US"><br>@@ -1115,10 +1116,27 @@<br> ast_log(LOG_ERROR, "No server URI specified on outbound publish '%s'\n",<br> ast_sorcery_object_get_id(publish));<br> return -1;<br>+ } else if (ast_sip_validate_uri_length(publish->server_uri)) {<br>+ ast_log(LOG_ERROR, "Server URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s' on outbound publish '%s'\n",<br>+ publish->server_uri,<br>+ ast_sorcery_object_get_id(publish));<br>+ return -1;<br> } else if (ast_strlen_zero(publish->event)) {<br> ast_log(LOG_ERROR, "No event type specified for outbound publish '%s'\n",<br> ast_sorcery_object_get_id(publish));<br> return -1;<br>+ } else if (!ast_strlen_zero(publish->from_uri)<br>+ && ast_sip_validate_uri_length(publish->from_uri)) {<br>+ ast_log(LOG_ERROR, "From URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s' on outbound publish '%s'\n",<br>+ publish->from_uri,<br>+ ast_sorcery_object_get_id(publish));<br>+ return -1;<br>+ } else if (!ast_strlen_zero(publish->to_uri)<br>+ && ast_sip_validate_uri_length(publish->to_uri)) {<br>+ ast_log(LOG_ERROR, "To URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s' on outbound publish '%s'\n",<br>+ publish->to_uri,<br>+ ast_sorcery_object_get_id(publish));<br>+ return -1;<br> }<br> return 0;<br> }<br>diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c<br>index 76d756d..0fed59f 100644<br>--- a/res/res_pjsip_outbound_registration.c<br>+++ b/res/res_pjsip_outbound_registration.c<br>@@ -1429,7 +1429,7 @@<br> ast_sorcery_object_get_id(applied));<br> return -1;<br> } else if (ast_sip_validate_uri_length(applied->server_uri)) {<br>- ast_log(LOG_ERROR, "Server URI or hostname length exceeds pjpropject limit '%s'\n",<br>+ ast_log(LOG_ERROR, "Server URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s'\n",<br> ast_sorcery_object_get_id(applied));<br> return -1;<br> } else if (ast_strlen_zero(applied->client_uri)) {<br>@@ -1437,7 +1437,7 @@<br> ast_sorcery_object_get_id(applied));<br> return -1;<br> } else if (ast_sip_validate_uri_length(applied->client_uri)) {<br>- ast_log(LOG_ERROR, "Client URI or hostname length exceeds pjpropject limit '%s'\n",<br>+ ast_log(LOG_ERROR, "Client URI or hostname length exceeds pjproject limit or is not a sip(s) uri: '%s'\n",<br> ast_sorcery_object_get_id(applied));<br> return -1;<br> } else if (applied->line && ast_strlen_zero(applied->endpoint)) {<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6501">change 6501</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6501"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ibb2f9f1d2dc7549da562af4cbd9156c44ffdd460 </div>
<div style="display:none"> Gerrit-Change-Number: 6501 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>