AST_VECTOR(ast_sip_service_route_vector, char *);
+static const pj_str_t AST_PJ_STR_EMPTY = { "", 0 };
+
/*!
* \brief Structure for SIP transport information
*/
*/
void ast_sip_transport_state_unregister(struct ast_sip_tpmgr_state_callback *element);
+/*!
+ * \brief Check whether a pjsip_uri is SIP/SIPS or not
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to check
+ *
+ * \retval 1 if true
+ * \retval 0 if false
+ */
+int ast_sip_is_uri_sip_sips(pjsip_uri *uri);
+
+/*!
+ * \brief Check whether a pjsip_uri is allowed or not
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to check
+ *
+ * \retval 1 if allowed
+ * \retval 0 if not allowed
+ */
+int ast_sip_is_allowed_uri(pjsip_uri *uri);
+
+/*!
+ * \brief Get the user portion of the pjsip_uri
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to get the user from
+ *
+ * \note This function will check what kind of URI it receives and return
+ * the user based off of that
+ *
+ * \return User string or empty string if not present
+ */
+const pj_str_t *ast_sip_pjsip_uri_get_username(pjsip_uri *uri);
+
+/*!
+ * \brief Get the host portion of the pjsip_uri
+ * \since 16.28.0
+ *
+ * \param uri The pjsip_uri to get the host from
+ *
+ * \note This function will check what kind of URI it receives and return
+ * the host based off of that
+ *
+ * \return Host string or empty string if not present
+ */
+const pj_str_t *ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri);
+
+/*!
+ * \brief Find an 'other' SIP/SIPS URI parameter by name
+ * \since 16.28.0
+ *
+ * A convenience function to find a named parameter from a SIP/SIPS URI. This
+ * function will not find the following standard SIP/SIPS URI parameters which
+ * are stored separately by PJSIP:
+ *
+ * \li `user`
+ * \li `method`
+ * \li `transport`
+ * \li `ttl`
+ * \li `lr`
+ * \li `maddr`
+ *
+ * \param uri The pjsip_uri to get the parameter from
+ * \param param_str The name of the parameter to find
+ *
+ * \note This function will check what kind of URI it receives and return
+ * the parameter based off of that
+ *
+ * \return Find parameter or NULL if not present
+ */
+struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str);
+
/*!
* \brief Convert name to SIP response code
*
return sip_threadpool;
}
+int ast_sip_is_uri_sip_sips(pjsip_uri *uri)
+{
+ return (PJSIP_URI_SCHEME_IS_SIP(uri) || PJSIP_URI_SCHEME_IS_SIPS(uri));
+}
+
+int ast_sip_is_allowed_uri(pjsip_uri *uri)
+{
+ return (ast_sip_is_uri_sip_sips(uri));
+}
+
+const pj_str_t *ast_sip_pjsip_uri_get_username(pjsip_uri *uri)
+{
+ if (ast_sip_is_uri_sip_sips(uri)) {
+ pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
+ if (!sip_uri) {
+ return &AST_PJ_STR_EMPTY;
+ }
+ return &sip_uri->user;
+ }
+
+ return &AST_PJ_STR_EMPTY;
+}
+
+const pj_str_t *ast_sip_pjsip_uri_get_hostname(pjsip_uri *uri)
+{
+ if (ast_sip_is_uri_sip_sips(uri)) {
+ pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
+ if (!sip_uri) {
+ return &AST_PJ_STR_EMPTY;
+ }
+ return &sip_uri->host;
+ }
+
+ return &AST_PJ_STR_EMPTY;
+}
+
+struct pjsip_param *ast_sip_pjsip_uri_get_other_param(pjsip_uri *uri, const pj_str_t *param_str)
+{
+ if (ast_sip_is_uri_sip_sips(uri)) {
+ pjsip_sip_uri *sip_uri = pjsip_uri_get_uri(uri);
+ if (!sip_uri) {
+ return NULL;
+ }
+ return pjsip_param_find(&sip_uri->other_param, param_str);
+ }
+
+ return NULL;
+}
struct response_code_map {
int code;