res_pjsip_pubsub: Use common datastores container API.

This migrates res_pjsip_pubsub over to using the newly
introduce common datastores management API instead of using
its own implementations for both subscriptions and
publications.

As well the extension state data now provides a generic
datastores container instead of a subscription. This allows
the dialog-info+xml body generator to work for both
subscriptions and publications.

ASTERISK-25999 #close

Change-Id: I773f9e4f35092da0f653566736a8647e8cfebef1
This commit is contained in:
Joshua Colp
2016-05-05 11:14:00 -03:00
parent 94cd351ec4
commit d03e170ae7
5 changed files with 76 additions and 92 deletions

View File

@@ -21,6 +21,9 @@
#include "asterisk/pbx.h"
/*! \brief Forward declaration for ao2_container so full astobj2.h is not required */
struct ao2_container;
/*!
* \brief structure used for presence XML bodies
*
@@ -51,6 +54,8 @@ struct ast_sip_exten_state_data {
char remote[PJSIP_MAX_URL_SIZE];
/*! Optional subscription */
struct ast_sip_subscription *sub;
/*! A datastores container to persist datastores */
struct ao2_container *datastores;
/*! Allocation pool */
pj_pool_t *pool;
};

View File

@@ -165,6 +165,20 @@ struct ast_datastore *ast_sip_publication_get_datastore(struct ast_sip_publicati
*/
void ast_sip_publication_remove_datastore(struct ast_sip_publication *publication, const char *name);
/*!
* \brief Get the datastores container for a publication
*
* \param publication The publication to get the datastores container from
*
* \retval NULL datastores container not present
* \retval non-NULL datastores container
*
* \note The container is NOT returned with reference count bumped
*
* \since 14.0.0
*/
struct ao2_container *ast_sip_publication_get_datastores(const struct ast_sip_publication *publication);
/*!
* \brief Opaque structure representing an RFC 3265 SIP subscription
*/
@@ -517,6 +531,20 @@ struct ast_datastore *ast_sip_subscription_get_datastore(struct ast_sip_subscrip
*/
void ast_sip_subscription_remove_datastore(struct ast_sip_subscription *subscription, const char *name);
/*!
* \brief Get the datastores container for a subscription
*
* \param subscription The subscription to get the datastores container from
*
* \retval NULL datastores container not present
* \retval non-NULL datastores container
*
* \note The container is NOT returned with reference count bumped
*
* \since 14.0.0
*/
struct ao2_container *ast_sip_subscription_get_datastores(const struct ast_sip_subscription *subscription);
/*!
* \brief Register a subscription handler
*