<p>Benjamin Keith Ford has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/19236">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip: Add TEL URI support for basic calls.<br><br>This change allows TEL URI requests to come through for basic calls. The<br>allowed requests are INVITE, ACK, BYE, and CANCEL. The From and To<br>headers will now allow TEL URIs, as well as the request URI.<br><br>Support is only for TEL URIs present in traffic from a remote party.<br>Asterisk does not generate any TEL URIs on its own.<br><br>ASTERISK-26894<br><br>Change-Id: If5729e6cd583be7acf666373bf9f1b9d653ec29a<br>---<br>M channels/chan_pjsip.c<br>M configs/samples/pjsip.conf.sample<br>M include/asterisk/res_pjsip.h<br>M res/res_pjsip.c<br>M res/res_pjsip/pjsip_distributor.c<br>M res/res_pjsip/pjsip_message_filter.c<br>M res/res_pjsip/pjsip_options.c<br>M res/res_pjsip_caller_id.c<br>M res/res_pjsip_dialog_info_body_generator.c<br>M res/res_pjsip_diversion.c<br>M res/res_pjsip_endpoint_identifier_anonymous.c<br>M res/res_pjsip_endpoint_identifier_user.c<br>M res/res_pjsip_messaging.c<br>M res/res_pjsip_nat.c<br>M res/res_pjsip_outbound_registration.c<br>M res/res_pjsip_path.c<br>M res/res_pjsip_pubsub.c<br>M res/res_pjsip_session.c<br>18 files changed, 238 insertions(+), 73 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/36/19236/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c</span><br><span>index 07b9088..3e8abd2 100644</span><br><span>--- a/channels/chan_pjsip.c</span><br><span>+++ b/channels/chan_pjsip.c</span><br><span>@@ -3009,11 +3009,11 @@</span><br><span> </span><br><span> static void set_sipdomain_variable(struct ast_sip_session *session)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-       pjsip_sip_uri *sip_ruri = pjsip_uri_get_uri(session->request_uri);</span><br><span style="color: hsl(0, 100%, 40%);">-   size_t size = pj_strlen(&sip_ruri->host) + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+  const pj_str_t *host = ast_sip_pjsip_uri_get_hostname(session->request_uri);</span><br><span style="color: hsl(120, 100%, 40%);">+       size_t size = pj_strlen(host) + 1;</span><br><span>   char *domain = ast_alloca(size);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    ast_copy_pj_str(domain, &sip_ruri->host, size);</span><br><span style="color: hsl(120, 100%, 40%);">+        ast_copy_pj_str(domain, host, size);</span><br><span> </span><br><span>     pbx_builtin_setvar_helper(session->channel, "SIPDOMAIN", domain);</span><br><span>       return;</span><br><span>diff --git a/configs/samples/pjsip.conf.sample b/configs/samples/pjsip.conf.sample</span><br><span>index bf9f78c..6fbdb8b 100644</span><br><span>--- a/configs/samples/pjsip.conf.sample</span><br><span>+++ b/configs/samples/pjsip.conf.sample</span><br><span>@@ -1587,3 +1587,16 @@</span><br><span> </span><br><span> ;mailbox_state_filter=     ; Optional regular expression used to filter what</span><br><span>                            ; mailboxes we accept events for.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+;================================TEL URIs=====================================</span><br><span style="color: hsl(120, 100%, 40%);">+;</span><br><span style="color: hsl(120, 100%, 40%);">+; Asterisk has TEL URI support, but with limited scope. Support is only for</span><br><span style="color: hsl(120, 100%, 40%);">+; TEL URIs present in traffic from a remote party. Asterisk does not generate</span><br><span style="color: hsl(120, 100%, 40%);">+; any TEL URIs of its own.</span><br><span style="color: hsl(120, 100%, 40%);">+;</span><br><span style="color: hsl(120, 100%, 40%);">+; Currently, the allowed request types are INVITE, ACK, BYE, and CANCEL. Any</span><br><span style="color: hsl(120, 100%, 40%);">+; other request type that contains a TEL URI will behave as it did before.</span><br><span style="color: hsl(120, 100%, 40%);">+; TEL URIs are allowed in the request, From, and To headers.</span><br><span style="color: hsl(120, 100%, 40%);">+;</span><br><span style="color: hsl(120, 100%, 40%);">+; You can match a TEL URI From header by IP, header, or auth_username.</span><br><span>diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h</span><br><span>index e688494..dcdf2b3 100644</span><br><span>--- a/include/asterisk/res_pjsip.h</span><br><span>+++ b/include/asterisk/res_pjsip.h</span><br><span>@@ -105,6 +105,8 @@</span><br><span> </span><br><span> AST_VECTOR(ast_sip_service_route_vector, char *);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static const pj_str_t AST_PJ_STR_EMPTY = { "", 0 };</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*!</span><br><span>  * \brief Structure for SIP transport information</span><br><span>  */</span><br><span>@@ -3692,4 +3694,65 @@</span><br><span>  */</span><br><span> void ast_sip_transport_state_unregister(struct ast_sip_tpmgr_state_callback *element);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Check whether a pjsip_uri is SIP/SIPS or not</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.28.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param uri The pjsip_uri to check</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retval 1 if true</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retval 0 if false</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+int ast_sip_is_uri_sip_sips(pjsip_uri *uri);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Check whether a pjsip_uri is allowed or not</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.28.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param uri The pjsip_uri to check</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retva; 1 if allowed</span><br><span style="color: hsl(120, 100%, 40%);">+ * \retval 0 if not allowed</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+int ast_sip_is_allowed_uri(pjsip_uri *uri);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Get the user portion of the pjsip_uri</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.28.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param uri The pjsip_uri to get the user from</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \note This function will check what kind of URI it receives and return</span><br><span style="color: hsl(120, 100%, 40%);">+ * the user based off of that</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return User string or empty string if not present</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+const pj_str_t *ast_sip_pjsip_uri_get_username(pjsip_uri *uri);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Get the host portion of the pjsip_uri</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.28.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param uri The pjsip_uri to get the host from</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \note This function will check what kind of URI it receives and return</span><br><span style="color: hsl(120, 100%, 40%);">+ * the host based off of that</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return Host string or empty string if not present</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+const pj_str_t *ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/*!</span><br><span style="color: hsl(120, 100%, 40%);">+ * \brief Get the other_param portion of the pjsip_uri</span><br><span style="color: hsl(120, 100%, 40%);">+ * \since 16.28.0</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param uri The pjsip_uri to get hte other_param from</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \note This function will check what kind of URI it receives and return</span><br><span style="color: hsl(120, 100%, 40%);">+ * the other_param based off of that</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * \return other_param or NULL if not present</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #endif /* _RES_PJSIP_H */</span><br><span>diff --git a/res/res_pjsip.c b/res/res_pjsip.c</span><br><span>index 2febf3d..c6d9a89 100644</span><br><span>--- a/res/res_pjsip.c</span><br><span>+++ b/res/res_pjsip.c</span><br><span>@@ -2472,6 +2472,69 @@</span><br><span>    return sip_threadpool;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+int ast_sip_is_uri_sip_sips(pjsip_uri *uri)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       return (PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+int ast_sip_is_allowed_uri(pjsip_uri *uri)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+   return (ast_sip_is_uri_sip_sips(uri) || PJSIP_URI_SCHEME_IS_TEL(uri));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+const pj_str_t *ast_sip_pjsip_uri_get_username(pjsip_uri *uri)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+        if (ast_sip_is_uri_sip_sips(uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+           pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (!sip_uri) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       return &AST_PJ_STR_EMPTY;</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             return &sip_uri->user;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            pjsip_tel_uri *tel_uri = pjsip_uri_get_uri(uri);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (!tel_uri) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       return &AST_PJ_STR_EMPTY;</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             return &tel_uri->number;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return &AST_PJ_STR_EMPTY;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+const pj_str_t *ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ if (ast_sip_is_uri_sip_sips(uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+           pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (!sip_uri) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       return &AST_PJ_STR_EMPTY;</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span style="color: hsl(120, 100%, 40%);">+             return &sip_uri->host;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            return &AST_PJ_STR_EMPTY;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return &AST_PJ_STR_EMPTY;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+       if (ast_sip_is_uri_sip_sips(uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+           pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (!sip_uri) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+          }</span><br><span style="color: hsl(120, 100%, 40%);">+             return pjsip_param_find(&sip_uri->other_param, param_str);</span><br><span style="color: hsl(120, 100%, 40%);">+     } else if (PJSIP_URI_SCHEME_IS_TEL(uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            pjsip_tel_uri *tel_uri = pjsip_uri_get_uri(uri);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (!tel_uri) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+          }</span><br><span style="color: hsl(120, 100%, 40%);">+             return pjsip_param_find(&tel_uri->other_param, param_str);</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> #ifdef TEST_FRAMEWORK</span><br><span> AST_TEST_DEFINE(xml_sanitization_end_null)</span><br><span> {</span><br><span>diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c</span><br><span>index ea8fb02..092e012 100644</span><br><span>--- a/res/res_pjsip/pjsip_distributor.c</span><br><span>+++ b/res/res_pjsip/pjsip_distributor.c</span><br><span>@@ -763,9 +763,8 @@</span><br><span>                 char name[AST_UUID_STR_LEN] = "";</span><br><span>          pjsip_uri *from = rdata->msg_info.from->uri;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-          if (PJSIP_URI_SCHEME_IS_SIP(from) || PJSIP_URI_SCHEME_IS_SIPS(from)) {</span><br><span style="color: hsl(0, 100%, 40%);">-                  pjsip_sip_uri *sip_from = pjsip_uri_get_uri(from);</span><br><span style="color: hsl(0, 100%, 40%);">-                      ast_copy_pj_str(name, &sip_from->user, sizeof(name));</span><br><span style="color: hsl(120, 100%, 40%);">+          if (ast_sip_is_allowed_uri(from)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                   ast_copy_pj_str(name, ast_sip_pjsip_uri_get_username(from), sizeof(name));</span><br><span>           }</span><br><span> </span><br><span>                unid = ao2_find(unidentified_requests, rdata->pkt_info.src_name, OBJ_SEARCH_KEY);</span><br><span>@@ -833,6 +832,7 @@</span><br><span>           *addrs = NULL;</span><br><span>               return 0;</span><br><span>    }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  if (!PJSIP_URI_SCHEME_IS_SIP(contact->uri) && !PJSIP_URI_SCHEME_IS_SIPS(contact->uri)) {</span><br><span>               *addrs = NULL;</span><br><span>               return 0;</span><br><span>diff --git a/res/res_pjsip/pjsip_message_filter.c b/res/res_pjsip/pjsip_message_filter.c</span><br><span>index edac55f..7f1b7d7 100644</span><br><span>--- a/res/res_pjsip/pjsip_message_filter.c</span><br><span>+++ b/res/res_pjsip/pjsip_message_filter.c</span><br><span>@@ -190,7 +190,7 @@</span><br><span>         pjsip_hdr *hdr;</span><br><span> </span><br><span>  if (tdata->msg->type == PJSIP_REQUEST_MSG) {</span><br><span style="color: hsl(0, 100%, 40%);">-              if (is_sip_uri(tdata->msg->line.req.uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (ast_sip_is_uri_sip_sips(tdata->msg->line.req.uri)) {</span><br><span>                       uri = pjsip_uri_get_uri(tdata->msg->line.req.uri);</span><br><span>                     print_sanitize_debug("Sanitizing Request", PJSIP_URI_IN_REQ_URI, uri);</span><br><span>                     while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {</span><br><span>@@ -201,7 +201,7 @@</span><br><span> </span><br><span>  for (hdr = tdata->msg->hdr.next; hdr != &tdata->msg->hdr; hdr = hdr->next) {</span><br><span>              if (hdr->type == PJSIP_H_TO || hdr->type == PJSIP_H_FROM) {</span><br><span style="color: hsl(0, 100%, 40%);">-                       if (is_sip_uri(((pjsip_fromto_hdr *) hdr)->uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 if (ast_sip_is_uri_sip_sips(((pjsip_fromto_hdr *) hdr)->uri)) {</span><br><span>                           uri = pjsip_uri_get_uri(((pjsip_fromto_hdr *) hdr)->uri);</span><br><span>                                 print_sanitize_debug("Sanitizing From/To header", PJSIP_URI_IN_FROMTO_HDR, uri);</span><br><span>                           while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {</span><br><span>@@ -209,7 +209,7 @@</span><br><span>                              }</span><br><span>                    }</span><br><span>            } else if (hdr->type == PJSIP_H_CONTACT) {</span><br><span style="color: hsl(0, 100%, 40%);">-                   if (!((pjsip_contact_hdr *) hdr)->star && is_sip_uri(((pjsip_contact_hdr *) hdr)->uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       if (!((pjsip_contact_hdr *) hdr)->star && ast_sip_is_uri_sip_sips(((pjsip_contact_hdr *) hdr)->uri)) {</span><br><span>                                 uri = pjsip_uri_get_uri(((pjsip_contact_hdr *) hdr)->uri);</span><br><span>                                print_sanitize_debug("Sanitizing Contact header", PJSIP_URI_IN_CONTACT_HDR, uri);</span><br><span>                          while ((x_transport = pjsip_param_find(&uri->other_param, &x_name))) {</span><br><span>@@ -288,7 +288,7 @@</span><br><span>      if (tdata->msg->type == PJSIP_REQUEST_MSG || !(cseq = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CSEQ, NULL)) ||</span><br><span>                pj_strcmp2(&cseq->method.name, "REGISTER")) {</span><br><span>               pjsip_contact_hdr *contact = pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">-          if (contact && (PJSIP_URI_SCHEME_IS_SIP(contact->uri) || PJSIP_URI_SCHEME_IS_SIPS(contact->uri))</span><br><span style="color: hsl(120, 100%, 40%);">+                if (contact && ast_sip_is_uri_sip_sips(contact->uri)</span><br><span>                      && !(tdata->msg->type == PJSIP_RESPONSE_MSG && tdata->msg->line.status.code / 100 == 3)) {</span><br><span>                       pjsip_sip_uri *uri = pjsip_uri_get_uri(contact->uri);</span><br><span> </span><br><span>@@ -440,6 +440,10 @@</span><br><span>          return;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (PJSIP_URI_SCHEME_IS_TEL(header_uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+            return;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  uri = pjsip_uri_get_uri(header_uri);</span><br><span>         if (!uri) {</span><br><span>          return;</span><br><span>@@ -458,6 +462,25 @@</span><br><span>       }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* An allow list helper function for tel URI requests */</span><br><span style="color: hsl(120, 100%, 40%);">+static int is_allowed_tel_uri_request(pjsip_rx_data *rdata)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+  struct pjsip_request_line req = rdata->msg_info.msg->line.req;</span><br><span style="color: hsl(120, 100%, 40%);">+  const pjsip_method method = (const pjsip_method)req.method;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (pjsip_method_cmp(&method, pjsip_get_invite_method())) {</span><br><span style="color: hsl(120, 100%, 40%);">+               return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else if (pjsip_method_cmp(&method, pjsip_get_ack_method())) {</span><br><span style="color: hsl(120, 100%, 40%);">+           return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else if (pjsip_method_cmp(&method, pjsip_get_bye_method())) {</span><br><span style="color: hsl(120, 100%, 40%);">+           return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     } else if (pjsip_method_cmp(&method, pjsip_get_cancel_method())) {</span><br><span style="color: hsl(120, 100%, 40%);">+                return 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static pj_bool_t on_rx_process_uris(pjsip_rx_data *rdata)</span><br><span> {</span><br><span>     pjsip_contact_hdr *contact = NULL;</span><br><span>@@ -466,7 +489,8 @@</span><br><span>             return PJ_FALSE;</span><br><span>     }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (!is_sip_uri(rdata->msg_info.msg->line.req.uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+   if (PJSIP_URI_SCHEME_IS_TEL(rdata->msg_info.msg->line.req.uri)</span><br><span style="color: hsl(120, 100%, 40%);">+          && !is_allowed_tel_uri_request(rdata)) {</span><br><span>             print_uri_debug(URI_TYPE_REQUEST, rdata, NULL);</span><br><span>              pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,</span><br><span>                   PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);</span><br><span>@@ -474,7 +498,7 @@</span><br><span>    }</span><br><span>    remove_x_ast_params(rdata->msg_info.msg->line.req.uri);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-       if (!is_sip_uri(rdata->msg_info.from->uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+   if (!ast_sip_is_allowed_uri(rdata->msg_info.from->uri)) {</span><br><span>              print_uri_debug(URI_TYPE_FROM, rdata, (pjsip_hdr *)rdata->msg_info.from);</span><br><span>                 pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,</span><br><span>                   PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);</span><br><span>@@ -482,7 +506,7 @@</span><br><span>    }</span><br><span>    remove_x_ast_params(rdata->msg_info.from->uri);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-       if (!is_sip_uri(rdata->msg_info.to->uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+     if (!ast_sip_is_allowed_uri(rdata->msg_info.to->uri)) {</span><br><span>                print_uri_debug(URI_TYPE_TO, rdata, (pjsip_hdr *)rdata->msg_info.to);</span><br><span>             pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata,</span><br><span>                   PJSIP_SC_UNSUPPORTED_URI_SCHEME, NULL, NULL, NULL);</span><br><span>diff --git a/res/res_pjsip/pjsip_options.c b/res/res_pjsip/pjsip_options.c</span><br><span>index 4f48257..7632dea 100644</span><br><span>--- a/res/res_pjsip/pjsip_options.c</span><br><span>+++ b/res/res_pjsip/pjsip_options.c</span><br><span>@@ -269,7 +269,6 @@</span><br><span> {</span><br><span>      RAII_VAR(struct ast_sip_endpoint *, endpoint, NULL, ao2_cleanup);</span><br><span>    pjsip_uri *ruri;</span><br><span style="color: hsl(0, 100%, 40%);">-        pjsip_sip_uri *sip_ruri;</span><br><span>     char exten[AST_MAX_EXTENSION];</span><br><span> </span><br><span>   if (pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_options_method)) {</span><br><span>@@ -281,13 +280,12 @@</span><br><span>  }</span><br><span> </span><br><span>        ruri = rdata->msg_info.msg->line.req.uri;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!ast_sip_is_allowed_uri(ruri)) {</span><br><span>                 send_options_response(rdata, 416);</span><br><span>           return PJ_TRUE;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   sip_ruri = pjsip_uri_get_uri(ruri);</span><br><span style="color: hsl(0, 100%, 40%);">-     ast_copy_pj_str(exten, &sip_ruri->user, sizeof(exten));</span><br><span style="color: hsl(120, 100%, 40%);">+        ast_copy_pj_str(exten, ast_sip_pjsip_uri_get_username(ruri), sizeof(exten));</span><br><span> </span><br><span>     /*</span><br><span>    * We may want to match in the dialplan without any user</span><br><span>diff --git a/res/res_pjsip_caller_id.c b/res/res_pjsip_caller_id.c</span><br><span>index 96e2cf9..64fd8c7 100644</span><br><span>--- a/res/res_pjsip_caller_id.c</span><br><span>+++ b/res/res_pjsip_caller_id.c</span><br><span>@@ -45,13 +45,11 @@</span><br><span> {</span><br><span>         char cid_name[AST_CHANNEL_NAME];</span><br><span>     char cid_num[AST_CHANNEL_NAME];</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_sip_uri *uri;</span><br><span>  pjsip_name_addr *id_name_addr = (pjsip_name_addr *) hdr->uri;</span><br><span>     char *semi;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- uri = pjsip_uri_get_uri(id_name_addr);</span><br><span>       ast_copy_pj_str(cid_name, &id_name_addr->display, sizeof(cid_name));</span><br><span style="color: hsl(0, 100%, 40%);">-     ast_copy_pj_str(cid_num, &uri->user, sizeof(cid_num));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_pj_str(cid_num, ast_sip_pjsip_uri_get_username(hdr->uri), sizeof(cid_num));</span><br><span> </span><br><span>  /* Always truncate caller-id number at a semicolon. */</span><br><span>       semi = strchr(cid_num, ';');</span><br><span>diff --git a/res/res_pjsip_dialog_info_body_generator.c b/res/res_pjsip_dialog_info_body_generator.c</span><br><span>index 972b908..9efb154 100644</span><br><span>--- a/res/res_pjsip_dialog_info_body_generator.c</span><br><span>+++ b/res/res_pjsip_dialog_info_body_generator.c</span><br><span>@@ -183,7 +183,6 @@</span><br><span>                      int remote_connected_num_restricted;</span><br><span>                         char *local_caller_num;</span><br><span>                      pjsip_dialog *dlg = ast_sip_subscription_get_dialog(state_data->sub);</span><br><span style="color: hsl(0, 100%, 40%);">-                        pjsip_sip_uri *dlg_remote_fromhdr = pjsip_uri_get_uri(dlg->local.info->uri);</span><br><span>                   char remote_target[PJSIP_MAX_URL_SIZE + 32];</span><br><span>                         char dlg_remote_uri[PJSIP_MAX_URL_SIZE];</span><br><span>                     char *from_domain_stripped;</span><br><span>@@ -191,7 +190,7 @@</span><br><span>                    pj_xml_node *remote_node, *remote_identity_node, *remote_target_node;</span><br><span> </span><br><span>                    /* We use the local dialog URI to determine the domain to use in the XML itself */</span><br><span style="color: hsl(0, 100%, 40%);">-                      ast_copy_pj_str(dlg_remote_uri, &dlg_remote_fromhdr->host, sizeof(dlg_remote_uri));</span><br><span style="color: hsl(120, 100%, 40%);">+                    ast_copy_pj_str(dlg_remote_uri, ast_sip_pjsip_uri_get_hostname(dlg->local.info->uri), sizeof(dlg_remote_uri));</span><br><span>                         from_domain_stripped = ast_strip_quoted(dlg_remote_uri, "<", ">");</span><br><span>                         ast_sip_sanitize_xml(from_domain_stripped, from_domain_sanitized, sizeof(from_domain_sanitized));</span><br><span> </span><br><span>diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c</span><br><span>index 1cc6e08..b5191a9 100644</span><br><span>--- a/res/res_pjsip_diversion.c</span><br><span>+++ b/res/res_pjsip_diversion.c</span><br><span>@@ -327,15 +327,15 @@</span><br><span>                                  struct ast_party_redirecting_reason *data)</span><br><span> {</span><br><span>   static const pj_str_t cause_name = { "cause", 5 };</span><br><span style="color: hsl(0, 100%, 40%);">-    pjsip_sip_uri *uri = pjsip_uri_get_uri(name_addr);</span><br><span style="color: hsl(120, 100%, 40%);">+    pjsip_uri *uri = name_addr->uri;</span><br><span>  pjsip_param *cause = NULL;</span><br><span>   unsigned long cause_value = 0;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!ast_sip_is_allowed_uri(uri)) {</span><br><span>          return;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   cause = pjsip_param_find(&uri->other_param, &cause_name);</span><br><span style="color: hsl(120, 100%, 40%);">+  cause = ast_sip_pjsip_uri_get_other_param(uri, &cause_name);</span><br><span> </span><br><span>         if (!cause) {</span><br><span>                return;</span><br><span>@@ -507,7 +507,6 @@</span><br><span> </span><br><span>    pjsip_fromto_hdr *hdr;</span><br><span>       pjsip_name_addr *name_addr;</span><br><span style="color: hsl(0, 100%, 40%);">-     pjsip_sip_uri *uri;</span><br><span>  pjsip_param *param;</span><br><span>  pjsip_fromto_hdr *old_hdr;</span><br><span>   const char *reason_str;</span><br><span>@@ -534,10 +533,9 @@</span><br><span>       hdr->sname = hdr->name = diversion_name;</span><br><span> </span><br><span>   name_addr = pjsip_uri_clone(tdata->pool, base);</span><br><span style="color: hsl(0, 100%, 40%);">-      uri = pjsip_uri_get_uri(name_addr->uri);</span><br><span> </span><br><span>      pj_strdup2(tdata->pool, &name_addr->display, id->name.str);</span><br><span style="color: hsl(0, 100%, 40%);">-        pj_strdup2(tdata->pool, &uri->user, id->number.str);</span><br><span style="color: hsl(120, 100%, 40%);">+     pj_strdup2(tdata->pool, (pj_str_t *)ast_sip_pjsip_uri_get_username(name_addr->uri), id->number.str);</span><br><span> </span><br><span>    param = PJ_POOL_ALLOC_T(tdata->pool, pjsip_param);</span><br><span>        param->name = reason_name;</span><br><span>diff --git a/res/res_pjsip_endpoint_identifier_anonymous.c b/res/res_pjsip_endpoint_identifier_anonymous.c</span><br><span>index 63fc405..cc4cd4b 100644</span><br><span>--- a/res/res_pjsip_endpoint_identifier_anonymous.c</span><br><span>+++ b/res/res_pjsip_endpoint_identifier_anonymous.c</span><br><span>@@ -33,12 +33,10 @@</span><br><span> static int get_endpoint_details(pjsip_rx_data *rdata, char *domain, size_t domain_size)</span><br><span> {</span><br><span>         pjsip_uri *from = rdata->msg_info.from->uri;</span><br><span style="color: hsl(0, 100%, 40%);">-      pjsip_sip_uri *sip_from;</span><br><span style="color: hsl(0, 100%, 40%);">-        if (!PJSIP_URI_SCHEME_IS_SIP(from) && !PJSIP_URI_SCHEME_IS_SIPS(from)) {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!ast_sip_is_uri_sip_sips(from)) {</span><br><span>                return -1;</span><br><span>   }</span><br><span style="color: hsl(0, 100%, 40%);">-       sip_from = (pjsip_sip_uri *) pjsip_uri_get_uri(from);</span><br><span style="color: hsl(0, 100%, 40%);">-   ast_copy_pj_str(domain, &sip_from->host, domain_size);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_pj_str(domain, ast_sip_pjsip_uri_get_hostname(from), domain_size);</span><br><span>  return 0;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_pjsip_endpoint_identifier_user.c b/res/res_pjsip_endpoint_identifier_user.c</span><br><span>index 46e82db..481cd3b 100644</span><br><span>--- a/res/res_pjsip_endpoint_identifier_user.c</span><br><span>+++ b/res/res_pjsip_endpoint_identifier_user.c</span><br><span>@@ -32,14 +32,14 @@</span><br><span> static int get_from_header(pjsip_rx_data *rdata, char *username, size_t username_size, char *domain, size_t domain_size)</span><br><span> {</span><br><span>       pjsip_uri *from = rdata->msg_info.from->uri;</span><br><span style="color: hsl(0, 100%, 40%);">-      pjsip_sip_uri *sip_from;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    if (!PJSIP_URI_SCHEME_IS_SIP(from) && !PJSIP_URI_SCHEME_IS_SIPS(from)) {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!ast_sip_is_uri_sip_sips(from)) {</span><br><span>                return -1;</span><br><span>   }</span><br><span style="color: hsl(0, 100%, 40%);">-       sip_from = (pjsip_sip_uri *) pjsip_uri_get_uri(from);</span><br><span style="color: hsl(0, 100%, 40%);">-   ast_copy_pj_str(username, &sip_from->user, username_size);</span><br><span style="color: hsl(0, 100%, 40%);">-       ast_copy_pj_str(domain, &sip_from->host, domain_size);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       ast_copy_pj_str(username, ast_sip_pjsip_uri_get_username(from), username_size);</span><br><span style="color: hsl(120, 100%, 40%);">+       ast_copy_pj_str(domain, ast_sip_pjsip_uri_get_hostname(from), domain_size);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>        return 0;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c</span><br><span>index f0db27c..336d392 100644</span><br><span>--- a/res/res_pjsip_messaging.c</span><br><span>+++ b/res/res_pjsip_messaging.c</span><br><span>@@ -1055,7 +1055,6 @@</span><br><span> {</span><br><span>     RAII_VAR(struct ast_sip_endpoint *, endpt, NULL, ao2_cleanup);</span><br><span>       pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;</span><br><span style="color: hsl(0, 100%, 40%);">-      pjsip_sip_uri *sip_ruri;</span><br><span>     pjsip_name_addr *name_addr;</span><br><span>  char buf[MAX_BODY_SIZE];</span><br><span>     const char *field;</span><br><span>@@ -1064,12 +1063,11 @@</span><br><span>         int res = 0;</span><br><span>         int size;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!ast_sip_is_allowed_uri(ruri)) {</span><br><span>                 return PJSIP_SC_UNSUPPORTED_URI_SCHEME;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   sip_ruri = pjsip_uri_get_uri(ruri);</span><br><span style="color: hsl(0, 100%, 40%);">-     ast_copy_pj_str(exten, &sip_ruri->user, AST_MAX_EXTENSION);</span><br><span style="color: hsl(120, 100%, 40%);">+    ast_copy_pj_str(exten, ast_sip_pjsip_uri_get_username(ruri), AST_MAX_EXTENSION);</span><br><span> </span><br><span>         /*</span><br><span>    * We may want to match in the dialplan without any user</span><br><span>diff --git a/res/res_pjsip_nat.c b/res/res_pjsip_nat.c</span><br><span>index 2d5e6a7..59223f7 100644</span><br><span>--- a/res/res_pjsip_nat.c</span><br><span>+++ b/res/res_pjsip_nat.c</span><br><span>@@ -112,7 +112,6 @@</span><br><span>  * for the subsequent requests and responses & then be able to properly update</span><br><span>  * the dialog object for all required events.</span><br><span>  */</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static int rewrite_route_set(pjsip_rx_data *rdata, pjsip_dialog *dlg)</span><br><span> {</span><br><span>  pjsip_rr_hdr *rr = NULL;</span><br><span>diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c</span><br><span>index 20a4761..0c9b1ee 100644</span><br><span>--- a/res/res_pjsip_outbound_registration.c</span><br><span>+++ b/res/res_pjsip_outbound_registration.c</span><br><span>@@ -511,14 +511,9 @@</span><br><span> </span><br><span> static struct pjsip_param *get_uri_option_line(const void *uri)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-    pjsip_sip_uri *pjuri;</span><br><span>        static const pj_str_t LINE_STR = { "line", 4 };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   if (!PJSIP_URI_SCHEME_IS_SIP(uri) && !PJSIP_URI_SCHEME_IS_SIPS(uri)) {</span><br><span style="color: hsl(0, 100%, 40%);">-          return NULL;</span><br><span style="color: hsl(0, 100%, 40%);">-    }</span><br><span style="color: hsl(0, 100%, 40%);">-       pjuri = pjsip_uri_get_uri(uri);</span><br><span style="color: hsl(0, 100%, 40%);">- return pjsip_param_find(&pjuri->other_param, &LINE_STR);</span><br><span style="color: hsl(120, 100%, 40%);">+   return ast_sip_pjsip_uri_get_other_param((pjsip_uri *)uri, &LINE_STR);</span><br><span> }</span><br><span> </span><br><span> /*! \brief Endpoint identifier which uses the 'line' parameter to establish a relationship to an outgoing registration */</span><br><span>diff --git a/res/res_pjsip_path.c b/res/res_pjsip_path.c</span><br><span>index 5eb3d49..5272a5c 100644</span><br><span>--- a/res/res_pjsip_path.c</span><br><span>+++ b/res/res_pjsip_path.c</span><br><span>@@ -39,7 +39,8 @@</span><br><span> static struct ast_sip_aor *find_aor(struct ast_sip_endpoint *endpoint, pjsip_uri *uri)</span><br><span> {</span><br><span>     char *configured_aors, *aor_name;</span><br><span style="color: hsl(0, 100%, 40%);">-       pjsip_sip_uri *sip_uri;</span><br><span style="color: hsl(120, 100%, 40%);">+       const pj_str_t *uri_username;</span><br><span style="color: hsl(120, 100%, 40%);">+ const pj_str_t *uri_hostname;</span><br><span>        char *domain_name;</span><br><span>   char *username;</span><br><span>      struct ast_str *id = NULL;</span><br><span>@@ -48,11 +49,13 @@</span><br><span>             return NULL;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   sip_uri = pjsip_uri_get_uri(uri);</span><br><span style="color: hsl(0, 100%, 40%);">-       domain_name = ast_alloca(sip_uri->host.slen + 1);</span><br><span style="color: hsl(0, 100%, 40%);">-    ast_copy_pj_str(domain_name, &sip_uri->host, sip_uri->host.slen + 1);</span><br><span style="color: hsl(0, 100%, 40%);">- username = ast_alloca(sip_uri->user.slen + 1);</span><br><span style="color: hsl(0, 100%, 40%);">-       ast_copy_pj_str(username, &sip_uri->user, sip_uri->user.slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+  uri_hostname = ast_sip_pjsip_uri_get_hostname(uri);</span><br><span style="color: hsl(120, 100%, 40%);">+   domain_name = ast_alloca(uri_hostname->slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+  ast_copy_pj_str(domain_name, uri_hostname, uri_hostname->slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      uri_username = ast_sip_pjsip_uri_get_username(uri);</span><br><span style="color: hsl(120, 100%, 40%);">+   username = ast_alloca(uri_username->slen + 1);</span><br><span style="color: hsl(120, 100%, 40%);">+     ast_copy_pj_str(username, uri_username, uri_username->slen + 1);</span><br><span> </span><br><span>      /*</span><br><span>    * We may want to match without any user options getting</span><br><span>@@ -74,7 +77,7 @@</span><br><span>                         break;</span><br><span>               }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-           if (!id && !(id = ast_str_create(strlen(username) + sip_uri->host.slen + 2))) {</span><br><span style="color: hsl(120, 100%, 40%);">+            if (!id && !(id = ast_str_create(strlen(username) + uri_hostname->slen + 2))) {</span><br><span>                   aor_name = NULL;</span><br><span>                     break;</span><br><span>               }</span><br><span>diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c</span><br><span>index 4086445..d767269 100644</span><br><span>--- a/res/res_pjsip_pubsub.c</span><br><span>+++ b/res/res_pjsip_pubsub.c</span><br><span>@@ -1596,17 +1596,17 @@</span><br><span>     struct ast_sip_pubsub_body_generator *generator;</span><br><span>     struct ast_sip_subscription_handler *handler;</span><br><span>        char *resource;</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_sip_uri *request_uri;</span><br><span>  size_t resource_size;</span><br><span>        int resp;</span><br><span>    struct resource_tree tree;</span><br><span>   pjsip_expires_hdr *expires_header;</span><br><span>   int64_t expires;</span><br><span style="color: hsl(120, 100%, 40%);">+      const pj_str_t *user;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-       request_uri = pjsip_uri_get_uri(rdata->msg_info.msg->line.req.uri);</span><br><span style="color: hsl(0, 100%, 40%);">-       resource_size = pj_strlen(&request_uri->user) + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+     user = ast_sip_pjsip_uri_get_username(rdata->msg_info.msg->line.req.uri);</span><br><span style="color: hsl(120, 100%, 40%);">+       resource_size = pj_strlen(user) + 1;</span><br><span>         resource = ast_alloca(resource_size);</span><br><span style="color: hsl(0, 100%, 40%);">-   ast_copy_pj_str(resource, &request_uri->user, resource_size);</span><br><span style="color: hsl(120, 100%, 40%);">+  ast_copy_pj_str(resource, user, resource_size);</span><br><span> </span><br><span>  /*</span><br><span>    * We may want to match without any user options getting</span><br><span>@@ -3015,11 +3015,11 @@</span><br><span>   struct ast_sip_pubsub_body_generator *generator;</span><br><span>     char *resource;</span><br><span>      pjsip_uri *request_uri;</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_sip_uri *request_uri_sip;</span><br><span>      size_t resource_size;</span><br><span>        int resp;</span><br><span>    struct resource_tree tree;</span><br><span>   pj_status_t dlg_status;</span><br><span style="color: hsl(120, 100%, 40%);">+       const pj_str_t *user;</span><br><span> </span><br><span>    endpoint = ast_pjsip_rdata_get_endpoint(rdata);</span><br><span>      ast_assert(endpoint != NULL);</span><br><span>@@ -3032,7 +3032,7 @@</span><br><span> </span><br><span>    request_uri = rdata->msg_info.msg->line.req.uri;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      if (!PJSIP_URI_SCHEME_IS_SIP(request_uri) && !PJSIP_URI_SCHEME_IS_SIPS(request_uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!ast_sip_is_uri_sip_sips(request_uri)) {</span><br><span>                 char uri_str[PJSIP_MAX_URL_SIZE];</span><br><span> </span><br><span>                pjsip_uri_print(PJSIP_URI_IN_REQ_URI, request_uri, uri_str, sizeof(uri_str));</span><br><span>@@ -3041,10 +3041,10 @@</span><br><span>              return PJ_TRUE;</span><br><span>      }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   request_uri_sip = pjsip_uri_get_uri(request_uri);</span><br><span style="color: hsl(0, 100%, 40%);">-       resource_size = pj_strlen(&request_uri_sip->user) + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ user = ast_sip_pjsip_uri_get_username(request_uri);</span><br><span style="color: hsl(120, 100%, 40%);">+   resource_size = pj_strlen(user) + 1;</span><br><span>         resource = ast_alloca(resource_size);</span><br><span style="color: hsl(0, 100%, 40%);">-   ast_copy_pj_str(resource, &request_uri_sip->user, resource_size);</span><br><span style="color: hsl(120, 100%, 40%);">+      ast_copy_pj_str(resource, user, resource_size);</span><br><span> </span><br><span>  /*</span><br><span>    * We may want to match without any user options getting</span><br><span>@@ -3260,12 +3260,12 @@</span><br><span>   RAII_VAR(struct ast_sip_publication_resource *, resource, NULL, ao2_cleanup);</span><br><span>        struct ast_variable *event_configuration_name = NULL;</span><br><span>        pjsip_uri *request_uri;</span><br><span style="color: hsl(0, 100%, 40%);">- pjsip_sip_uri *request_uri_sip;</span><br><span>      int resp;</span><br><span style="color: hsl(120, 100%, 40%);">+     const pj_str_t *user;</span><br><span> </span><br><span>    request_uri = rdata->msg_info.msg->line.req.uri;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-      if (!PJSIP_URI_SCHEME_IS_SIP(request_uri) && !PJSIP_URI_SCHEME_IS_SIPS(request_uri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+        if (!ast_sip_is_uri_sip_sips(request_uri)) {</span><br><span>                 char uri_str[PJSIP_MAX_URL_SIZE];</span><br><span> </span><br><span>                pjsip_uri_print(PJSIP_URI_IN_REQ_URI, request_uri, uri_str, sizeof(uri_str));</span><br><span>@@ -3274,10 +3274,10 @@</span><br><span>              return NULL;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   request_uri_sip = pjsip_uri_get_uri(request_uri);</span><br><span style="color: hsl(0, 100%, 40%);">-       resource_size = pj_strlen(&request_uri_sip->user) + 1;</span><br><span style="color: hsl(120, 100%, 40%);">+ user = ast_sip_pjsip_uri_get_username(request_uri);</span><br><span style="color: hsl(120, 100%, 40%);">+   resource_size = pj_strlen(user) + 1;</span><br><span>         resource_name = ast_alloca(resource_size);</span><br><span style="color: hsl(0, 100%, 40%);">-      ast_copy_pj_str(resource_name, &request_uri_sip->user, resource_size);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_pj_str(resource_name, user, resource_size);</span><br><span> </span><br><span>     /*</span><br><span>    * We may want to match without any user options getting</span><br><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index d4a857f..858faf3 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -3665,16 +3665,14 @@</span><br><span> static enum sip_get_destination_result get_destination(struct ast_sip_session *session, pjsip_rx_data *rdata)</span><br><span> {</span><br><span>    pjsip_uri *ruri = rdata->msg_info.msg->line.req.uri;</span><br><span style="color: hsl(0, 100%, 40%);">-      pjsip_sip_uri *sip_ruri;</span><br><span>     struct ast_features_pickup_config *pickup_cfg;</span><br><span>       const char *pickupexten;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-    if (!PJSIP_URI_SCHEME_IS_SIP(ruri) && !PJSIP_URI_SCHEME_IS_SIPS(ruri)) {</span><br><span style="color: hsl(120, 100%, 40%);">+      if (!ast_sip_is_allowed_uri(ruri)) {</span><br><span>                 return SIP_GET_DEST_UNSUPPORTED_URI;</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   sip_ruri = pjsip_uri_get_uri(ruri);</span><br><span style="color: hsl(0, 100%, 40%);">-     ast_copy_pj_str(session->exten, &sip_ruri->user, sizeof(session->exten));</span><br><span style="color: hsl(120, 100%, 40%);">+        ast_copy_pj_str(session->exten, ast_sip_pjsip_uri_get_username(ruri), sizeof(session->exten));</span><br><span> </span><br><span>     /*</span><br><span>    * We may want to match in the dialplan without any user</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19236">change 19236</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/19236"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 20 </div>
<div style="display:none"> Gerrit-Change-Id: If5729e6cd583be7acf666373bf9f1b9d653ec29a </div>
<div style="display:none"> Gerrit-Change-Number: 19236 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>