summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asterisk/autoconfig.h.in4
-rw-r--r--include/asterisk/dns_core.h9
-rw-r--r--include/asterisk/dns_internal.h52
-rw-r--r--include/asterisk/dns_query_set.h20
-rw-r--r--include/asterisk/endpoints.h10
-rw-r--r--include/asterisk/res_pjsip.h47
6 files changed, 132 insertions, 10 deletions
diff --git a/include/asterisk/autoconfig.h.in b/include/asterisk/autoconfig.h.in
index 8c7ead499..474fb8c31 100644
--- a/include/asterisk/autoconfig.h.in
+++ b/include/asterisk/autoconfig.h.in
@@ -578,6 +578,10 @@
/* Define if your system has the PJPROJECT libraries. */
#undef HAVE_PJPROJECT
+/* Define to 1 if PJPROJECT has the PJSIP External Resolver Support feature.
+ */
+#undef HAVE_PJSIP_EXTERNAL_RESOLVER
+
/* Define to 1 if PJPROJECT has the pjsip_get_dest_info support feature. */
#undef HAVE_PJSIP_GET_DEST_INFO
diff --git a/include/asterisk/dns_core.h b/include/asterisk/dns_core.h
index 1f67bb803..fe67e340d 100644
--- a/include/asterisk/dns_core.h
+++ b/include/asterisk/dns_core.h
@@ -205,6 +205,15 @@ int ast_dns_record_get_ttl(const struct ast_dns_record *record);
const char *ast_dns_record_get_data(const struct ast_dns_record *record);
/*!
+ * \brief Retrieve the size of the raw DNS record
+ *
+ * \param record The DNS record
+ *
+ * \return the size of the raw DNS record
+ */
+size_t ast_dns_record_get_data_size(const struct ast_dns_record *record);
+
+/*!
* \brief Get the next DNS record
*
* \param record The current DNS record
diff --git a/include/asterisk/dns_internal.h b/include/asterisk/dns_internal.h
index d518f9066..be8794ba9 100644
--- a/include/asterisk/dns_internal.h
+++ b/include/asterisk/dns_internal.h
@@ -23,6 +23,12 @@
* \author Joshua Colp <jcolp@digium.com>
*/
+/*! \brief For AST_VECTOR */
+#include "asterisk/vector.h"
+
+/*! \brief For ast_dns_query_set_callback */
+#include "asterisk/dns_query_set.h"
+
/*! \brief Generic DNS record information */
struct ast_dns_record {
/*! \brief Resource record type */
@@ -151,6 +157,30 @@ struct ast_dns_query_recurring {
char name[0];
};
+/*! \brief A DNS query set query, which includes its state */
+struct dns_query_set_query {
+ /*! \brief Whether the query started successfully or not */
+ unsigned int started;
+ /*! \brief THe query itself */
+ struct ast_dns_query *query;
+};
+
+/*! \brief A set of DNS queries */
+struct ast_dns_query_set {
+ /*! \brief DNS queries */
+ AST_VECTOR(, struct dns_query_set_query) queries;
+ /* \brief Whether the query set is in progress or not */
+ int in_progress;
+ /*! \brief The total number of completed queries */
+ int queries_completed;
+ /*! \brief The total number of cancelled queries */
+ int queries_cancelled;
+ /*! \brief Callback to invoke upon completion */
+ ast_dns_query_set_callback callback;
+ /*! \brief User-specific data */
+ void *user_data;
+};
+
/*! \brief An active DNS query */
struct ast_dns_query_active {
/*! \brief The underlying DNS query */
@@ -241,3 +271,25 @@ int dns_parse_short(unsigned char *cur, uint16_t *val);
* \return The number of bytes consumed while parsing
*/
int dns_parse_string(char *cur, uint8_t *size, char **val);
+
+/*!
+ * \brief Allocate a DNS query (but do not start resolution)
+ *
+ * \param name The name of what to resolve
+ * \param rr_type Resource record type
+ * \param rr_class Resource record class
+ * \param callback The callback to invoke upon completion
+ * \param data User data to make available on the query
+ *
+ * \retval non-NULL success
+ * \retval NULL failure
+ *
+ * \note The result passed to the callback does not need to be freed
+ *
+ * \note The user data MUST be an ao2 object
+ *
+ * \note This function increments the reference count of the user data, it does NOT steal
+ *
+ * \note The query must be released upon completion or cancellation using ao2_ref
+ */
+struct ast_dns_query *dns_query_alloc(const char *name, int rr_type, int rr_class, ast_dns_resolve_callback callback, void *data);
diff --git a/include/asterisk/dns_query_set.h b/include/asterisk/dns_query_set.h
index c89fdfde7..fac732ae0 100644
--- a/include/asterisk/dns_query_set.h
+++ b/include/asterisk/dns_query_set.h
@@ -43,6 +43,8 @@ typedef void (*ast_dns_query_set_callback)(const struct ast_dns_query_set *query
*
* \retval non-NULL success
* \retval NULL failure
+ *
+ * \note The query set must be released upon cancellation or completion using ao2_ref
*/
struct ast_dns_query_set *ast_dns_query_set_create(void);
@@ -76,6 +78,8 @@ size_t ast_dns_query_set_num_queries(const struct ast_dns_query_set *query_set);
*
* \retval non-NULL success
* \retval NULL failure
+ *
+ * \note The returned query is only valid for the lifetime of the query set itself
*/
struct ast_dns_query *ast_dns_query_set_get(const struct ast_dns_query_set *query_set, unsigned int index);
@@ -106,29 +110,25 @@ void ast_dns_query_set_resolve_async(struct ast_dns_query_set *query_set, ast_dn
*
* \param query_set The query set
*
+ * \retval 0 success
+ * \retval -1 failure
+ *
* \note This function will return when all queries have been completed
*/
-void ast_query_set_resolve(struct ast_dns_query_set *query_set);
+int ast_query_set_resolve(struct ast_dns_query_set *query_set);
/*!
* \brief Cancel an asynchronous DNS query set resolution
*
* \param query_set The DNS query set
*
- * \retval 0 success
- * \retval -1 failure
+ * \retval 0 success (all queries have been cancelled)
+ * \retval -1 failure (some queries could not be cancelled)
*
* \note If successfully cancelled the callback will not be invoked
*/
int ast_dns_query_set_resolve_cancel(struct ast_dns_query_set *query_set);
-/*!
- * \brief Free a query set
- *
- * \param query_set A DNS query set
- */
-void ast_dns_query_set_free(struct ast_dns_query_set *query_set);
-
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
diff --git a/include/asterisk/endpoints.h b/include/asterisk/endpoints.h
index 663dd94d9..c9cb6b9de 100644
--- a/include/asterisk/endpoints.h
+++ b/include/asterisk/endpoints.h
@@ -160,6 +160,16 @@ const char *ast_endpoint_get_resource(const struct ast_endpoint *endpoint);
const char *ast_endpoint_get_id(const struct ast_endpoint *endpoint);
/*!
+ * \brief Gets the state of the given endpoint.
+ *
+ * \param endpoint The endpoint.
+ * \return state.
+ * \return \c AST_ENDPOINT_UNKNOWN if endpoint is \c NULL.
+ * \since 13.4
+ */
+enum ast_endpoint_state ast_endpoint_get_state(const struct ast_endpoint *endpoint);
+
+/*!
* \brief Updates the state of the given endpoint.
*
* \param endpoint Endpoint to modify.
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index 2358a7281..99b65ab08 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -166,6 +166,8 @@ struct ast_sip_contact {
unsigned int qualify_frequency;
/*! If true authenticate the qualify if needed */
int authenticate_qualify;
+ /*! Qualify timeout. 0 is diabled. */
+ double qualify_timeout;
};
#define CONTACT_STATUS "contact_status"
@@ -192,6 +194,8 @@ struct ast_sip_contact_status {
struct timeval rtt_start;
/*! The round trip time in microseconds */
int64_t rtt;
+ /*! Last status for a contact (default - unavailable) */
+ enum ast_sip_contact_status_type last_status;
};
/*!
@@ -224,6 +228,8 @@ struct ast_sip_aor {
struct ao2_container *permanent_contacts;
/*! Determines whether SIP Path headers are supported */
unsigned int support_path;
+ /*! Qualify timeout. 0 is diabled. */
+ double qualify_timeout;
};
/*!
@@ -905,6 +911,15 @@ struct ao2_container *ast_sip_location_retrieve_aor_contacts(const struct ast_si
struct ast_sip_contact *ast_sip_location_retrieve_contact_from_aor_list(const char *aor_list);
/*!
+ * \brief Retrieve all contacts from a list of AORs
+ *
+ * \param aor_list A comma-separated list of AOR names
+ * \retval NULL if no contacts available
+ * \retval non-NULL container (which must be freed) if contacts available
+ */
+struct ao2_container *ast_sip_location_retrieve_contacts_from_aor_list(const char *aor_list);
+
+/*!
* \brief Retrieve the first bound contact AND the AOR chosen from a list of AORs
*
* \param aor_list A comma-separated list of AOR names
@@ -1260,6 +1275,30 @@ int ast_sip_send_request(pjsip_tx_data *tdata, struct pjsip_dialog *dlg,
void (*callback)(void *token, pjsip_event *e));
/*!
+ * \brief General purpose method for sending an Out-Of-Dialog SIP request
+ *
+ * This is a companion function for \ref ast_sip_create_request. The request
+ * created there can be passed to this function, though any request may be
+ * passed in.
+ *
+ * This will automatically set up handling outbound authentication challenges if
+ * they arrive.
+ *
+ * \param tdata The request to send
+ * \param endpoint Optional. If specified, the out-of-dialog request is sent to the endpoint.
+ * \param timeout. If non-zero, after the timeout the transaction will be terminated
+ * and the callback will be called with the PJSIP_EVENT_TIMER type.
+ * \param token Data to be passed to the callback upon receipt of out-of-dialog response.
+ * \param callback Callback to be called upon receipt of out-of-dialog response.
+ *
+ * \retval 0 Success
+ * \retval -1 Failure (out-of-dialog callback will not be called.)
+ */
+int ast_sip_send_out_of_dialog_request(pjsip_tx_data *tdata,
+ struct ast_sip_endpoint *endpoint, int timeout, void *token,
+ void (*callback)(void *token, pjsip_event *e));
+
+/*!
* \brief General purpose method for creating a SIP response
*
* Its typical use would be to create responses for out of dialog
@@ -1956,4 +1995,12 @@ char *ast_sip_get_endpoint_identifier_order(void);
*/
unsigned int ast_sip_get_keep_alive_interval(void);
+/*!
+ * \brief Retrieve the system max initial qualify time.
+ *
+ * \retval the maximum initial qualify time.
+ */
+unsigned int ast_sip_get_max_initial_qualify_time(void);
+
+
#endif /* _RES_PJSIP_H */