Asterisk - The Open Source Telephony Project GIT-master-d856a3e
|
#include "asterisk.h"
#include <pjsip.h>
#include <pjsip_simple.h>
#include <pjlib.h>
#include "asterisk/mwi.h"
#include "asterisk/res_pjsip_pubsub.h"
#include "asterisk/module.h"
#include "asterisk/linkedlists.h"
#include "asterisk/astobj2.h"
#include "asterisk/datastore.h"
#include "asterisk/uuid.h"
#include "asterisk/taskprocessor.h"
#include "asterisk/sched.h"
#include "asterisk/res_pjsip.h"
#include "asterisk/callerid.h"
#include "asterisk/manager.h"
#include "asterisk/cli.h"
#include "asterisk/test.h"
#include "res_pjsip/include/res_pjsip_private.h"
#include "asterisk/res_pjsip_presence_xml.h"
Go to the source code of this file.
Data Structures | |
struct | ast_sip_publication |
Structure representing a SIP publication. More... | |
struct | ast_sip_publication_resource |
Structure representing a publication resource. More... | |
struct | ast_sip_subscription |
Structure representing a "virtual" SIP subscription. More... | |
struct | body_generators |
struct | body_part |
A multipart body part and meta-information. More... | |
struct | body_part_list |
Type declaration for container of body part structures. More... | |
struct | body_supplements |
struct | cli_sub_complete_parms |
struct | cli_sub_parms |
struct | initial_notify_data |
struct | persistence_recreate_data |
struct | publish_handlers |
struct | resource_list |
Resource list configuration item. More... | |
struct | resource_tree |
A resource tree. More... | |
struct | resources |
A vector of strings commonly used throughout this module. More... | |
struct | simple_message_summary |
struct | sip_subscription_tree |
A tree of SIP subscriptions. More... | |
struct | subscription_handlers |
struct | subscription_persistence |
Structure used for persisting an inbound subscription. More... | |
struct | subscriptions |
struct | tree_node |
A node for a resource tree. More... | |
Macros | |
#define | AMI_SHOW_SUBSCRIPTIONS_INBOUND "PJSIPShowSubscriptionsInbound" |
#define | AMI_SHOW_SUBSCRIPTIONS_OUTBOUND "PJSIPShowSubscriptionsOutbound" |
#define | CLI_LIST_SUB_FORMAT_ENTRY "%-30.30s %-30.30s %6d %s\n" |
#define | CLI_LIST_SUB_FORMAT_HEADER "%-30.30s %-30.30s %6.6s %s\n" |
#define | CLI_SHOW_SUB_FORMAT_ENTRY |
#define | CLI_SHOW_SUB_FORMAT_HEADER |
#define | DATASTORE_BUCKETS 53 |
Number of buckets for subscription datastore. More... | |
#define | DEFAULT_EXPIRES 3600 |
Default expiration for subscriptions. More... | |
#define | DEFAULT_PUBLISH_EXPIRES 3600 |
Default expiration time for PUBLISH if one is not specified. More... | |
#define | MAX_REGEX_ERROR_LEN 128 |
#define | MOD_DATA_MSG "sub_msg" |
#define | MOD_DATA_PERSISTENCE "sub_persistence" |
#define | NEW_SUBSCRIBE(notifier, endpoint, resource, rdata) notifier->new_subscribe_with_rdata ? notifier->new_subscribe_with_rdata(endpoint, resource, rdata) : notifier->new_subscribe(endpoint, resource) |
#define | PUBLICATIONS_BUCKETS 37 |
Number of buckets for publications (on a per handler) More... | |
#define | RESOURCE_LIST_INIT_SIZE 4 |
Typedefs | |
typedef int(* | on_subscription_t) (struct sip_subscription_tree *sub, void *arg) |
Enumerations | |
enum | sip_persistence_update_type { SUBSCRIPTION_PERSISTENCE_SEND_REQUEST = 0 , SUBSCRIPTION_PERSISTENCE_CREATED , SUBSCRIPTION_PERSISTENCE_RECREATED , SUBSCRIPTION_PERSISTENCE_REFRESHED } |
enum | sip_publish_type { SIP_PUBLISH_UNKNOWN , SIP_PUBLISH_INITIAL , SIP_PUBLISH_REFRESH , SIP_PUBLISH_MODIFY , SIP_PUBLISH_REMOVE } |
The types of PUBLISH messages defined in RFC 3903. More... | |
enum | sip_subscription_tree_state { SIP_SUB_TREE_NORMAL = 0 , SIP_SUB_TREE_TERMINATE_PENDING , SIP_SUB_TREE_TERMINATE_IN_PROGRESS , SIP_SUB_TREE_TERMINATED } |
The state of the subscription tree. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static void | add_rlmi_resource (pj_pool_t *pool, pj_xml_node *rlmi, const pjsip_generic_string_hdr *cid, const char *resource_name, const pjsip_sip_uri *resource_uri, pjsip_evsub_state state) |
Add a resource XML element to an RLMI body. More... | |
static void | add_subscription (struct sip_subscription_tree *obj) |
static struct body_part * | allocate_body_part (pj_pool_t *pool, const struct ast_sip_subscription *sub) |
Allocate and initialize a body part structure. More... | |
static struct ast_sip_subscription * | allocate_subscription (const struct ast_sip_subscription_handler *handler, const char *resource, const char *display_name, struct sip_subscription_tree *tree) |
static struct sip_subscription_tree * | allocate_subscription_tree (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata) |
static int | allocate_tdata_buffer (pjsip_tx_data *tdata) |
Pre-allocate a buffer for the transmission. More... | |
static int | ami_show_resource_lists (struct mansession *s, const struct message *m) |
static int | ami_show_subscriptions_inbound (struct mansession *s, const struct message *m) |
static int | ami_show_subscriptions_outbound (struct mansession *s, const struct message *m) |
static int | ami_subscription_detail (struct sip_subscription_tree *sub_tree, struct ast_sip_ami *ami, const char *event) |
static int | ami_subscription_detail_inbound (struct sip_subscription_tree *sub_tree, void *arg) |
static int | ami_subscription_detail_outbound (struct sip_subscription_tree *sub_tree, void *arg) |
static int | apply_list_configuration (struct ast_sorcery *sorcery) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
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 *type, const char *subtype, struct ast_sip_body_data *data, struct ast_str **str) |
Generate body content for a PUBLISH or NOTIFY. More... | |
static int | ast_sip_pubsub_has_eventlist_support (pjsip_rx_data *rdata) |
Check if the rdata has a Supported header containing 'eventlist'. 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... | |
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... | |
static void | build_body_part (pj_pool_t *pool, struct ast_sip_subscription *sub, struct body_part_list *parts, unsigned int use_full_state) |
Create a multipart body part for a subscribed resource. More... | |
static void | build_node_children (struct ast_sip_endpoint *endpoint, const struct ast_sip_subscription_handler *handler, struct resource_list *list, struct tree_node *parent, struct resources *visited, pjsip_rx_data *rdata) |
Build child nodes for a given parent. More... | |
static int | build_resource_tree (struct ast_sip_endpoint *endpoint, const struct ast_sip_subscription_handler *handler, const char *resource, struct resource_tree *tree, int has_eventlist_support, pjsip_rx_data *rdata) |
Build a resource tree. More... | |
static pjsip_multipart_part * | build_rlmi_body (pj_pool_t *pool, struct ast_sip_subscription *sub, struct body_part_list *body_parts, unsigned int full_state) |
Create an RLMI body part for a multipart resource list body. More... | |
static void | clean_sub_tree (pjsip_evsub *evsub) |
Callback sequence for subscription terminate: More... | |
static char * | cli_complete_subscription_callid (struct ast_cli_args *a) |
static int | cli_complete_subscription_common (struct sip_subscription_tree *sub_tree, struct cli_sub_complete_parms *cli) |
static int | cli_complete_subscription_inbound (struct sip_subscription_tree *sub_tree, void *arg) |
static int | cli_complete_subscription_outbound (struct sip_subscription_tree *sub_tree, void *arg) |
static int | cli_list_subscriptions_detail (struct sip_subscription_tree *sub_tree, struct cli_sub_parms *cli) |
static int | cli_list_subscriptions_inbound (struct sip_subscription_tree *sub_tree, void *arg) |
static char * | cli_list_subscriptions_inout (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | cli_list_subscriptions_outbound (struct sip_subscription_tree *sub_tree, void *arg) |
static int | cli_show_subscription_common (struct sip_subscription_tree *sub_tree, struct cli_sub_parms *cli) |
static int | cli_show_subscription_inbound (struct sip_subscription_tree *sub_tree, void *arg) |
static char * | cli_show_subscription_inout (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | cli_show_subscription_outbound (struct sip_subscription_tree *sub_tree, void *arg) |
static int | cli_show_subscriptions_detail (struct sip_subscription_tree *sub_tree, struct cli_sub_parms *cli) |
static int | cli_show_subscriptions_inbound (struct sip_subscription_tree *sub_tree, void *arg) |
static char * | cli_show_subscriptions_inout (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | cli_show_subscriptions_outbound (struct sip_subscription_tree *sub_tree, void *arg) |
static unsigned int | cli_subscription_expiry (struct sip_subscription_tree *sub_tree) |
static int | cmp_strings (char *s1, char *s2) |
Compare strings for equality checking for NULL. More... | |
static int | cmp_subscription_childrens (struct ast_sip_subscription *s1, struct ast_sip_subscription *s2) |
compares the childrens of two ast_sip_subscription s1 and s2 More... | |
static pjsip_msg_body * | create_multipart_body (pj_pool_t *pool) |
Create and initialize the PJSIP multipart body structure for a resource list subscription. More... | |
static pjsip_require_hdr * | create_require_eventlist (pj_pool_t *pool) |
Shortcut method to create a Require: eventlist header. More... | |
static struct sip_subscription_tree * | create_subscription_tree (const struct ast_sip_subscription_handler *handler, struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *resource, struct ast_sip_pubsub_body_generator *generator, struct resource_tree *tree, pj_status_t *dlg_status, struct subscription_persistence *persistence) |
Create a subscription tree based on a resource tree. More... | |
static struct ast_sip_subscription * | create_virtual_subscriptions (const struct ast_sip_subscription_handler *handler, const char *resource, struct ast_sip_pubsub_body_generator *generator, struct sip_subscription_tree *tree, struct tree_node *current) |
Create a tree of virtual subscriptions based on a resource tree node. More... | |
static void | destroy_subscription (struct ast_sip_subscription *sub) |
static void | destroy_subscriptions (struct ast_sip_subscription *root) |
static int | destroy_subscriptions_task (void *obj) |
static enum sip_publish_type | determine_sip_publish_type (pjsip_rx_data *rdata, pjsip_generic_string_hdr *etag_hdr, unsigned int *expires, int *entity_id) |
static int | exceptional_accept (const pj_str_t *accept) |
Is the Accept header from the SUBSCRIBE in the list of exceptions? More... | |
static struct ast_sip_pubsub_body_generator * | find_body_generator (char accept[AST_SIP_MAX_ACCEPT][64], size_t num_accept, const char *body_type) |
static struct ast_sip_pubsub_body_generator * | find_body_generator_accept (const char *accept) |
static struct ast_sip_pubsub_body_generator * | find_body_generator_type_subtype (const char *type, const char *subtype) |
static struct ast_sip_pubsub_body_generator * | find_body_generator_type_subtype_nolock (const char *type, const char *subtype) |
static struct ast_sip_publish_handler * | find_pub_handler (const char *event) |
static struct ast_sip_subscription_handler * | find_sub_handler_for_event_name (const char *event_name) |
static int | for_each_subscription (on_subscription_t on_subscription, void *arg) |
static int | format_ami_resource_lists (void *obj, void *arg, int flags) |
static void | free_body_parts (struct body_part_list *parts) |
Destroy a list of body parts. More... | |
static pjsip_generic_string_hdr * | generate_content_id_hdr (pj_pool_t *pool, const struct ast_sip_subscription *sub) |
Create a Content-ID header. More... | |
static int | generate_initial_notify (struct ast_sip_subscription *sub) |
static pjsip_msg_body * | generate_list_body (pj_pool_t *pool, struct ast_sip_subscription *sub, unsigned int force_full_state) |
Create a resource list body for NOTIFY requests. More... | |
static pjsip_msg_body * | generate_notify_body (pj_pool_t *pool, struct ast_sip_subscription *root, unsigned int force_full_state) |
Create the body for a NOTIFY request. More... | |
static int | have_visited (const char *resource, struct resources *visited) |
Determine if this resource has been visited already. More... | |
static int | initial_notify_task (void *obj) |
static int | item_in_vector (const struct resource_list *list, const char *item) |
static int | list_item_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | list_item_to_str (const void *obj, const intptr_t *args, char **buf) |
static int | load_module (void) |
static int | parse_simple_message_summary (char *body, struct simple_message_summary *summary) |
static int | persistence_endpoint_str2struct (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | persistence_endpoint_struct2str (const void *obj, const intptr_t *args, char **buf) |
static int | persistence_expires_str2struct (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | persistence_expires_struct2str (const void *obj, const intptr_t *args, char **buf) |
static int | persistence_generator_data_str2struct (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | persistence_generator_data_struct2str (const void *obj, const intptr_t *args, char **buf) |
static int | persistence_tag_str2struct (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | persistence_tag_struct2str (const void *obj, const intptr_t *args, char **buf) |
static int | publication_cmp_fn (void *obj, void *arg, int flags) |
static void | publication_destroy_fn (void *obj) |
Internal destructor for publications. More... | |
static int | publication_hash_fn (const void *obj, const int flags) |
static void * | publication_resource_alloc (const char *name) |
Allocator for publication resource. More... | |
static void | publication_resource_destroy (void *obj) |
Destructor for publication resource. More... | |
static void | publish_add_handler (struct ast_sip_publish_handler *handler) |
static int | publish_expire (const void *data) |
static int | publish_expire_callback (void *data) |
static struct ast_sip_publication * | publish_request_initial (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, struct ast_sip_publish_handler *handler) |
static void | pubsub_on_client_refresh (pjsip_evsub *sub) |
static void | pubsub_on_evsub_state (pjsip_evsub *evsub, pjsip_event *event) |
PJSIP callback when underlying SIP subscription changes state. More... | |
static int | pubsub_on_refresh_timeout (void *userdata) |
static pj_bool_t | pubsub_on_rx_mwi_notify_request (pjsip_rx_data *rdata) |
static void | pubsub_on_rx_notify (pjsip_evsub *sub, pjsip_rx_data *rdata, int *p_st_code, pj_str_t **p_st_text, pjsip_hdr *res_hdr, pjsip_msg_body **p_body) |
static pj_bool_t | pubsub_on_rx_notify_request (pjsip_rx_data *rdata) |
static pj_bool_t | pubsub_on_rx_publish_request (pjsip_rx_data *rdata) |
static void | pubsub_on_rx_refresh (pjsip_evsub *evsub, pjsip_rx_data *rdata, int *p_st_code, pj_str_t **p_st_text, pjsip_hdr *res_hdr, pjsip_msg_body **p_body) |
Called whenever an in-dialog SUBSCRIBE is received. More... | |
static pj_bool_t | pubsub_on_rx_request (pjsip_rx_data *rdata) |
Opaque structure representing an RFC 3265 SIP subscription. More... | |
static pj_bool_t | pubsub_on_rx_subscribe_request (pjsip_rx_data *rdata) |
static void | pubsub_on_server_timeout (pjsip_evsub *sub) |
static void | remove_subscription (struct sip_subscription_tree *obj) |
static int | resource_endpoint_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | resource_event_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static void * | resource_list_alloc (const char *name) |
static int | resource_list_apply_handler (const struct ast_sorcery *sorcery, void *obj) |
static void | resource_list_destructor (void *obj) |
static void | resource_tree_destroy (struct resource_tree *tree) |
Destroy a resource tree. More... | |
static struct resource_list * | retrieve_resource_list (const char *resource, const char *event) |
Helper function for retrieving a resource list for a given event. More... | |
static void * | rlmi_clone_data (pj_pool_t *pool, const void *data, unsigned len) |
static int | rlmi_print_body (struct pjsip_msg_body *msg_body, char *buf, pj_size_t size) |
static int | sched_cb (const void *data) |
static int | schedule_notification (struct sip_subscription_tree *sub_tree) |
static int | send_notify (struct sip_subscription_tree *sub_tree, unsigned int force_full_state) |
Send a NOTIFY request to a subscriber. More... | |
static int | serialized_pubsub_on_client_refresh (void *userdata) |
static int | serialized_pubsub_on_refresh_timeout (void *userdata) |
static int | serialized_send_notify (void *userdata) |
static void | set_state_terminated (struct ast_sip_subscription *sub) |
static void | shutdown_subscriptions (struct ast_sip_subscription *sub) |
static struct ast_sip_publication * | sip_create_publication (struct ast_sip_endpoint *endpoint, pjsip_rx_data *rdata, const char *resource, const char *event_configuration_name) |
static int | sip_publication_respond (struct ast_sip_publication *pub, int status_code, pjsip_rx_data *rdata) |
static int | sip_subscription_accept (struct sip_subscription_tree *sub_tree, pjsip_rx_data *rdata, int response) |
static int | sip_subscription_send_request (struct sip_subscription_tree *sub_tree, pjsip_tx_data *tdata) |
static void | sip_subscription_to_ami (struct sip_subscription_tree *sub_tree, struct ast_str **buf) |
static void | sub_add_handler (struct ast_sip_subscription_handler *handler) |
static int | sub_persistence_recreate (void *obj) |
static int | sub_tree_subscription_terminate_cb (void *data) |
static void | sub_tree_transport_cb (void *data) |
static struct ast_sip_pubsub_body_generator * | subscription_get_generator_from_rdata (pjsip_rx_data *rdata, const struct ast_sip_subscription_handler *handler) |
Retrieve a body generator using the Accept header of an rdata message. More... | |
static struct ast_sip_subscription_handler * | subscription_get_handler_from_rdata (pjsip_rx_data *rdata, const char *endpoint) |
Retrieve a handler using the Event header of an rdata message. More... | |
static void * | subscription_persistence_alloc (const char *name) |
Allocator for subscription persistence. More... | |
static struct subscription_persistence * | subscription_persistence_create (struct sip_subscription_tree *sub_tree) |
Function which creates initial persistence information of a subscription in sorcery. More... | |
static void | subscription_persistence_destroy (void *obj) |
Destructor for subscription persistence. More... | |
static void | subscription_persistence_event_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Event callback which fires subscription persistence recreation when the system is fully booted. More... | |
static int | subscription_persistence_load (void *data) |
Function which loads and recreates persisted subscriptions upon startup when the system is fully booted. More... | |
static int | subscription_persistence_recreate (void *obj, void *arg, int flags) |
Callback function to perform the actual recreation of a subscription. More... | |
static void | subscription_persistence_remove (struct sip_subscription_tree *sub_tree) |
Function which removes persistence of a subscription from sorcery. More... | |
static void | subscription_persistence_update (struct sip_subscription_tree *sub_tree, pjsip_rx_data *rdata, enum sip_persistence_update_type type) |
Function which updates persistence information of a subscription in sorcery. More... | |
static void | subscription_setup_dialog (struct sip_subscription_tree *sub_tree, pjsip_dialog *dlg) |
static void | subscription_tree_destructor (void *obj) |
static int | subscription_unreference_dialog (void *obj) |
static struct tree_node * | tree_node_alloc (const char *resource, struct resources *visited, unsigned int full_state, const char *display_name) |
Allocate a tree node. More... | |
static void | tree_node_destroy (struct tree_node *node) |
Destructor for a tree node. More... | |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "PJSIP event resource" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_CHANNEL_DEPEND, .requires = "res_pjsip", } |
const char * | accept_exceptions [] |
Accept headers that are exceptions to the rule. More... | |
static const struct ast_module_info * | ast_module_info = &__mod_info |
struct body_generators | body_generators = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
struct body_supplements | body_supplements = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static struct ast_cli_entry | cli_commands [] |
static int | esc_etag_counter |
const pjsip_method | pjsip_publish_method |
Defined method for PUBLISH. More... | |
struct publish_handlers | publish_handlers = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static pjsip_evsub_user | pubsub_cb |
static struct pjsip_module | pubsub_module |
static pjsip_media_type | rlmi_media_type |
static struct ast_sched_context * | sched |
Scheduler used for automatically expiring publications. More... | |
static const char * | sip_subscription_roles_map [] |
static const pj_str_t | str_event_name = { "Event", 5 } |
static char * | sub_tree_state_description [] |
struct subscription_handlers | subscription_handlers = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
struct subscriptions | subscriptions = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
#define AMI_SHOW_SUBSCRIPTIONS_INBOUND "PJSIPShowSubscriptionsInbound" |
Definition at line 4374 of file res_pjsip_pubsub.c.
#define AMI_SHOW_SUBSCRIPTIONS_OUTBOUND "PJSIPShowSubscriptionsOutbound" |
Definition at line 4375 of file res_pjsip_pubsub.c.
#define CLI_LIST_SUB_FORMAT_ENTRY "%-30.30s %-30.30s %6d %s\n" |
Definition at line 4761 of file res_pjsip_pubsub.c.
#define CLI_LIST_SUB_FORMAT_HEADER "%-30.30s %-30.30s %6.6s %s\n" |
Definition at line 4760 of file res_pjsip_pubsub.c.
#define CLI_SHOW_SUB_FORMAT_ENTRY |
Definition at line 4618 of file res_pjsip_pubsub.c.
#define CLI_SHOW_SUB_FORMAT_HEADER |
Definition at line 4613 of file res_pjsip_pubsub.c.
#define DATASTORE_BUCKETS 53 |
Number of buckets for subscription datastore.
Definition at line 259 of file res_pjsip_pubsub.c.
#define DEFAULT_EXPIRES 3600 |
Default expiration for subscriptions.
Definition at line 262 of file res_pjsip_pubsub.c.
#define DEFAULT_PUBLISH_EXPIRES 3600 |
Default expiration time for PUBLISH if one is not specified.
Definition at line 256 of file res_pjsip_pubsub.c.
#define MAX_REGEX_ERROR_LEN 128 |
Definition at line 4377 of file res_pjsip_pubsub.c.
#define MOD_DATA_MSG "sub_msg" |
Definition at line 245 of file res_pjsip_pubsub.c.
#define MOD_DATA_PERSISTENCE "sub_persistence" |
Definition at line 244 of file res_pjsip_pubsub.c.
#define NEW_SUBSCRIBE | ( | notifier, | |
endpoint, | |||
resource, | |||
rdata | |||
) | notifier->new_subscribe_with_rdata ? notifier->new_subscribe_with_rdata(endpoint, resource, rdata) : notifier->new_subscribe(endpoint, resource) |
Definition at line 1021 of file res_pjsip_pubsub.c.
#define PUBLICATIONS_BUCKETS 37 |
Number of buckets for publications (on a per handler)
Definition at line 253 of file res_pjsip_pubsub.c.
#define RESOURCE_LIST_INIT_SIZE 4 |
Definition at line 4993 of file res_pjsip_pubsub.c.
typedef int(* on_subscription_t) (struct sip_subscription_tree *sub, void *arg) |
Definition at line 1839 of file res_pjsip_pubsub.c.
Definition at line 540 of file res_pjsip_pubsub.c.
enum sip_publish_type |
The types of PUBLISH messages defined in RFC 3903.
Definition at line 274 of file res_pjsip_pubsub.c.
The state of the subscription tree.
Definition at line 415 of file res_pjsip_pubsub.c.
|
static |
Definition at line 5960 of file res_pjsip_pubsub.c.
|
static |
Definition at line 5960 of file res_pjsip_pubsub.c.
|
static |
Add a resource XML element to an RLMI body.
Each resource element represents a subscribed resource in the list. This function currently will unconditionally add an instance element to each created resource element. Instance elements refer to later parts in the multipart body.
pool | PJLIB allocation pool |
rlmi | |
cid | Content-ID header of the resource |
resource_name | Name of the resource |
resource_uri | URI of the resource |
state | State of the subscribed resource |
Definition at line 2071 of file res_pjsip_pubsub.c.
References ast_generate_random_string(), ast_sip_presence_xml_create_attr(), ast_sip_presence_xml_create_node(), ast_sip_sanitize_xml(), and name.
Referenced by build_rlmi_body().
|
static |
Definition at line 1204 of file res_pjsip_pubsub.c.
References AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, and AST_RWLIST_WRLOCK.
Referenced by ast_sip_create_subscription(), and create_subscription_tree().
|
static |
Allocate and initialize a body part structure.
pool | PJLIB allocation pool |
sub | Subscription representing a subscribed resource |
Definition at line 2279 of file res_pjsip_pubsub.c.
References ast_calloc, body_part::cid, body_part::display_name, generate_content_id_hdr(), NULL, body_part::resource, body_part::state, sub, and body_part::uri.
Referenced by build_body_part().
|
static |
Definition at line 1263 of file res_pjsip_pubsub.c.
References ao2_bump, ast_calloc, ast_datastores_alloc(), ast_json_object_get(), ast_json_ref(), ast_log, ast_sip_mod_data_get, ast_str_create, ast_strdup, destroy_subscription(), ast_sip_subscription::display_name, sip_subscription_tree::dlg, subscription_persistence::generator_data, handler(), LOG_ERROR, MOD_DATA_MSG, NULL, sip_subscription_tree::persistence, pubsub_module, ast_sip_subscription::resource, sub, and ast_sip_subscription::tree.
Referenced by ast_sip_create_subscription(), and create_virtual_subscriptions().
|
static |
Definition at line 1445 of file res_pjsip_pubsub.c.
References ao2_alloc, ao2_bump, ao2_ref, ast_module_ref, ast_sip_create_serializer(), ast_sip_get_distributor_serializer(), ast_sorcery_object_get_id(), ast_taskprocessor_build_name(), AST_TASKPROCESSOR_MAX_NAME, sip_subscription_tree::endpoint, sip_subscription_tree::notify_sched_id, NULL, ast_module_info::self, sip_subscription_tree::serializer, and subscription_tree_destructor().
Referenced by ast_sip_create_subscription(), and create_subscription_tree().
|
static |
Pre-allocate a buffer for the transmission.
Typically, we let PJSIP do this step for us when we send a request. PJSIP's buffer allocation algorithm is to allocate a buffer of PJSIP_MAX_PKT_LEN bytes and attempt to write the packet to the allocated buffer. If the buffer is too small to hold the packet, then we get told the message is too long to be sent.
When dealing with SIP NOTIFY, especially with RLS, it is possible to exceed PJSIP_MAX_PKT_LEN. Rather than accepting the limitation imposed on us by default, we instead take the strategy of pre-allocating the buffer, testing for ourselves if the message will fit, and resizing the buffer as required.
The limit we impose is double that of the maximum packet length.
tdata | The tdata onto which to allocate a buffer |
0 | Success |
-1 | The message is too large |
Definition at line 2008 of file res_pjsip_pubsub.c.
References buf.
Referenced by sip_subscription_send_request().
|
static |
Definition at line 4351 of file res_pjsip_pubsub.c.
References ao2_callback, ao2_container_count(), AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), astman_get_header(), astman_send_error(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), ast_sip_ami::count, format_ami_resource_lists(), ast_sip_ami::m, NULL, OBJ_NODATA, and ast_sip_ami::s.
Referenced by load_module().
|
static |
Definition at line 4301 of file res_pjsip_pubsub.c.
References ami_subscription_detail_inbound(), astman_get_header(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), ast_sip_ami::count, for_each_subscription(), ast_sip_ami::m, and ast_sip_ami::s.
Referenced by load_module().
|
static |
Definition at line 4315 of file res_pjsip_pubsub.c.
References ami_subscription_detail_outbound(), astman_get_header(), astman_send_list_complete_end(), astman_send_list_complete_start(), astman_send_listack(), ast_sip_ami::count, for_each_subscription(), ast_sip_ami::m, and ast_sip_ami::s.
Referenced by load_module().
|
static |
Definition at line 4270 of file res_pjsip_pubsub.c.
References ast_free, ast_sip_create_ami_event(), ast_str_buffer(), astman_append(), buf, ast_sip_ami::count, ast_sip_ami::s, and sip_subscription_to_ami().
Referenced by ami_subscription_detail_inbound(), and ami_subscription_detail_outbound().
|
static |
Definition at line 4289 of file res_pjsip_pubsub.c.
References ami_subscription_detail(), AST_SIP_NOTIFIER, and sip_subscription_tree::role.
Referenced by ami_show_subscriptions_inbound().
|
static |
Definition at line 4295 of file res_pjsip_pubsub.c.
References ami_subscription_detail(), AST_SIP_SUBSCRIBER, and sip_subscription_tree::role.
Referenced by ami_show_subscriptions_outbound().
|
static |
Definition at line 5100 of file res_pjsip_pubsub.c.
References ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_register, ast_sorcery_reload_object(), CHARFLDSET, FLDSET, resource_list::full_state, list_item_handler(), list_item_to_str(), resource_list::notification_batch_interval, NULL, OPT_BOOL_T, OPT_CHAR_ARRAY_T, OPT_NOOP_T, OPT_UINT_T, resource_list::resource_display_name, resource_list_alloc(), resource_list_apply_handler(), and sorcery.
Referenced by load_module().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 5960 of file res_pjsip_pubsub.c.
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.
handler | 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 1909 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(), sip_subscription_tree::dlg, sip_subscription_tree::endpoint, sip_subscription_tree::evsub, handler(), 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 2713 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 2718 of file res_pjsip_pubsub.c.
References ast_datastores_find(), ast_sip_publication::datastores, and name.
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 2728 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 3487 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 3497 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 3492 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 2723 of file res_pjsip_pubsub.c.
References ast_datastores_remove(), ast_sip_publication::datastores, and name.
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.
This function takes a pre-allocated body and calls into registered body generators in order to fill in the body with appropriate details. The primary body generator will be called first, followed by the supplementary body generators
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 3586 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, ast_sip_pubsub_body_generator::list, LOG_WARNING, str, 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, type, 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().
|
static |
Check if the rdata has a Supported header containing 'eventlist'.
1 | rdata has an eventlist containing supported header |
0 | rdata doesn't have an eventlist containing supported header |
Definition at line 882 of file res_pjsip_pubsub.c.
References while().
Referenced by pubsub_on_rx_refresh(), pubsub_on_rx_subscribe_request(), and sub_persistence_recreate().
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 3502 of file res_pjsip_pubsub.c.
References find_body_generator_type_subtype(), and type.
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.
This may fail if an attempt is made to register a primary body supplement for a given content type if a primary body supplement for that content type has already been registered.
generator | Body generator to register |
0 | Success |
-1 | Failure |
Definition at line 3507 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.
This may fail if an attempt is made to register a primary body supplement for a given content type if a primary body supplement for that content type has already been registered.
supplement | Body generator to register |
0 | Success |
-1 | Failure |
Definition at line 3552 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 3537 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.
supplement | Body generator to unregister |
Definition at line 3561 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 2782 of file res_pjsip_pubsub.c.
References AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ast_log, ast_strlen_zero(), handler(), LOG_ERROR, NULL, publication_cmp_fn(), publication_hash_fn(), 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 2841 of file res_pjsip_pubsub.c.
References ast_sip_subscription_handler::accept, ast_log, AST_SIP_MAX_ACCEPT, ast_strlen_zero(), DEFAULT_EXPIRES, find_sub_handler_for_event_name(), handler(), 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 2693 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 2688 of file res_pjsip_pubsub.c.
References ast_datastores_alloc_datastore(), sip_to_pjsip::info(), and ast_datastore::uid.
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 1429 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_sorcery_object_get_id(), and sub.
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 3581 of file res_pjsip_pubsub.c.
References sub.
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 3576 of file res_pjsip_pubsub.c.
References sub.
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 2698 of file res_pjsip_pubsub.c.
References ast_datastores_find(), ast_sip_subscription::datastores, and name.
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 2708 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 1971 of file res_pjsip_pubsub.c.
References ast_assert, NULL, and sub.
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 1977 of file res_pjsip_pubsub.c.
References ao2_bump, ast_assert, NULL, and sub.
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 1895 of file res_pjsip_pubsub.c.
References ast_sip_mod_data_get, MOD_DATA_MSG, name, NULL, pubsub_module, and sub.
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 2642 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 2750 of file res_pjsip_pubsub.c.
References ast_sip_subscription::persistence_data.
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 2647 of file res_pjsip_pubsub.c.
References buf, sip_subscription_tree::dlg, and sub.
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 2660 of file res_pjsip_pubsub.c.
References sub.
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 1983 of file res_pjsip_pubsub.c.
References ast_assert, NULL, and sub.
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 2637 of file res_pjsip_pubsub.c.
References sub.
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 2665 of file res_pjsip_pubsub.c.
References sub.
Referenced by notify_task(), and state_changed().
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 2593 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, schedule_notification(), send_notify(), SIP_SUB_TREE_NORMAL, SIP_SUB_TREE_TERMINATE_IN_PROGRESS, SIP_SUB_TREE_TERMINATE_PENDING, and sub.
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 2703 of file res_pjsip_pubsub.c.
References ast_datastores_remove(), ast_sip_subscription::datastores, and name.
Referenced by mwi_subscription_established(), mwi_subscription_shutdown(), and subscription_shutdown().
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 2733 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, ast_sip_subscription::persistence_data, ast_sip_subscription::resource, 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 2802 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, handler(), and ast_sip_publish_handler::next.
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 2874 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, handler(), and ast_sip_subscription_handler::next.
Referenced by unload_module().
|
static |
Create a multipart body part for a subscribed resource.
pool | PJLIB allocation pool |
sub | The subscription representing a subscribed resource |
parts | A vector of parts to append the created part to. |
use_full_state | Unused locally, but may be passed to other functions |
Definition at line 2305 of file res_pjsip_pubsub.c.
References allocate_body_part(), ast_free, AST_VECTOR_APPEND, body_part::cid, generate_notify_body(), body_part::part, and sub.
Referenced by generate_list_body().
|
static |
Build child nodes for a given parent.
This iterates through the items on a resource list and creates tree nodes for each one. The tree nodes created are children of the supplied parent node. If an item in the resource list is itself a list, then this function is called recursively to provide children for the new node.
If an item in a resource list is not a list, then the supplied subscription handler is called into as if a new SUBSCRIBE for the list item were presented. The handler's response is used to determine if the node can be added to the tree or not.
If a parent node ends up having no child nodes added under it, then the parent node is pruned from the tree.
endpoint | The endpoint that sent the inbound SUBSCRIBE. |
handler | The subscription handler for leaf nodes in the tree. |
list | The configured resource list from which the child node is being built. |
parent | The parent node for these children. |
visited | The resources that have already been visited. |
Definition at line 1044 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, AST_MAX_EXTENSION, ast_strlen_zero(), AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_SIZE, build_node_children(), tree_node::children, current, resource_list::event, resource_list::full_state, handler(), have_visited(), resource_list::items, NEW_SUBSCRIBE, NULL, tree_node::resource, resource_list::resource_display_name, retrieve_resource_list(), tree_node_alloc(), and tree_node_destroy().
Referenced by build_node_children(), and build_resource_tree().
|
static |
Build a resource tree.
This function builds a resource tree based on the requested resource in a SUBSCRIBE request.
This function also creates a container that has all resources that have been visited during creation of the tree, whether those resources resulted in a tree node being created or not. Keeping this container of visited resources allows for misconfigurations such as loops in the tree or duplicated resources to be detected.
endpoint | The endpoint that sent the SUBSCRIBE request. |
handler | The subscription handler for leaf nodes in the tree. |
resource | The resource requested in the SUBSCRIBE request. |
tree | The tree that is to be built. |
has_eventlist_support |
200-299 | Successfully subscribed to at least one resource. |
300-699 | Failure to subscribe to requested resource. |
Definition at line 1162 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, AST_SIP_DEVICE_FEATURE_SYNC_DATA, ast_sorcery_object_get_id(), AST_VECTOR_FREE, AST_VECTOR_INIT, AST_VECTOR_SIZE, build_node_children(), tree_node::children, handler(), NEW_SUBSCRIBE, resource_tree::notification_batch_interval, NULL, RAII_VAR, retrieve_resource_list(), resource_tree::root, and tree_node_alloc().
Referenced by pubsub_on_rx_refresh(), pubsub_on_rx_subscribe_request(), and sub_persistence_recreate().
|
static |
Create an RLMI body part for a multipart resource list body.
RLMI (Resource list meta information) is a special body type that lists the subscribed resources and tells subscribers the number of subscribed resources and what other body parts are in the multipart body. The RLMI body also has a version number that a subscriber can use to ensure that the locally-stored state corresponds to server state.
pool | The allocation pool |
sub | The subscription representing the subscribed resource list |
body_parts | A container of body parts that RLMI will refer to |
full_state | Indicates whether this is a full or partial state notification |
Definition at line 2208 of file res_pjsip_pubsub.c.
References add_rlmi_resource(), ast_sip_presence_xml_create_attr(), ast_sip_presence_xml_create_node(), ast_sip_subscription_get_local_uri(), ast_sip_subscription_get_resource_name(), AST_VECTOR_GET, AST_VECTOR_SIZE, body_part::cid, generate_content_id_hdr(), name, NULL, body_part::part, rlmi_clone_data(), rlmi_media_type, rlmi_print_body(), S_OR, and sub.
Referenced by generate_list_body().
|
static |
Callback sequence for subscription terminate:
Definition at line 3869 of file res_pjsip_pubsub.c.
References ao2_cleanup, ao2_ref, ast_debug, ast_sip_dialog_set_endpoint(), ast_sip_dialog_set_serializer(), ast_sip_sched_task_cancel(), ast_sip_sched_task_get_name(), sip_subscription_tree::dlg, sip_subscription_tree::evsub, sip_subscription_tree::expiration_task, NULL, pubsub_module, remove_subscription(), sip_subscription_tree::root, shutdown_subscriptions(), SIP_SUB_TREE_TERMINATED, sip_subscription_tree::state, and subscription_persistence_remove().
Referenced by pubsub_on_evsub_state().
|
static |
Definition at line 4432 of file res_pjsip_pubsub.c.
References a, ast_assert, cli, cli_complete_subscription_inbound(), cli_complete_subscription_outbound(), for_each_subscription(), and NULL.
Referenced by cli_show_subscription_inout().
|
static |
Definition at line 4399 of file res_pjsip_pubsub.c.
References ast_copy_pj_str(), ast_malloc, cli, and sip_subscription_tree::dlg.
Referenced by cli_complete_subscription_inbound(), and cli_complete_subscription_outbound().
|
static |
Definition at line 4420 of file res_pjsip_pubsub.c.
References AST_SIP_NOTIFIER, cli_complete_subscription_common(), and sip_subscription_tree::role.
Referenced by cli_complete_subscription_callid().
|
static |
Definition at line 4426 of file res_pjsip_pubsub.c.
References AST_SIP_SUBSCRIBER, cli_complete_subscription_common(), and sip_subscription_tree::role.
Referenced by cli_complete_subscription_callid().
|
static |
Definition at line 4763 of file res_pjsip_pubsub.c.
References ast_cli(), ast_copy_pj_str(), ast_copy_string(), ast_sorcery_object_get_id(), ast_str_buffer(), ast_str_set(), cli, CLI_LIST_SUB_FORMAT_ENTRY, cli_subscription_expiry(), sip_subscription_tree::dlg, sip_subscription_tree::endpoint, ast_sip_subscription_handler::event_name, ast_sip_subscription::handler, ast_sip_endpoint::id, ast_party_id::name, NULL, ast_party_id::number, ast_sip_subscription::resource, sip_subscription_tree::root, S_COR, ast_sip_endpoint_id_configuration::self, ast_party_name::str, ast_party_number::str, ast_party_name::valid, and ast_party_number::valid.
Referenced by cli_list_subscriptions_inbound(), and cli_list_subscriptions_outbound().
|
static |
Definition at line 4807 of file res_pjsip_pubsub.c.
References AST_SIP_NOTIFIER, cli_list_subscriptions_detail(), and sip_subscription_tree::role.
Referenced by cli_list_subscriptions_inout().
|
static |
Definition at line 4819 of file res_pjsip_pubsub.c.
References a, ast_alloca, ast_assert, ast_cli(), ast_free, ast_str_create, cli, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_LIST_SUB_FORMAT_HEADER, cli_list_subscriptions_inbound(), cli_list_subscriptions_outbound(), CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, cli_sub_parms::e, for_each_subscription(), cli_sub_parms::like, MAX_REGEX_ERROR_LEN, NULL, regex(), and ast_cli_entry::usage.
|
static |
Definition at line 4813 of file res_pjsip_pubsub.c.
References AST_SIP_SUBSCRIBER, cli_list_subscriptions_detail(), and sip_subscription_tree::role.
Referenced by cli_list_subscriptions_inout().
|
static |
Definition at line 4474 of file res_pjsip_pubsub.c.
References ast_cli(), ast_free, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_update(), buf, cli_sub_complete_parms::callid, cli, cli_subscription_expiry(), sip_subscription_tree::dlg, ast_sip_subscription_handler::event_name, ast_sip_subscription::handler, if(), ast_sip_subscription::resource, sip_subscription_tree::root, sip_subscription_to_ami(), and value.
Referenced by cli_show_subscription_inbound(), and cli_show_subscription_outbound().
|
static |
Definition at line 4561 of file res_pjsip_pubsub.c.
References AST_SIP_NOTIFIER, cli_show_subscription_common(), and sip_subscription_tree::role.
Referenced by cli_show_subscription_inout().
|
static |
Definition at line 4573 of file res_pjsip_pubsub.c.
References a, ast_assert, cli, cli_complete_subscription_callid(), CLI_GENERATE, CLI_INIT, cli_show_subscription_inbound(), cli_show_subscription_outbound(), CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, cli_sub_parms::e, for_each_subscription(), NULL, and ast_cli_entry::usage.
|
static |
Definition at line 4567 of file res_pjsip_pubsub.c.
References AST_SIP_SUBSCRIBER, cli_show_subscription_common(), and sip_subscription_tree::role.
Referenced by cli_show_subscription_inout().
|
static |
Definition at line 4623 of file res_pjsip_pubsub.c.
References ast_callerid_merge(), ast_cli(), ast_copy_pj_str(), ast_copy_string(), ast_sorcery_object_get_id(), ast_str_buffer(), ast_str_set(), cli, CLI_SHOW_SUB_FORMAT_ENTRY, cli_subscription_expiry(), sip_subscription_tree::dlg, sip_subscription_tree::endpoint, ast_sip_subscription_handler::event_name, ast_sip_subscription::handler, ast_sip_endpoint::id, ast_party_id::name, NULL, ast_party_id::number, ast_sip_subscription::resource, sip_subscription_tree::root, S_COR, ast_sip_endpoint_id_configuration::self, ast_party_name::str, ast_party_number::str, ast_party_name::valid, and ast_party_number::valid.
Referenced by cli_show_subscriptions_inbound(), and cli_show_subscriptions_outbound().
|
static |
Definition at line 4660 of file res_pjsip_pubsub.c.
References AST_SIP_NOTIFIER, cli_show_subscriptions_detail(), and sip_subscription_tree::role.
Referenced by cli_show_subscriptions_inout().
|
static |
Definition at line 4672 of file res_pjsip_pubsub.c.
References a, ast_alloca, ast_assert, ast_cli(), ast_free, ast_str_create, cli, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOW_SUB_FORMAT_HEADER, cli_show_subscriptions_inbound(), cli_show_subscriptions_outbound(), CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, cli_sub_parms::e, for_each_subscription(), cli_sub_parms::like, MAX_REGEX_ERROR_LEN, NULL, regex(), and ast_cli_entry::usage.
|
static |
Definition at line 4666 of file res_pjsip_pubsub.c.
References AST_SIP_SUBSCRIBER, cli_show_subscriptions_detail(), and sip_subscription_tree::role.
Referenced by cli_show_subscriptions_inout().
|
static |
Definition at line 4460 of file res_pjsip_pubsub.c.
References ast_tvdiff_ms(), ast_tvnow(), subscription_persistence::expires, and sip_subscription_tree::persistence.
Referenced by cli_list_subscriptions_detail(), cli_show_subscription_common(), and cli_show_subscriptions_detail().
|
static |
Compare strings for equality checking for NULL.
This function considers NULL values as empty strings. This means NULL or empty strings are equal.
0 | The strings are equal |
1 | The strings are not equal |
Definition at line 4021 of file res_pjsip_pubsub.c.
References ast_strlen_zero().
Referenced by cmp_subscription_childrens().
|
static |
compares the childrens of two ast_sip_subscription s1 and s2
0 | The s1 childrens match the s2 childrens |
1 | The s1 childrens do not match the s2 childrens |
Definition at line 4036 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_subscription::children, cmp_strings(), ast_sip_subscription::display_name, and ast_sip_subscription::resource.
Referenced by pubsub_on_rx_refresh().
|
static |
Create and initialize the PJSIP multipart body structure for a resource list subscription.
pool |
Definition at line 2338 of file res_pjsip_pubsub.c.
References ast_generate_random_string().
Referenced by generate_list_body().
|
static |
Shortcut method to create a Require: eventlist header.
Definition at line 2451 of file res_pjsip_pubsub.c.
Referenced by pubsub_on_rx_refresh(), send_notify(), and sip_subscription_accept().
|
static |
Create a subscription tree based on a resource tree.
Using the previously-determined valid resources in the provided resource tree, a corresponding tree of ast_sip_subscriptions are created. The root of the subscription tree is a real subscription, and the rest in the tree are virtual subscriptions.
handler | The handler to use for leaf subscriptions | |
endpoint | The endpoint that sent the SUBSCRIBE request | |
rdata | The SUBSCRIBE content | |
resource | The requested resource in the SUBSCRIBE request | |
generator | The body generator to use in leaf subscriptions | |
tree | The resource tree on which the subscription tree is based | |
[out] | dlg_status | The result of attempting to create a dialog |
persistence |
NULL | Could not create the subscription tree |
non-NULL | The root of the created subscription tree |
Definition at line 1506 of file res_pjsip_pubsub.c.
References add_subscription(), allocate_subscription_tree(), ao2_bump, ao2_ref, ast_log, ast_sip_create_dialog_uas_locked(), ast_sip_mod_data_get, ast_sip_mod_data_set, AST_SIP_NOTIFIER, AST_VECTOR_SIZE, ast_sip_subscription::children, create_virtual_subscriptions(), subscription_persistence::cseq, sip_subscription_tree::dlg, sip_subscription_tree::endpoint, sip_subscription_tree::evsub, handler(), sip_subscription_tree::is_list, LOG_WARNING, MOD_DATA_MSG, MOD_DATA_PERSISTENCE, sip_subscription_tree::notification_batch_interval, resource_tree::notification_batch_interval, NULL, sip_subscription_tree::persistence, pubsub_cb, pubsub_module, sip_subscription_tree::role, sip_subscription_tree::root, resource_tree::root, subscription_setup_dialog(), and subscription_persistence::tag.
Referenced by pubsub_on_rx_subscribe_request(), and sub_persistence_recreate().
|
static |
Create a tree of virtual subscriptions based on a resource tree node.
handler | The handler to supply to leaf subscriptions. |
resource | The requested resource for this subscription. |
generator | Body generator to use for leaf subscriptions. |
tree | The root of the subscription tree. |
current | The tree node that corresponds to the subscription being created. |
Definition at line 1325 of file res_pjsip_pubsub.c.
References allocate_subscription(), ao2_cleanup, ast_debug, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_INIT, AST_VECTOR_SIZE, create_virtual_subscriptions(), current, destroy_subscription(), handler(), NULL, ast_sip_subscription::resource, tree_node::resource, sub, and ast_sip_subscription::tree.
Referenced by create_subscription_tree(), create_virtual_subscriptions(), and pubsub_on_rx_refresh().
|
static |
Definition at line 1230 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_free, ast_json_unref(), ast_sorcery_object_get_id(), AST_VECTOR_FREE, and sub.
Referenced by allocate_subscription(), create_virtual_subscriptions(), and destroy_subscriptions().
|
static |
Definition at line 1245 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_subscription::children, destroy_subscription(), destroy_subscriptions(), and sip_subscription_tree::root.
Referenced by destroy_subscriptions(), destroy_subscriptions_task(), pubsub_on_rx_refresh(), and subscription_tree_destructor().
|
static |
Definition at line 4058 of file res_pjsip_pubsub.c.
References destroy_subscriptions(), and sub.
Referenced by pubsub_on_rx_refresh().
|
static |
Definition at line 3168 of file res_pjsip_pubsub.c.
References ast_copy_pj_str(), DEFAULT_PUBLISH_EXPIRES, NULL, SIP_PUBLISH_INITIAL, SIP_PUBLISH_MODIFY, SIP_PUBLISH_REFRESH, SIP_PUBLISH_REMOVE, and SIP_PUBLISH_UNKNOWN.
Referenced by pubsub_on_rx_publish_request().
|
static |
Is the Accept header from the SUBSCRIBE in the list of exceptions?
1 | This Accept header value is an exception to the rule. |
0 | This Accept header is not an exception to the rule. |
Definition at line 833 of file res_pjsip_pubsub.c.
References ast_sip_subscription_handler::accept, accept_exceptions, and ARRAY_LEN.
Referenced by subscription_get_generator_from_rdata().
|
static |
Definition at line 2926 of file res_pjsip_pubsub.c.
References ast_debug, ast_log, ast_sip_pubsub_body_generator::body_type, find_body_generator_accept(), LOG_WARNING, NULL, ast_sip_pubsub_body_generator::subtype, and ast_sip_pubsub_body_generator::type.
Referenced by subscription_get_generator_from_rdata().
|
static |
Definition at line 2913 of file res_pjsip_pubsub.c.
References ast_strdupa, ast_strlen_zero(), find_body_generator_type_subtype(), NULL, strsep(), ast_sip_pubsub_body_generator::subtype, and type.
Referenced by find_body_generator().
|
static |
Definition at line 2903 of file res_pjsip_pubsub.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, find_body_generator_type_subtype_nolock(), gen, ast_sip_pubsub_body_generator::subtype, and type.
Referenced by ast_sip_pubsub_generate_body_content(), ast_sip_pubsub_is_body_generator_registered(), and find_body_generator_accept().
|
static |
Definition at line 2889 of file res_pjsip_pubsub.c.
References AST_LIST_TRAVERSE, gen, ast_sip_pubsub_body_generator::list, ast_sip_pubsub_body_generator::subtype, and type.
Referenced by ast_sip_pubsub_register_body_generator(), and find_body_generator_type_subtype().
|
static |
Definition at line 3150 of file res_pjsip_pubsub.c.
References ast_debug, AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_sip_publish_handler::event_name, ast_sip_publish_handler::next, and NULL.
Referenced by pubsub_on_rx_publish_request().
|
static |
Definition at line 2827 of file res_pjsip_pubsub.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, ast_sip_subscription_handler::event_name, and ast_sip_subscription_handler::next.
Referenced by ast_sip_register_subscription_handler(), and subscription_get_handler_from_rdata().
|
static |
Definition at line 1841 of file res_pjsip_pubsub.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, and sip_subscription_tree::next.
Referenced by ami_show_subscriptions_inbound(), ami_show_subscriptions_outbound(), cli_complete_subscription_callid(), cli_list_subscriptions_inout(), cli_show_subscription_inout(), and cli_show_subscriptions_inout().
|
static |
Definition at line 4329 of file res_pjsip_pubsub.c.
References ast_sip_ami::arg, ast_free, ast_sip_create_ami_event(), ast_sip_sorcery_object_to_ami(), ast_str_buffer(), astman_append(), buf, CMP_STOP, ast_sip_ami::count, and ast_sip_ami::s.
Referenced by ami_show_resource_lists().
|
static |
Destroy a list of body parts.
parts | The container of parts to destroy |
Definition at line 2261 of file res_pjsip_pubsub.c.
References ast_free, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_SIZE, and body_part::part.
Referenced by generate_list_body().
|
static |
Create a Content-ID header.
Content-ID headers are required by RFC2387 for multipart/related bodies. They serve as identifiers for each part of the multipart body.
pool | PJLIB allocation pool |
sub | Subscription to a resource |
Definition at line 2153 of file res_pjsip_pubsub.c.
References ast_generate_random_string(), id, and sub.
Referenced by allocate_body_part(), and build_rlmi_body().
|
static |
Definition at line 2951 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_sip_pubsub_generate_body_content(), ast_sip_subscription_get_body_subtype(), ast_sip_subscription_get_body_type(), AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_body_data::body_data, ast_sip_body_data::body_type, generate_initial_notify(), and sub.
Referenced by generate_initial_notify(), initial_notify_task(), and pubsub_on_refresh_timeout().
|
static |
Create a resource list body for NOTIFY requests.
Resource list bodies are multipart/related bodies. The first part of the multipart body is an RLMI body that describes the rest of the parts to come. The other parts of the body convey state of individual subscribed resources.
pool | PJLIB allocation pool |
sub | Subscription details from which to generate body |
force_full_state | If true, ignore resource list settings and send a full state notification |
Definition at line 2371 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_INIT, AST_VECTOR_SIZE, build_body_part(), build_rlmi_body(), create_multipart_body(), free_body_parts(), NULL, and sub.
Referenced by generate_notify_body().
|
static |
Create the body for a NOTIFY request.
pool | The pool used for allocations |
root | The root of the subscription tree |
force_full_state | If true, ignore resource list settings and send a full state notification |
Definition at line 2418 of file res_pjsip_pubsub.c.
References ast_sip_subscription_get_body_subtype(), ast_sip_subscription_get_body_type(), ast_str_buffer(), AST_VECTOR_SIZE, ast_sip_subscription::body_changed, ast_sip_subscription::body_text, ast_sip_subscription::children, generate_list_body(), NULL, text, and type.
Referenced by build_body_part(), and send_notify().
|
static |
Determine if this resource has been visited already.
See build_resource_tree for more information
resource | The resource currently being visited |
visited | The resources that have previously been visited |
Definition at line 1008 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, and tree_node::resource.
Referenced by build_node_children().
|
static |
Definition at line 2994 of file res_pjsip_pubsub.c.
References ao2_ref, ast_alloca, ast_debug, ast_free, ast_log, AST_SIP_SCHED_TASK_DATA_AO2, AST_SIP_SCHED_TASK_FIXED, ast_sip_schedule_task(), ast_test_suite_event_notify, sip_subscription_tree::dlg, subscription_persistence::endpoint, ast_sip_subscription_handler::event_name, sip_subscription_tree::evsub, sip_subscription_tree::expiration_task, initial_notify_data::expires, generate_initial_notify(), ast_sip_subscription::handler, LOG_ERROR, name, sip_subscription_tree::persistence, PJSIP_EXPIRES_NOT_SPECIFIED, pubsub_on_refresh_timeout(), ast_sip_subscription::resource, sip_subscription_tree::root, send_notify(), sip_subscription_tree::serializer, and initial_notify_data::sub_tree.
Referenced by pubsub_on_rx_subscribe_request(), and sub_persistence_recreate().
|
static |
Definition at line 5024 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, item, and resource_list::items.
Referenced by list_item_handler().
|
static |
Definition at line 5037 of file res_pjsip_pubsub.c.
References ast_free, ast_log, ast_strdup, ast_strdupa, ast_strip(), ast_strlen_zero(), AST_VECTOR_APPEND, item, item_in_vector(), resource_list::items, LOG_WARNING, strsep(), and var.
Referenced by apply_list_configuration().
|
static |
Definition at line 5064 of file res_pjsip_pubsub.c.
References ast_free, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_truncate(), ast_strdup, AST_VECTOR_GET, AST_VECTOR_SIZE, buf, resource_list::items, and str.
Referenced by apply_list_configuration().
|
static |
Definition at line 5806 of file res_pjsip_pubsub.c.