summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-05-31 15:41:45 +0000
committerJoshua Colp <jcolp@digium.com>2017-06-06 09:46:39 -0500
commit861984eac0d9d3582db6922a89e2d75796ae108f (patch)
treed939381d1a4d848c8395636d6533a94072af3e69 /include/asterisk
parent452e6315bb8be7578937de279aa1d906662faa20 (diff)
res_pjsip: Add support for returning only reachable contacts and use it.
This introduces the ability for PJSIP code to specify filtering flags when retrieving PJSIP contacts. The first flag for use causes the query code to only retrieve contacts that are not unreachable. This change has been leveraged by both the Dial() process and the PJSIP_DIAL_CONTACTS dialplan function so they will now only attempt calls to contacts which are not unreachable. ASTERISK-26281 Change-Id: I8233b4faa21ba3db114f5a42e946e4b191446f6c
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/res_pjsip.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/include/asterisk/res_pjsip.h b/include/asterisk/res_pjsip.h
index 59f1710d1..8c589ef85 100644
--- a/include/asterisk/res_pjsip.h
+++ b/include/asterisk/res_pjsip.h
@@ -865,6 +865,17 @@ struct ast_sip_endpoint_identifier {
};
/*!
+ * \brief Contact retrieval filtering flags
+ */
+enum ast_sip_contact_filter {
+ /*! \brief Default filter flags */
+ AST_SIP_CONTACT_FILTER_DEFAULT = 0,
+
+ /*! \brief Return only reachable or unknown contacts */
+ AST_SIP_CONTACT_FILTER_REACHABLE = (1 << 0),
+};
+
+/*!
* \brief Register a SIP service in Asterisk.
*
* This is more-or-less a wrapper around pjsip_endpt_register_module().
@@ -1050,6 +1061,18 @@ struct ast_sip_aor *ast_sip_location_retrieve_aor(const char *aor_name);
struct ast_sip_contact *ast_sip_location_retrieve_first_aor_contact(const struct ast_sip_aor *aor);
/*!
+ * \brief Retrieve the first bound contact for an AOR and filter based on flags
+ * \since 13.16.0
+ *
+ * \param aor Pointer to the AOR
+ * \param flags Filtering flags
+ * \retval NULL if no contacts available
+ * \retval non-NULL if contacts available
+ */
+struct ast_sip_contact *ast_sip_location_retrieve_first_aor_contact_filtered(const struct ast_sip_aor *aor,
+ unsigned int flags);
+
+/*!
* \brief Retrieve all contacts currently available for an AOR
*
* \param aor Pointer to the AOR
@@ -1064,6 +1087,23 @@ struct ast_sip_contact *ast_sip_location_retrieve_first_aor_contact(const struct
struct ao2_container *ast_sip_location_retrieve_aor_contacts(const struct ast_sip_aor *aor);
/*!
+ * \brief Retrieve all contacts currently available for an AOR and filter based on flags
+ * \since 13.16.0
+ *
+ * \param aor Pointer to the AOR
+ * \param flags Filtering flags
+ *
+ * \retval NULL if no contacts available
+ * \retval non-NULL if contacts available
+ *
+ * \warning
+ * Since this function prunes expired contacts before returning, it holds a named write
+ * lock on the aor. If you already hold the lock, call ast_sip_location_retrieve_aor_contacts_nolock instead.
+ */
+struct ao2_container *ast_sip_location_retrieve_aor_contacts_filtered(const struct ast_sip_aor *aor,
+ unsigned int flags);
+
+/*!
* \brief Retrieve all contacts currently available for an AOR without locking the AOR
* \since 13.9.0
*
@@ -1078,6 +1118,22 @@ struct ao2_container *ast_sip_location_retrieve_aor_contacts(const struct ast_si
struct ao2_container *ast_sip_location_retrieve_aor_contacts_nolock(const struct ast_sip_aor *aor);
/*!
+ * \brief Retrieve all contacts currently available for an AOR without locking the AOR and filter based on flags
+ * \since 13.16.0
+ *
+ * \param aor Pointer to the AOR
+ * \param flags Filtering flags
+ *
+ * \retval NULL if no contacts available
+ * \retval non-NULL if contacts available
+ *
+ * \warning
+ * This function should only be called if you already hold a named write lock on the aor.
+ */
+struct ao2_container *ast_sip_location_retrieve_aor_contacts_nolock_filtered(const struct ast_sip_aor *aor,
+ unsigned int flags);
+
+/*!
* \brief Retrieve the first bound contact from a list of AORs
*
* \param aor_list A comma-separated list of AOR names
@@ -1106,6 +1162,18 @@ struct ao2_container *ast_sip_location_retrieve_contacts_from_aor_list(const cha
struct ast_sip_contact **contact);
/*!
+ * \brief Retrieve the first bound contact AND the AOR chosen from a list of AORs and filter based on flags
+ * \since 13.16.0
+ *
+ * \param aor_list A comma-separated list of AOR names
+ * \param flags Filtering flags
+ * \param aor The chosen AOR
+ * \param contact The chosen contact
+ */
+void ast_sip_location_retrieve_contact_and_aor_from_list_filtered(const char *aor_list, unsigned int flags,
+ struct ast_sip_aor **aor, struct ast_sip_contact **contact);
+
+/*!
* \brief Retrieve a named contact
*
* \param contact_name Name of the contact