Asterisk - The Open Source Telephony Project
18.5.0
|
#include "asterisk/linkedlists.h"
Go to the source code of this file.
Data Structures | |
struct | ast_sip_body_data |
Data used to create bodies for NOTIFY/PUBLISH requests. More... | |
struct | ast_sip_notifier |
struct | ast_sip_publish_handler |
Callbacks that publication handlers will define. More... | |
struct | ast_sip_pubsub_body_generator |
Pubsub body generator. More... | |
struct | ast_sip_pubsub_body_supplement |
Body supplement. More... | |
struct | ast_sip_subscriber |
struct | ast_sip_subscription_handler |
struct | ast_sip_subscription_response_data |
Data for responses to SUBSCRIBEs and NOTIFIEs. More... | |
Macros | |
#define | AST_SIP_EXTEN_STATE_DATA "ast_sip_exten_state_data" |
#define | AST_SIP_MAX_ACCEPT 32 |
#define | AST_SIP_MESSAGE_ACCUMULATOR "ast_sip_message_accumulator" |
Enumerations | |
enum | ast_sip_publish_state { AST_SIP_PUBLISH_STATE_INITIALIZED, AST_SIP_PUBLISH_STATE_ACTIVE, AST_SIP_PUBLISH_STATE_TERMINATED } |
enum | ast_sip_subscription_notify_reason { AST_SIP_SUBSCRIPTION_NOTIFY_REASON_STARTED, AST_SIP_SUBSCRIPTION_NOTIFY_REASON_RENEWED, AST_SIP_SUBSCRIPTION_NOTIFY_REASON_TERMINATED, AST_SIP_SUBSCRIPTION_NOTIFY_REASON_OTHER } |
enum | ast_sip_subscription_role { AST_SIP_SUBSCRIBER, AST_SIP_NOTIFIER } |
Role for the subscription that is being created. More... | |
Functions | |
struct ast_sip_subscription * | ast_sip_create_subscription (const struct ast_sip_subscription_handler *handler, struct ast_sip_endpoint *endpoint, const char *resource) |
Create a new ast_sip_subscription structure. More... | |
int | ast_sip_publication_add_datastore (struct ast_sip_publication *publication, struct ast_datastore *datastore) |
Add a datastore to a SIP publication. More... | |
struct ast_datastore * | ast_sip_publication_get_datastore (struct ast_sip_publication *publication, const char *name) |
Retrieve a publication datastore. More... | |
struct ao2_container * | ast_sip_publication_get_datastores (const struct ast_sip_publication *publication) |
Get the datastores container for a publication. More... | |
struct ast_sip_endpoint * | ast_sip_publication_get_endpoint (struct ast_sip_publication *pub) |
Given a publication, get the associated endpoint. More... | |
const char * | ast_sip_publication_get_event_configuration (const struct ast_sip_publication *pub) |
Given a publication, get the configuration name for the event type in use. More... | |
const char * | ast_sip_publication_get_resource (const struct ast_sip_publication *pub) |
Given a publication, get the resource the publication is to. More... | |
void | ast_sip_publication_remove_datastore (struct ast_sip_publication *publication, const char *name) |
Remove a publication datastore from the publication. More... | |
int | ast_sip_pubsub_generate_body_content (const char *content_type, const char *content_subtype, struct ast_sip_body_data *data, struct ast_str **str) |
Generate body content for a PUBLISH or NOTIFY. More... | |
int | ast_sip_pubsub_is_body_generator_registered (const char *type, const char *subtype) |
Is a body generator registered for the given type/subtype. More... | |
int | ast_sip_pubsub_register_body_generator (struct ast_sip_pubsub_body_generator *generator) |
Register a body generator with the pubsub core. More... | |
int | ast_sip_pubsub_register_body_supplement (struct ast_sip_pubsub_body_supplement *supplement) |
Register a body generator with the pubsub core. More... | |
void | ast_sip_pubsub_unregister_body_generator (struct ast_sip_pubsub_body_generator *generator) |
Unregister a body generator with the pubsub core. More... | |
void | ast_sip_pubsub_unregister_body_supplement (struct ast_sip_pubsub_body_supplement *supplement) |
Unregister a body generator with the pubsub core. More... | |
int | ast_sip_register_publish_handler (struct ast_sip_publish_handler *handler) |
Register a publish handler. More... | |
int | ast_sip_register_subscription_handler (struct ast_sip_subscription_handler *handler) |
Register a subscription handler. More... | |
int | ast_sip_subscription_add_datastore (struct ast_sip_subscription *subscription, struct ast_datastore *datastore) |
Add a datastore to a SIP subscription. More... | |
struct ast_datastore * | ast_sip_subscription_alloc_datastore (const struct ast_datastore_info *info, const char *uid) |
Alternative for ast_datastore_alloc() More... | |
void | ast_sip_subscription_destroy (struct ast_sip_subscription *sub) |
Alert the pubsub core that the subscription is ready for destruction. More... | |
const char * | ast_sip_subscription_get_body_subtype (struct ast_sip_subscription *sub) |
Get the body subtype used for this subscription. More... | |
const char * | ast_sip_subscription_get_body_type (struct ast_sip_subscription *sub) |
Get the body type used for this subscription. More... | |
struct ast_datastore * | ast_sip_subscription_get_datastore (struct ast_sip_subscription *subscription, const char *name) |
Retrieve a subscription datastore. More... | |
struct ao2_container * | ast_sip_subscription_get_datastores (const struct ast_sip_subscription *subscription) |
Get the datastores container for a subscription. More... | |
pjsip_dialog * | ast_sip_subscription_get_dialog (struct ast_sip_subscription *sub) |
Get the pjsip dialog that is associated with this subscription. More... | |
struct ast_sip_endpoint * | ast_sip_subscription_get_endpoint (struct ast_sip_subscription *sub) |
Get the endpoint that is associated with this subscription. More... | |
void * | ast_sip_subscription_get_header (const struct ast_sip_subscription *sub, const char *header) |
Get a header value for a subscription. More... | |
void | ast_sip_subscription_get_local_uri (struct ast_sip_subscription *sub, char *buf, size_t size) |
Retrieve the local URI for this subscription. More... | |
const struct ast_json * | ast_sip_subscription_get_persistence_data (const struct ast_sip_subscription *subscription) |
Retrieve persistence data for a subscription. More... | |
void | ast_sip_subscription_get_remote_uri (struct ast_sip_subscription *sub, char *buf, size_t size) |
Retrive the remote URI for this subscription. More... | |
const char * | ast_sip_subscription_get_resource_name (struct ast_sip_subscription *sub) |
Get the name of the subscribed resource. More... | |
struct ast_taskprocessor * | ast_sip_subscription_get_serializer (struct ast_sip_subscription *sub) |
Get the serializer for the subscription. More... | |
pjsip_sip_uri * | ast_sip_subscription_get_sip_uri (struct ast_sip_subscription *sub) |
Retrieve the local sip uri for this subscription. More... | |
int | ast_sip_subscription_is_terminated (const struct ast_sip_subscription *sub) |
Get whether the subscription has been terminated or not. More... | |
int | ast_sip_subscription_notify (struct ast_sip_subscription *sub, struct ast_sip_body_data *notify_data, int terminate) |
Notify a SIP subscription of a state change. More... | |
void | ast_sip_subscription_remove_datastore (struct ast_sip_subscription *subscription, const char *name) |
Remove a subscription datastore from the subscription. More... | |
int | ast_sip_subscription_send_request (struct ast_sip_subscription *sub, pjsip_tx_data *tdata) |
Send a request created via a PJSIP evsub method. More... | |
void | ast_sip_subscription_set_persistence_data (struct ast_sip_subscription *subscription, struct ast_json *persistence_data) |
Set persistence data for a subscription. More... | |
void | ast_sip_unregister_publish_handler (struct ast_sip_publish_handler *handler) |
Unregister a publish handler. More... | |
void | ast_sip_unregister_subscription_handler (struct ast_sip_subscription_handler *handler) |
Unregister a subscription handler. More... | |
#define AST_SIP_EXTEN_STATE_DATA "ast_sip_exten_state_data" |
Type used for extension state/presence
Definition at line 232 of file res_pjsip_pubsub.h.
Referenced by exten_state_publisher_cb(), and notify_task().
#define AST_SIP_MAX_ACCEPT 32 |
Definition at line 219 of file res_pjsip_pubsub.h.
Referenced by ast_sip_register_subscription_handler(), subscription_get_generator_from_rdata(), and subscription_persistence_remove().
#define AST_SIP_MESSAGE_ACCUMULATOR "ast_sip_message_accumulator" |
Type used for conveying mailbox state
Definition at line 234 of file res_pjsip_pubsub.h.
Referenced by send_mwi_notify(), and send_unsolicited_mwi_notify_to_contact().
Definition at line 37 of file res_pjsip_pubsub.h.
Definition at line 220 of file res_pjsip_pubsub.h.
Role for the subscription that is being created.
Enumerator | |
---|---|
AST_SIP_SUBSCRIBER | |
AST_SIP_NOTIFIER |
Definition at line 190 of file res_pjsip_pubsub.h.
struct ast_sip_subscription* ast_sip_create_subscription | ( | const struct ast_sip_subscription_handler * | handler, |
struct ast_sip_endpoint * | endpoint, | ||
const char * | resource | ||
) |
Create a new ast_sip_subscription structure.
When a subscriber wishes to create a subscription, it may call this function to allocate resources and to send the initial SUBSCRIBE out.
subscriber | The subscriber that is making the request. |
endpoint | The endpoint to whome the SUBSCRIBE will be sent. |
resource | The resource to place in the SUBSCRIBE's Request-URI. |
Definition at line 1868 of file res_pjsip_pubsub.c.
References add_subscription(), allocate_subscription(), allocate_subscription_tree(), ao2_cleanup, ao2_ref, ast_sip_endpoint::aors, ast_log, ast_sip_create_dialog_uac(), ast_sip_location_retrieve_contact_from_aor_list(), ast_sorcery_object_get_id(), ast_strlen_zero, resource_list::event, ast_sip_subscription_handler::event_name, sip_subscription_tree::evsub, LOG_WARNING, NULL, pubsub_cb, sub, subscription_setup_dialog(), and ast_sip_contact::uri.
int ast_sip_publication_add_datastore | ( | struct ast_sip_publication * | publication, |
struct ast_datastore * | datastore | ||
) |
Add a datastore to a SIP publication.
Note that SIP uses reference counted datastores. The datastore passed into this function must have been allocated using ao2_alloc() or there will be serious problems.
publication | The publication to add the datastore to |
datastore | The datastore to be added to the subscription |
0 | Success |
-1 | Failure |
Definition at line 2649 of file res_pjsip_pubsub.c.
References ast_datastores_add(), and ast_sip_publication::datastores.
struct ast_datastore* ast_sip_publication_get_datastore | ( | struct ast_sip_publication * | publication, |
const char * | name | ||
) |
Retrieve a publication datastore.
The datastore retrieved will have its reference count incremented. When the caller is done with the datastore, the reference counted needs to be decremented using ao2_ref().
publication | The publication from which to retrieve the datastore |
name | The name of the datastore to retrieve |
NULL | Failed to find the specified datastore |
non-NULL | The specified datastore |
Definition at line 2654 of file res_pjsip_pubsub.c.
References ast_datastores_find(), and ast_sip_publication::datastores.
struct ao2_container* ast_sip_publication_get_datastores | ( | const struct ast_sip_publication * | publication | ) |
Get the datastores container for a publication.
publication | The publication to get the datastores container from |
NULL | datastores container not present |
non-NULL | datastores container |
Definition at line 2664 of file res_pjsip_pubsub.c.
References ast_sip_publication::datastores.
struct ast_sip_endpoint* ast_sip_publication_get_endpoint | ( | struct ast_sip_publication * | pub | ) |
Given a publication, get the associated endpoint.
pub | The publication |
NULL | Failure |
non-NULL | The associated endpoint |
Definition at line 3420 of file res_pjsip_pubsub.c.
References ast_sip_publication::endpoint.
const char* ast_sip_publication_get_event_configuration | ( | const struct ast_sip_publication * | pub | ) |
Given a publication, get the configuration name for the event type in use.
pub | The publication |
Definition at line 3430 of file res_pjsip_pubsub.c.
References ast_sip_publication::event_configuration_name.
Referenced by asterisk_publication_devicestate_state_change(), and asterisk_publication_mwi_state_change().
const char* ast_sip_publication_get_resource | ( | const struct ast_sip_publication * | pub | ) |
Given a publication, get the resource the publication is to.
pub | The publication |
Definition at line 3425 of file res_pjsip_pubsub.c.
References ast_sip_publication::resource.
void ast_sip_publication_remove_datastore | ( | struct ast_sip_publication * | publication, |
const char * | name | ||
) |
Remove a publication datastore from the publication.
This operation may cause the datastore's free() callback to be called if the reference count reaches zero.
publication | The publication to remove the datastore from |
name | The name of the datastore to remove |
Definition at line 2659 of file res_pjsip_pubsub.c.
References ast_datastores_remove(), and ast_sip_publication::datastores.
int ast_sip_pubsub_generate_body_content | ( | const char * | content_type, |
const char * | content_subtype, | ||
struct ast_sip_body_data * | data, | ||
struct ast_str ** | str | ||
) |
Generate body content for a PUBLISH or NOTIFY.
content_type | The content type of the body | |
content_subtype | The content subtype of the body | |
data | The data associated with body generation. | |
[out] | str | The string representation of the generated body |
0 | Success |
non-zero | Failure |
Definition at line 3519 of file res_pjsip_pubsub.c.
References ast_sip_pubsub_body_generator::allocate_body, ast_log, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_sip_body_data::body_data, ast_sip_body_data::body_type, ast_sip_pubsub_body_generator::body_type, ast_sip_pubsub_body_generator::destroy_body, end, find_body_generator_type_subtype(), ast_sip_pubsub_body_generator::generate_body_content, generator, ast_sip_pubsub_body_generator::list, LOG_WARNING, ast_sip_pubsub_body_generator::subtype, ast_sip_pubsub_body_supplement::subtype, ast_sip_pubsub_body_supplement::supplement_body, ast_sip_pubsub_body_generator::to_string, ast_sip_pubsub_body_generator::type, and ast_sip_pubsub_body_supplement::type.
Referenced by ast_sip_subscription_notify(), exten_state_publisher_cb(), generate_initial_notify(), and send_unsolicited_mwi_notify_to_contact().
int ast_sip_pubsub_is_body_generator_registered | ( | const char * | type, |
const char * | subtype | ||
) |
Is a body generator registered for the given type/subtype.
type | The content type of the body |
subtype | The content subtype of the body |
non-zero | if a generator is registered. |
Definition at line 3435 of file res_pjsip_pubsub.c.
References find_body_generator_type_subtype().
Referenced by publisher_start().
int ast_sip_pubsub_register_body_generator | ( | struct ast_sip_pubsub_body_generator * | generator | ) |
Register a body generator with the pubsub core.
generator | Body generator to register |
0 | Success |
-1 | Failure |
Definition at line 3440 of file res_pjsip_pubsub.c.
References ast_alloca, AST_LIST_INSERT_HEAD, ast_log, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sip_get_pjsip_endpoint(), find_body_generator_type_subtype_nolock(), ast_sip_pubsub_body_generator::list, LOG_WARNING, NULL, pubsub_module, ast_sip_pubsub_body_generator::subtype, and ast_sip_pubsub_body_generator::type.
Referenced by load_module().
int ast_sip_pubsub_register_body_supplement | ( | struct ast_sip_pubsub_body_supplement * | supplement | ) |
Register a body generator with the pubsub core.
generator | Body generator to register |
0 | Success |
-1 | Failure |
Definition at line 3485 of file res_pjsip_pubsub.c.
References AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_sip_pubsub_body_generator::list.
Referenced by load_module().
void ast_sip_pubsub_unregister_body_generator | ( | struct ast_sip_pubsub_body_generator * | generator | ) |
Unregister a body generator with the pubsub core.
generator | Body generator to unregister |
Definition at line 3470 of file res_pjsip_pubsub.c.
References AST_LIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_sip_pubsub_body_generator::list.
Referenced by unload_module(), and unregister_all().
void ast_sip_pubsub_unregister_body_supplement | ( | struct ast_sip_pubsub_body_supplement * | supplement | ) |
Unregister a body generator with the pubsub core.
generator | Body generator to unregister |
Definition at line 3494 of file res_pjsip_pubsub.c.
References AST_LIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_sip_pubsub_body_supplement::list.
Referenced by unload_module().
int ast_sip_register_publish_handler | ( | struct ast_sip_publish_handler * | handler | ) |
Register a publish handler.
0 | Handler was registered successfully |
non-zero | Handler was not registered successfully |
Definition at line 2718 of file res_pjsip_pubsub.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ast_log, ast_strlen_zero, ast_sip_publish_handler::event_name, LOG_ERROR, NULL, publication_cmp_fn(), publication_hash_fn(), ast_sip_publish_handler::publications, PUBLICATIONS_BUCKETS, and publish_add_handler().
Referenced by load_module().
int ast_sip_register_subscription_handler | ( | struct ast_sip_subscription_handler * | handler | ) |
Register a subscription handler.
0 | Handler was registered successfully |
non-zero | Handler was not registered successfully |
Definition at line 2777 of file res_pjsip_pubsub.c.
References ast_sip_subscription_handler::accept, ast_log, AST_SIP_MAX_ACCEPT, ast_strlen_zero, DEFAULT_EXPIRES, resource_list::event, ast_sip_subscription_handler::event_name, find_sub_handler_for_event_name(), LOG_ERROR, pubsub_module, and sub_add_handler().
Referenced by load_module().
int ast_sip_subscription_add_datastore | ( | struct ast_sip_subscription * | subscription, |
struct ast_datastore * | datastore | ||
) |
Add a datastore to a SIP subscription.
Note that SIP uses reference counted datastores. The datastore passed into this function must have been allocated using ao2_alloc() or there will be serious problems.
subscription | The ssubscription to add the datastore to |
datastore | The datastore to be added to the subscription |
0 | Success |
-1 | Failure |
Definition at line 2629 of file res_pjsip_pubsub.c.
References ast_datastores_add(), and ast_sip_subscription::datastores.
Referenced by add_datastore(), and add_mwi_datastore().
struct ast_datastore* ast_sip_subscription_alloc_datastore | ( | const struct ast_datastore_info * | info, |
const char * | uid | ||
) |
Alternative for ast_datastore_alloc()
There are two major differences between this and ast_datastore_alloc() 1) This allocates a refcounted object 2) This will fill in a uid if one is not provided
DO NOT call ast_datastore_free() on a datastore allocated in this way since that function will attempt to free the datastore rather than play nicely with its refcount.
info | Callbacks for datastore |
uid | Identifier for datastore |
NULL | Failed to allocate datastore |
non-NULL | Newly allocated datastore |
Definition at line 2624 of file res_pjsip_pubsub.c.
References ast_datastores_alloc_datastore().
Referenced by add_datastore(), and add_mwi_datastore().
void ast_sip_subscription_destroy | ( | struct ast_sip_subscription * | sub | ) |
Alert the pubsub core that the subscription is ready for destruction.
sub | The subscription that is complete |
Definition at line 1389 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_sorcery_object_get_id(), sip_subscription_tree::endpoint, and ast_sip_subscription::tree.
Referenced by exten_state_subscription_destructor(), and mwi_subscription_destructor().
const char* ast_sip_subscription_get_body_subtype | ( | struct ast_sip_subscription * | sub | ) |
Get the body subtype used for this subscription.
Definition at line 3514 of file res_pjsip_pubsub.c.
References ast_sip_subscription::body_generator, and ast_sip_pubsub_body_generator::subtype.
Referenced by ast_sip_subscription_notify(), generate_initial_notify(), and generate_notify_body().
const char* ast_sip_subscription_get_body_type | ( | struct ast_sip_subscription * | sub | ) |
Get the body type used for this subscription.
Definition at line 3509 of file res_pjsip_pubsub.c.
References ast_sip_subscription::body_generator, and ast_sip_pubsub_body_generator::type.
Referenced by ast_sip_subscription_notify(), generate_initial_notify(), and generate_notify_body().
struct ast_datastore* ast_sip_subscription_get_datastore | ( | struct ast_sip_subscription * | subscription, |
const char * | name | ||
) |
Retrieve a subscription datastore.
The datastore retrieved will have its reference count incremented. When the caller is done with the datastore, the reference counted needs to be decremented using ao2_ref().
subscription | The subscription from which to retrieve the datastore |
name | The name of the datastore to retrieve |
NULL | Failed to find the specified datastore |
non-NULL | The specified datastore |
Definition at line 2634 of file res_pjsip_pubsub.c.
References ast_datastores_find(), and ast_sip_subscription::datastores.
Referenced by get_exten_state_sub(), mwi_get_notify_data(), mwi_subscription_shutdown(), and mwi_to_ami().
struct ao2_container* ast_sip_subscription_get_datastores | ( | const struct ast_sip_subscription * | subscription | ) |
Get the datastores container for a subscription.
subscription | The subscription to get the datastores container from |
NULL | datastores container not present |
non-NULL | datastores container |
Definition at line 2644 of file res_pjsip_pubsub.c.
References ast_sip_subscription::datastores.
Referenced by alloc_notify_task_data(), exten_state_data_alloc(), and notify_task().
pjsip_dialog* ast_sip_subscription_get_dialog | ( | struct ast_sip_subscription * | sub | ) |
Get the pjsip dialog that is associated with this subscription.
NULL | Could not get dialog |
non-NULL | The dialog |
Definition at line 1930 of file res_pjsip_pubsub.c.
References ast_assert, sip_subscription_tree::dlg, NULL, and ast_sip_subscription::tree.
Referenced by dialog_info_generate_body_content(), mwi_get_notify_data(), and send_mwi_notify().
struct ast_sip_endpoint* ast_sip_subscription_get_endpoint | ( | struct ast_sip_subscription * | sub | ) |
Get the endpoint that is associated with this subscription.
This function will increase the reference count of the endpoint. Be sure to release the reference to it when you are finished with the endpoint.
NULL | Could not get endpoint |
non-NULL | The endpoint |
Definition at line 1936 of file res_pjsip_pubsub.c.
References ao2_bump, ast_assert, sip_subscription_tree::endpoint, NULL, and ast_sip_subscription::tree.
Referenced by dialog_info_generate_body_content(), mwi_get_notify_data(), mwi_subscription_established(), send_mwi_notify(), and subscription_established().
void* ast_sip_subscription_get_header | ( | const struct ast_sip_subscription * | sub, |
const char * | header | ||
) |
Get a header value for a subscription.
For notifiers, the headers of the inbound SUBSCRIBE that started the dialog are stored on the subscription. This method allows access to the header. The return is the same as pjsip_msg_find_hdr_by_name(), meaning that it is dependent on the header being searched for.
sub | The subscription to search in. |
header | The name of the header to search for. |
Definition at line 1854 of file res_pjsip_pubsub.c.
References ast_sip_mod_data_get, sip_subscription_tree::dlg, MOD_DATA_MSG, name, NULL, pubsub_module, and ast_sip_subscription::tree.
Referenced by get_user_agent().
void ast_sip_subscription_get_local_uri | ( | struct ast_sip_subscription * | sub, |
char * | buf, | ||
size_t | size | ||
) |
Retrieve the local URI for this subscription.
This is the local URI of the subscribed resource.
sub | The subscription | |
[out] | buf | The buffer into which to store the URI. |
size | The size of the buffer. |
Definition at line 2578 of file res_pjsip_pubsub.c.
Referenced by build_rlmi_body(), exten_state_data_alloc(), and notify_task().
const struct ast_json* ast_sip_subscription_get_persistence_data | ( | const struct ast_sip_subscription * | subscription | ) |
Retrieve persistence data for a subscription.
subscription | The subscription to retrieve persistence data from |
Definition at line 2686 of file res_pjsip_pubsub.c.
Referenced by dialog_info_generate_body_content().
void ast_sip_subscription_get_remote_uri | ( | struct ast_sip_subscription * | sub, |
char * | buf, | ||
size_t | size | ||
) |
Retrive the remote URI for this subscription.
This is the remote URI as determined by the underlying SIP dialog.
sub | The subscription | |
[out] | buf | The buffer into which to store the URI. |
size | The size of the buffer. |
Definition at line 2583 of file res_pjsip_pubsub.c.
References sip_subscription_tree::dlg, and ast_sip_subscription::tree.
Referenced by exten_state_data_alloc(), and notify_task().
const char* ast_sip_subscription_get_resource_name | ( | struct ast_sip_subscription * | sub | ) |
Get the name of the subscribed resource.
Definition at line 2596 of file res_pjsip_pubsub.c.
Referenced by build_rlmi_body(), mwi_get_notify_data(), mwi_subscription_established(), remove_subscription(), send_mwi_notify(), and subscription_established().
struct ast_taskprocessor* ast_sip_subscription_get_serializer | ( | struct ast_sip_subscription * | sub | ) |
Get the serializer for the subscription.
Tasks that originate outside of a SIP servant thread should get the serializer and push the task to the serializer.
sub | The subscription |
NULL | Failure |
non-NULL | The subscription's serializer |
Definition at line 1942 of file res_pjsip_pubsub.c.
References ast_assert, NULL, sip_subscription_tree::serializer, and ast_sip_subscription::tree.
Referenced by exten_state_subscription_alloc(), and send_notify().
pjsip_sip_uri* ast_sip_subscription_get_sip_uri | ( | struct ast_sip_subscription * | sub | ) |
Retrieve the local sip uri for this subscription.
This is the local sip URI of the subscribed resource.
sub | The subscription |
NULL | Could not get uri |
non-NULL | The local pjsip_sip_uri |
Definition at line 2573 of file res_pjsip_pubsub.c.
Referenced by mwi_get_notify_data(), and send_mwi_notify().
int ast_sip_subscription_is_terminated | ( | const struct ast_sip_subscription * | sub | ) |
Get whether the subscription has been terminated or not.
sub | The subscription. |
0 | not terminated. |
1 | terminated. |
Definition at line 2601 of file res_pjsip_pubsub.c.
Referenced by notify_task().
int ast_sip_subscription_notify | ( | struct ast_sip_subscription * | sub, |
struct ast_sip_body_data * | notify_data, | ||
int | terminate | ||
) |
Notify a SIP subscription of a state change.
This tells the pubsub core that the state of a subscribed resource has changed. The pubsub core will generate an appropriate NOTIFY request to send to the subscriber.
sub | The subscription on which a state change is occurring. |
notify_data | Event package-specific data used to create the NOTIFY body. |
terminate | True if this NOTIFY is intended to terminate the subscription. |
0 | Success |
non-zero | Failure |
Definition at line 2529 of file res_pjsip_pubsub.c.
References ao2_ref, ast_sip_pubsub_generate_body_content(), ast_sip_subscription_get_body_subtype(), ast_sip_subscription_get_body_type(), ast_test_suite_event_notify, sip_subscription_tree::dlg, sip_subscription_tree::notification_batch_interval, sip_subscription_tree::root, schedule_notification(), send_notify(), SIP_SUB_TREE_NORMAL, SIP_SUB_TREE_TERMINATE_IN_PROGRESS, SIP_SUB_TREE_TERMINATE_PENDING, sip_subscription_tree::state, and ast_sip_subscription::tree.
Referenced by notify_task(), and send_mwi_notify().
void ast_sip_subscription_remove_datastore | ( | struct ast_sip_subscription * | subscription, |
const char * | name | ||
) |
Remove a subscription datastore from the subscription.
This operation may cause the datastore's free() callback to be called if the reference count reaches zero.
subscription | The subscription to remove the datastore from |
name | The name of the datastore to remove |
Definition at line 2639 of file res_pjsip_pubsub.c.
References ast_datastores_remove(), and ast_sip_subscription::datastores.
Referenced by mwi_subscription_established(), mwi_subscription_shutdown(), and subscription_shutdown().
int ast_sip_subscription_send_request | ( | struct ast_sip_subscription * | sub, |
pjsip_tx_data * | tdata | ||
) |
Send a request created via a PJSIP evsub method.
Callers of this function should take care to do so within a SIP servant thread.
sub | The subscription on which to send the request |
tdata | The request to send |
0 | Success |
non-zero | Failure |
void ast_sip_subscription_set_persistence_data | ( | struct ast_sip_subscription * | subscription, |
struct ast_json * | persistence_data | ||
) |
Set persistence data for a subscription.
subscription | The subscription to set persistence data on |
persistence_data | The persistence data to set |
Definition at line 2669 of file res_pjsip_pubsub.c.
References ast_json_object_create(), ast_json_object_set(), ast_json_ref(), ast_json_unref(), subscription_persistence::generator_data, sip_subscription_tree::persistence, and ast_sip_subscription::tree.
Referenced by dialog_info_generate_body_content().
void ast_sip_unregister_publish_handler | ( | struct ast_sip_publish_handler * | handler | ) |
Unregister a publish handler.
Definition at line 2738 of file res_pjsip_pubsub.c.
References ao2_cleanup, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sip_publish_handler::next, and ast_sip_publish_handler::publications.
Referenced by load_module(), and unload_module().
void ast_sip_unregister_subscription_handler | ( | struct ast_sip_subscription_handler * | handler | ) |
Unregister a subscription handler.
Definition at line 2810 of file res_pjsip_pubsub.c.
References AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_sip_subscription_handler::next.
Referenced by unload_module().