Merge "res_pjsip: Add support for returning only reachable contacts and use it." into 13

This commit is contained in:
Jenkins2
2017-06-07 08:11:23 -05:00
committed by Gerrit Code Review
6 changed files with 128 additions and 6 deletions

View File

@@ -870,6 +870,17 @@ struct ast_sip_endpoint_identifier {
struct ast_sip_endpoint *(*identify_endpoint)(pjsip_rx_data *rdata);
};
/*!
* \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.
*
@@ -1055,6 +1066,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
*
@@ -1069,6 +1092,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
@@ -1083,6 +1123,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
*
@@ -1111,6 +1167,18 @@ struct ao2_container *ast_sip_location_retrieve_contacts_from_aor_list(const cha
void ast_sip_location_retrieve_contact_and_aor_from_list(const char *aor_list, struct ast_sip_aor **aor,
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
*