res_pjsip_pubsub: Add ability to persist generator state information.

Some body generators, such as dialog-info+xml, require storing state
information which is then conveyed in the NOTIFY request itself. Up
until now there was no way for such body generators to persist this
information.

Two new API calls have been added to allow body generators to set and
get persisted data. This data is persisted out alongside the normal
persistence information and allows the body generator to restore
state information or to simply use this for normal storage of state.
State is stored in the form of JSON and it is up to the body
generator to interpret this as needed.

The dialog-info+xml body generator has been updated to take advantage
of this to persist the version number.

ASTERISK-27759

Change-Id: I5fda56c624fd13c17b3c48e0319b77079e9e27de
This commit is contained in:
Joshua C. Colp
2020-01-06 15:02:54 +00:00
committed by Joshua Colp
parent e89c8bc0d2
commit 4e7adbd8f4
3 changed files with 143 additions and 47 deletions

View File

@@ -545,6 +545,29 @@ void ast_sip_subscription_remove_datastore(struct ast_sip_subscription *subscrip
*/
struct ao2_container *ast_sip_subscription_get_datastores(const struct ast_sip_subscription *subscription);
/*!
* \since 13.31.0
* \since 16.8.0
* \since 17.2.0
* \brief Set persistence data for a subscription
*
* \param subscription The subscription to set persistence data on
* \param persistence_data The persistence data to set
*
* \note This steals the reference to persistence_data
*/
void ast_sip_subscription_set_persistence_data(struct ast_sip_subscription *subscription, struct ast_json *persistence_data);
/*!
* \since 13.31.0
* \since 16.8.0
* \since 17.2.0
* \brief Retrieve persistence data for a subscription
*
* \param subscription The subscription to retrieve persistence data from
*/
const struct ast_json *ast_sip_subscription_get_persistence_data(const struct ast_sip_subscription *subscription);
/*!
* \brief Register a subscription handler
*