Asterisk - The Open Source Telephony Project
18.5.0
|
#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_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 | 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 | 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, 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, 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... | |
AST_TEST_DEFINE (resource_tree) | |
AST_TEST_DEFINE (complex_resource_tree) | |
AST_TEST_DEFINE (bad_resource) | |
AST_TEST_DEFINE (bad_branch) | |
AST_TEST_DEFINE (duplicate_resource) | |
AST_TEST_DEFINE (loop) | |
AST_TEST_DEFINE (bad_event) | |
AST_VECTOR (resources, const char *) | |
A vector of strings commonly used throughout this module. More... | |
AST_VECTOR (body_part_list, struct body_part *) | |
Type declaration for container of body part structures. 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) |
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) |
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 int | check_node (struct ast_test *test, struct tree_node *node, const char **resources, size_t num_resources) |
Check the integrity of a tree node against a set of resources. More... | |
static void | cleanup_resource_list (struct resource_list *list) |
RAII callback to destroy a resource list. 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 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 resource_list * | create_resource_list (struct ast_test *test, const char *list_name, const char *event, const char **resources, size_t num_resources) |
allocate a resource list, store it in sorcery, and set its details 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 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 | ineligible_configuration (void) |
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 | populate_list (struct resource_list *list, const char *event, const char **resources, size_t num_resources) |
Set properties on an allocated resource list. More... | |
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) |
Callback sequence for subscription terminate: 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 int | test_new_subscribe (struct ast_sip_endpoint *endpoint, const char *resource) |
new_subscribe callback for unit tests More... | |
static void | test_resource_tree_destroy (struct resource_tree *tree) |
RAII_VAR callback to destroy an allocated resource tree. More... | |
static struct tree_node * | tree_node_alloc (const char *resource, struct resources *visited, unsigned int full_state) |
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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .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 |
const char * | bad_resources [] |
"bad" resources More... | |
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} } , } |
struct ast_sip_subscription_handler | test_handler |
Subscription handler for unit tests. More... | |
struct ast_sip_notifier | test_notifier |
Subscription notifier for unit tests. More... | |
#define AMI_SHOW_SUBSCRIPTIONS_INBOUND "PJSIPShowSubscriptionsInbound" |
Definition at line 4135 of file res_pjsip_pubsub.c.
Referenced by load_module(), and unload_module().
#define AMI_SHOW_SUBSCRIPTIONS_OUTBOUND "PJSIPShowSubscriptionsOutbound" |
Definition at line 4136 of file res_pjsip_pubsub.c.
Referenced by load_module(), and unload_module().
#define CLI_LIST_SUB_FORMAT_ENTRY "%-30.30s %-30.30s %6d %s\n" |
Definition at line 4522 of file res_pjsip_pubsub.c.
Referenced by cli_list_subscriptions_detail().
#define CLI_LIST_SUB_FORMAT_HEADER "%-30.30s %-30.30s %6.6s %s\n" |
Definition at line 4521 of file res_pjsip_pubsub.c.
Referenced by cli_list_subscriptions_inout().
#define CLI_SHOW_SUB_FORMAT_ENTRY |
Definition at line 4379 of file res_pjsip_pubsub.c.
Referenced by cli_show_subscriptions_detail().
#define CLI_SHOW_SUB_FORMAT_HEADER |
Definition at line 4374 of file res_pjsip_pubsub.c.
Referenced by cli_show_subscriptions_inout().
#define DATASTORE_BUCKETS 53 |
Number of buckets for subscription datastore.
Definition at line 250 of file res_pjsip_pubsub.c.
#define DEFAULT_EXPIRES 3600 |
Default expiration for subscriptions.
Definition at line 253 of file res_pjsip_pubsub.c.
Referenced by ast_sip_register_subscription_handler().
#define DEFAULT_PUBLISH_EXPIRES 3600 |
Default expiration time for PUBLISH if one is not specified.
Definition at line 247 of file res_pjsip_pubsub.c.
Referenced by determine_sip_publish_type(), sip_create_publication(), and subscription_persistence_update().
#define MAX_REGEX_ERROR_LEN 128 |
Definition at line 4138 of file res_pjsip_pubsub.c.
Referenced by cli_list_subscriptions_inout(), and cli_show_subscriptions_inout().
#define MOD_DATA_MSG "sub_msg" |
Definition at line 236 of file res_pjsip_pubsub.c.
Referenced by ast_sip_subscription_get_header(), and create_subscription_tree().
#define MOD_DATA_PERSISTENCE "sub_persistence" |
Definition at line 235 of file res_pjsip_pubsub.c.
Referenced by create_subscription_tree(), sip_subscription_accept(), and sub_persistence_recreate().
#define PUBLICATIONS_BUCKETS 37 |
Number of buckets for publications (on a per handler)
Definition at line 244 of file res_pjsip_pubsub.c.
Referenced by ast_sip_register_publish_handler().
#define RESOURCE_LIST_INIT_SIZE 4 |
Definition at line 4750 of file res_pjsip_pubsub.c.
Referenced by resource_list_alloc().
typedef int(* on_subscription_t) (struct sip_subscription_tree *sub, void *arg) |
Definition at line 1798 of file res_pjsip_pubsub.c.
Definition at line 523 of file res_pjsip_pubsub.c.
enum sip_publish_type |
The types of PUBLISH messages defined in RFC 3903.
Definition at line 265 of file res_pjsip_pubsub.c.
The state of the subscription tree.
Definition at line 404 of file res_pjsip_pubsub.c.
|
static |
Definition at line 5714 of file res_pjsip_pubsub.c.
|
static |
Definition at line 5714 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 |
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 2029 of file res_pjsip_pubsub.c.
References ast_generate_random_string(), ast_sip_presence_xml_create_attr(), ast_sip_presence_xml_create_node(), cid_name, and name.
Referenced by build_rlmi_body().
|
static |
Definition at line 1175 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 2233 of file res_pjsip_pubsub.c.
References ast_calloc, body_part::cid, generate_content_id_hdr(), NULL, body_part::resource, body_part::state, and body_part::uri.
Referenced by build_body_part().
|
static |
Definition at line 1233 of file res_pjsip_pubsub.c.
References ao2_bump, ast_calloc, ast_datastores_alloc(), ast_json_object_get(), ast_json_ref(), ast_str_create, ast_sip_subscription::datastores, destroy_subscription(), sip_subscription_tree::dlg, subscription_persistence::generator_data, handler(), ast_sip_subscription::handler, NULL, sip_subscription_tree::persistence, sub, and ast_sip_subscription::tree.
Referenced by ast_sip_create_subscription(), and create_virtual_subscriptions().
|
static |
Definition at line 1405 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 1967 of file res_pjsip_pubsub.c.
References buf.
Referenced by sip_subscription_send_request().
|
static |
Definition at line 4112 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 4062 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 4076 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 4031 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 4050 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 4056 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 4857 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_alloc(), and resource_list_apply_handler().
Referenced by load_module().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 5714 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.
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().
|
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 866 of file res_pjsip_pubsub.c.
References while().
Referenced by 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 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().
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().
AST_TEST_DEFINE | ( | resource_tree | ) |
Definition at line 5078 of file res_pjsip_pubsub.c.
References ARRAY_LEN, ast_calloc, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, build_resource_tree(), check_node(), cleanup_resource_list(), create_resource_list(), ineligible_configuration(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, TEST_INIT, and test_resource_tree_destroy().
AST_TEST_DEFINE | ( | complex_resource_tree | ) |
Definition at line 5131 of file res_pjsip_pubsub.c.
References ARRAY_LEN, ast_calloc, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, AST_VECTOR_GET, build_resource_tree(), check_node(), cleanup_resource_list(), create_resource_list(), ineligible_configuration(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, TEST_INIT, and test_resource_tree_destroy().
AST_TEST_DEFINE | ( | bad_resource | ) |
Definition at line 5208 of file res_pjsip_pubsub.c.
References ARRAY_LEN, ast_calloc, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, build_resource_tree(), check_node(), cleanup_resource_list(), create_resource_list(), ineligible_configuration(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, TEST_INIT, and test_resource_tree_destroy().
AST_TEST_DEFINE | ( | bad_branch | ) |
Definition at line 5264 of file res_pjsip_pubsub.c.
References ARRAY_LEN, ast_calloc, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, build_resource_tree(), check_node(), cleanup_resource_list(), create_resource_list(), ineligible_configuration(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, TEST_INIT, and test_resource_tree_destroy().
AST_TEST_DEFINE | ( | duplicate_resource | ) |
Definition at line 5335 of file res_pjsip_pubsub.c.
References ARRAY_LEN, ast_calloc, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, AST_VECTOR_GET, build_resource_tree(), check_node(), cleanup_resource_list(), create_resource_list(), ineligible_configuration(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, TEST_INIT, and test_resource_tree_destroy().
AST_TEST_DEFINE | ( | loop | ) |
Definition at line 5416 of file res_pjsip_pubsub.c.
References ARRAY_LEN, ast_calloc, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, build_resource_tree(), cleanup_resource_list(), create_resource_list(), ineligible_configuration(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, TEST_INIT, and test_resource_tree_destroy().
AST_TEST_DEFINE | ( | bad_event | ) |
Definition at line 5467 of file res_pjsip_pubsub.c.
References ARRAY_LEN, ast_calloc, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, build_resource_tree(), cleanup_resource_list(), create_resource_list(), ineligible_configuration(), sip_to_pjsip::info(), NULL, RAII_VAR, TEST_EXECUTE, TEST_INIT, and test_resource_tree_destroy().
AST_VECTOR | ( | resources | , |
const char * | |||
) |
A vector of strings commonly used throughout this module.
AST_VECTOR | ( | body_part_list | , |
struct body_part * | |||
) |
Type declaration for container of body part structures.
|
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 2258 of file res_pjsip_pubsub.c.
References allocate_body_part(), ast_free, AST_VECTOR_APPEND, body_part::cid, generate_notify_body(), and body_part::part.
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 1021 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, AST_VECTOR_APPEND, AST_VECTOR_GET, AST_VECTOR_SIZE, resource_list::event, resource_list::full_state, have_visited(), resource_list::items, ast_sip_notifier::new_subscribe, ast_sip_subscription_handler::notifier, retrieve_resource_list(), tree_node_alloc(), and tree_node_destroy().
Referenced by 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 1135 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_sorcery_object_get_id(), AST_VECTOR_FREE, AST_VECTOR_INIT, AST_VECTOR_SIZE, build_node_children(), ast_sip_subscription_handler::event_name, ast_sip_notifier::new_subscribe, resource_tree::notification_batch_interval, ast_sip_subscription_handler::notifier, NULL, RAII_VAR, retrieve_resource_list(), resource_tree::root, and tree_node_alloc().
Referenced by AST_TEST_DEFINE(), 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 2162 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(), generate_notify_body(), name, NULL, body_part::part, pool, body_part::resource, rlmi_clone_data(), rlmi_media_type, rlmi_print_body(), body_part::state, and body_part::uri.
Referenced by generate_list_body().
|
static |
Check the integrity of a tree node against a set of resources.
The tree node's resources must be in the same order as the resources in the supplied resources array. Because of this constraint, tests can misrepresent the size of the resources array as being smaller than it really is if resources at the end of the array should not be present in the tree node.
test | The unit test. Used for printing status messages. |
node | The constructed tree node whose integrity is under question. |
resources | Array of expected resource values |
num_resources | The number of resources to check in the array. |
Definition at line 5022 of file res_pjsip_pubsub.c.
References ast_test_status_update, AST_VECTOR_GET, and AST_VECTOR_SIZE.
Referenced by AST_TEST_DEFINE().
|
static |
RAII callback to destroy a resource list.
Definition at line 4962 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_sip_get_sorcery(), and ast_sorcery_delete().
Referenced by AST_TEST_DEFINE(), and create_resource_list().
|
static |
Definition at line 4193 of file res_pjsip_pubsub.c.
References a, cli_sub_complete_parms::a, ast_cli_args::argv, ast_assert, cli_sub_complete_parms::callid, cli_complete_subscription_inbound(), cli_complete_subscription_outbound(), for_each_subscription(), NULL, ast_cli_args::pos, cli_sub_complete_parms::which, ast_cli_args::word, and cli_sub_complete_parms::wordlen.
Referenced by cli_show_subscription_inout().
|
static |
Definition at line 4160 of file res_pjsip_pubsub.c.
References cli_sub_complete_parms::a, ast_copy_pj_str(), ast_malloc, cli_sub_complete_parms::callid, sip_subscription_tree::dlg, ast_cli_args::n, cli_sub_complete_parms::which, ast_cli_args::word, and cli_sub_complete_parms::wordlen.
Referenced by cli_complete_subscription_inbound(), and cli_complete_subscription_outbound().
|
static |
Definition at line 4181 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 4187 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 4524 of file res_pjsip_pubsub.c.
References cli_sub_parms::a, ast_cli(), ast_copy_pj_str(), ast_copy_string(), ast_sorcery_object_get_id(), ast_str_buffer(), ast_str_set(), cli_sub_parms::buf, CLI_LIST_SUB_FORMAT_ENTRY, cli_subscription_expiry(), cli_sub_parms::count, sip_subscription_tree::dlg, sip_subscription_tree::endpoint, ast_sip_subscription_handler::event_name, ast_cli_args::fd, ast_sip_subscription::handler, ast_sip_endpoint::id, cli_sub_parms::like, ast_party_id::name, NULL, ast_party_id::number, 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 4568 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 4580 of file res_pjsip_pubsub.c.
References a, cli_sub_parms::a, ast_cli_args::argc, ast_cli_args::argv, ast_alloca, ast_assert, ast_cli(), ast_free, ast_str_create, cli_sub_parms::buf, 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::count, cli_sub_parms::e, ast_cli_args::fd, for_each_subscription(), cli_sub_parms::like, MAX_REGEX_ERROR_LEN, NULL, regex(), and ast_cli_entry::usage.
|
static |
Definition at line 4574 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 4235 of file res_pjsip_pubsub.c.
References cli_sub_parms::a, ast_cli(), ast_free, ast_str_append(), ast_str_buffer(), ast_str_create, ast_str_update(), buf, cli_sub_parms::buf, cli_sub_complete_parms::callid, cli_subscription_expiry(), sip_subscription_tree::dlg, ast_sip_subscription_handler::event_name, ast_cli_args::fd, ast_sip_subscription::handler, if(), 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 4322 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 4334 of file res_pjsip_pubsub.c.
References a, cli_sub_parms::a, ast_cli_args::argc, ast_cli_args::argv, ast_assert, cli_sub_parms::buf, 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 4328 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 4384 of file res_pjsip_pubsub.c.
References cli_sub_parms::a, ast_callerid_merge(), ast_cli(), ast_copy_pj_str(), ast_copy_string(), ast_sorcery_object_get_id(), ast_str_buffer(), ast_str_set(), cli_sub_parms::buf, CLI_SHOW_SUB_FORMAT_ENTRY, cli_subscription_expiry(), cli_sub_parms::count, sip_subscription_tree::dlg, sip_subscription_tree::endpoint, ast_sip_subscription_handler::event_name, ast_cli_args::fd, ast_sip_subscription::handler, ast_sip_endpoint::id, cli_sub_parms::like, ast_party_id::name, NULL, ast_party_id::number, 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 4421 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 4433 of file res_pjsip_pubsub.c.
References a, cli_sub_parms::a, ast_cli_args::argc, ast_cli_args::argv, ast_alloca, ast_assert, ast_cli(), ast_free, ast_str_create, cli_sub_parms::buf, 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::count, cli_sub_parms::e, ast_cli_args::fd, for_each_subscription(), cli_sub_parms::like, MAX_REGEX_ERROR_LEN, NULL, regex(), and ast_cli_entry::usage.
|
static |
Definition at line 4427 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 4221 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 |
Create and initialize the PJSIP multipart body structure for a resource list subscription.
pool |
Definition at line 2291 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 2404 of file res_pjsip_pubsub.c.
Referenced by pubsub_on_rx_refresh(), send_notify(), and sip_subscription_accept().
|
static |
allocate a resource list, store it in sorcery, and set its details
test | The unit test. Used for logging status messages. |
list_name | The name of the list to create. |
event | The event the list services |
resources | Array of resources to apply to the list |
num_resources | The number of resources in the array |
NULL | Failed to allocate or populate list |
non-NULL | The created list |
Definition at line 4983 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_sip_get_sorcery(), ast_sorcery_alloc(), ast_sorcery_create(), ast_test_status_update, cleanup_resource_list(), NULL, and populate_list().
Referenced by AST_TEST_DEFINE().
|
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 |
dlg_status[out] | The result of attempting to create a dialog. |
NULL | Could not create the subscription tree |
non-NULL | The root of the created subscription tree |
Definition at line 1465 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, create_virtual_subscriptions(), subscription_persistence::cseq, sip_subscription_tree::dlg, sip_subscription_tree::evsub, 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 1286 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, ast_sip_subscription::body_generator, destroy_subscription(), generator, NULL, and sub.
Referenced by create_subscription_tree().
|
static |
Definition at line 1201 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_free, ast_json_unref(), ast_sorcery_object_get_id(), AST_VECTOR_FREE, ast_sip_subscription::datastores, sip_subscription_tree::endpoint, and ast_sip_subscription::tree.
Referenced by allocate_subscription(), create_virtual_subscriptions(), and destroy_subscriptions().
|
static |
Definition at line 1215 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, and destroy_subscription().
Referenced by subscription_tree_destructor().
|
static |
Definition at line 3102 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 817 of file res_pjsip_pubsub.c.
References accept_exceptions, and ARRAY_LEN.
Referenced by subscription_get_generator_from_rdata().
|
static |
Definition at line 2862 of file res_pjsip_pubsub.c.
References ast_debug, ast_log, ast_sip_pubsub_body_generator::body_type, find_body_generator_accept(), generator, LOG_WARNING, NULL, ast_sip_pubsub_body_generator::subtype, and ast_sip_pubsub_body_generator::type.
Referenced by subscription_get_generator_from_rdata(), and subscription_persistence_remove().
|
static |
Definition at line 2849 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 2839 of file res_pjsip_pubsub.c.
References AST_RWLIST_RDLOCK, AST_RWLIST_UNLOCK, find_body_generator_type_subtype_nolock(), and gen.
Referenced by ast_sip_pubsub_generate_body_content(), ast_sip_pubsub_is_body_generator_registered(), and find_body_generator_accept().
|
static |
Definition at line 2825 of file res_pjsip_pubsub.c.
References AST_LIST_TRAVERSE, gen, ast_sip_pubsub_body_generator::list, ast_sip_pubsub_body_generator::subtype, and ast_sip_pubsub_body_generator::type.
Referenced by ast_sip_pubsub_register_body_generator(), and find_body_generator_type_subtype().
|
static |
Definition at line 3084 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 2763 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(), subscription_get_handler_from_rdata(), and subscription_persistence_remove().
|
static |
Definition at line 1800 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 4090 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 2215 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 2107 of file res_pjsip_pubsub.c.
References ast_generate_random_string(), cid_name, and id.
Referenced by allocate_body_part(), and build_rlmi_body().
|
static |
Definition at line 2887 of file res_pjsip_pubsub.c.
References ao2_cleanup, 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, ast_sip_subscription_handler::body_type, ast_sip_notifier::get_notify_data, ast_sip_subscription::handler, ast_sip_subscription_handler::notifier, pubsub_on_refresh_timeout(), and ast_sip_notifier::subscription_established.
Referenced by initial_notify_task().
|
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 2324 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(), and NULL.
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 2371 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, generate_list_body(), NULL, text, and type.
Referenced by build_body_part(), build_rlmi_body(), 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 987 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, and AST_VECTOR_SIZE.
Referenced by build_node_children().
|
static |
Definition at line 5053 of file res_pjsip_pubsub.c.
References ast_config_destroy(), ast_config_load, ast_strlen_zero, ast_variable_retrieve(), config, and value.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 2929 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(), 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 4781 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, and resource_list::items.
Referenced by list_item_handler().
|
static |
Definition at line 4794 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 ast_variable::value.
Referenced by apply_list_configuration().
|
static |
Definition at line 4821 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, resource_list::items, and str.
Referenced by apply_list_configuration().
|
static |
Definition at line 5560 of file res_pjsip_pubsub.c.
References ami_show_resource_lists(), ami_show_subscriptions_inbound(), AMI_SHOW_SUBSCRIPTIONS_INBOUND, ami_show_subscriptions_outbound(), AMI_SHOW_SUBSCRIPTIONS_OUTBOUND, apply_list_configuration(), ARRAY_LEN, ast_cli_register_multiple, ast_log, ast_manager_get_generic_type(), ast_manager_get_topic(), ast_manager_register_xml, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_module_shutdown_ref, AST_OPT_FLAG_FULLY_BOOTED, ast_options, ast_sched_context_create(), ast_sched_context_destroy(), ast_sched_start_thread(), ast_sip_get_pjsip_endpoint(), ast_sip_get_sorcery(), ast_sip_push_task(), ast_sip_register_service(), ast_sip_unregister_service(), ast_sorcery_apply_config, ast_sorcery_apply_default, ast_sorcery_object_field_register, ast_sorcery_object_field_register_custom, ast_sorcery_object_fields_register(), ast_sorcery_object_register, ast_sorcery_reload_object(), ast_test_flag, AST_TEST_REGISTER, CHARFLDSET, EVENT_FLAG_SYSTEM, FLDSET, LOG_ERROR, NULL, OPT_CHAR_ARRAY_T, OPT_NOOP_T, OPT_UINT_T, OPT_YESNO_T, persistence_endpoint_str2struct(), persistence_endpoint_struct2str(), persistence_expires_str2struct(), persistence_expires_struct2str(), persistence_generator_data_str2struct(), persistence_generator_data_struct2str(), persistence_tag_str2struct(), persistence_tag_struct2str(), publication_resource_alloc(), pubsub_module, resource_endpoint_handler(), resource_event_handler(), rlmi_media_type, ast_module_info::self, sorcery, stasis_subscribe_pool, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), sub, subscription_persistence_alloc(), subscription_persistence_event_cb(), and subscription_persistence_load().
Referenced by unload_module().
|
static |
Definition at line 3585 of file res_pjsip_pubsub.c.
References ast_read_line_from_buffer(), ast_str_to_lower(), ast_strdupa, ast_strlen_zero, simple_message_summary::message_account, simple_message_summary::voice_messages_new, simple_message_summary::voice_messages_old, simple_message_summary::voice_messages_urgent_new, and simple_message_summary::voice_messages_urgent_old.
Referenced by pubsub_on_rx_mwi_notify_request().
|
static |
Definition at line 4673 of file res_pjsip_pubsub.c.
References ast_strdup, subscription_persistence::endpoint, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 4681 of file res_pjsip_pubsub.c.
References ast_strdup, and subscription_persistence::endpoint.
Referenced by load_module().
|
static |
Definition at line 4738 of file res_pjsip_pubsub.c.
References ast_get_timeval(), ast_tv(), subscription_persistence::expires, NULL, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 4744 of file res_pjsip_pubsub.c.
References ast_asprintf, and subscription_persistence::expires.
Referenced by load_module().
|
static |
Definition at line 4705 of file res_pjsip_pubsub.c.
References ast_json_load_string(), subscription_persistence::generator_data, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 4718 of file res_pjsip_pubsub.c.
References ast_json_dump_string, ast_json_free(), ast_strdup, subscription_persistence::generator_data, and value.
Referenced by load_module().
|
static |
Definition at line 4689 of file res_pjsip_pubsub.c.
References ast_strdup, subscription_persistence::tag, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 4697 of file res_pjsip_pubsub.c.
References ast_strdup, and subscription_persistence::tag.
Referenced by load_module().
|
static |
Set properties on an allocated resource list.
list | The list to set details on. |
event | The list's event. |
resources | Array of resources to add to the list. |
num_resources | Number of resources in the array. |
0 | Success |
non-zero | Failure |
Definition at line 4942 of file res_pjsip_pubsub.c.
References ast_copy_string(), ast_free, ast_strdup, AST_VECTOR_APPEND, resource_list::event, and resource_list::items.
Referenced by create_resource_list().
|
static |
Definition at line 2701 of file res_pjsip_pubsub.c.
References CMP_MATCH, CMP_STOP, ast_sip_publication::entity_tag, and OBJ_KEY.
Referenced by ast_sip_register_publish_handler().
|
static |
Internal destructor for publications.
Definition at line 3133 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_module_unref, ast_sip_publication::datastores, ast_sip_publication::endpoint, and ast_module_info::self.
Referenced by sip_create_publication().
|
static |
Definition at line 2693 of file res_pjsip_pubsub.c.
References ast_sip_publication::entity_tag, and OBJ_KEY.
Referenced by ast_sip_register_publish_handler().
|
static |
Allocator for publication resource.
Definition at line 567 of file res_pjsip_pubsub.c.
References ast_sorcery_generic_alloc(), and publication_resource_destroy().
Referenced by load_module().
|
static |
Destructor for publication resource.
Definition at line 558 of file res_pjsip_pubsub.c.
References ast_free, ast_variables_destroy(), ast_sip_publication_resource::endpoint, and ast_sip_publication_resource::events.
Referenced by publication_resource_alloc().
|
static |
Definition at line 2711 of file res_pjsip_pubsub.c.
References AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, and AST_RWLIST_WRLOCK.
Referenced by ast_sip_register_publish_handler().
|
static |
Definition at line 3312 of file res_pjsip_pubsub.c.
References ao2_cleanup, ao2_unlink, ast_sip_push_task(), ast_sip_publication::handler, NULL, ast_sip_publish_handler::publications, publish_expire_callback(), and ast_sip_publication::sched_id.
Referenced by pubsub_on_rx_publish_request().
|
static |
Definition at line 3301 of file res_pjsip_pubsub.c.
References ao2_cleanup, and RAII_VAR.
Referenced by publish_expire().
|
static |
Definition at line 3214 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_alloca, ast_copy_pj_str(), ast_debug, ast_log, ast_sip_get_pjsip_endpoint(), ast_sip_get_sorcery(), AST_SIP_PUBLISH_STATE_INITIALIZED, AST_SIP_USER_OPTIONS_TRUNCATE_CHECK, ast_sorcery_object_get_id(), ast_sorcery_retrieve_by_id(), ast_strlen_zero, ast_sip_publish_handler::event_name, handler(), ast_sip_publication::handler, LOG_WARNING, ast_variable::name, ast_sip_publish_handler::new_publication, ast_variable::next, NULL, ast_sip_publish_handler::publication_state_change, RAII_VAR, ast_sip_publication::resource, S_OR, sip_create_publication(), sip_publication_respond(), and ast_variable::value.
Referenced by pubsub_on_rx_publish_request().
|
static |
Definition at line 3989 of file res_pjsip_pubsub.c.
References ao2_bump, ao2_cleanup, ast_sip_push_task(), pubsub_module, serialized_pubsub_on_client_refresh(), and sip_subscription_tree::serializer.
|
static |
Callback sequence for subscription terminate:
PJSIP callback when underlying SIP subscription changes state
Although this function is called for every state change, we only care about the TERMINATED state, and only when we're actually processing the final notify (SIP_SUB_TREE_TERMINATE_IN_PROGRESS) OR when a transmission failure occurs (PJSIP_EVENT_TSX_STATE). In this case, we do all the subscription tree cleanup tasks and decrement the evsub reference.
Definition at line 3807 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_NORMAL, SIP_SUB_TREE_TERMINATE_IN_PROGRESS, SIP_SUB_TREE_TERMINATED, sip_subscription_tree::state, sub_tree_state_description, and subscription_persistence_remove().
|
static |
Definition at line 3859 of file res_pjsip_pubsub.c.
References ast_debug, ast_test_suite_event_notify, sip_subscription_tree::dlg, sip_subscription_tree::root, send_notify(), set_state_terminated(), SIP_SUB_TREE_TERMINATE_IN_PROGRESS, SIP_SUB_TREE_TERMINATE_PENDING, sip_subscription_tree::state, and sub_tree_state_description.
Referenced by generate_initial_notify(), initial_notify_task(), and serialized_pubsub_on_refresh_timeout().
|
static |
Definition at line 3614 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_alloca, ast_debug, ast_log, ast_pjsip_rdata_get_endpoint(), ast_publish_mwi_state, ast_sip_get_pjsip_endpoint(), ast_sorcery_object_get_id(), ast_strdupa, ast_strlen_zero, ast_test_suite_event_notify, context, error(), LOG_ERROR, mailbox, simple_message_summary::message_account, NULL, parse_simple_message_summary(), RAII_VAR, simple_message_summary::voice_messages_new, simple_message_summary::voice_messages_old, simple_message_summary::voice_messages_urgent_new, and simple_message_summary::voice_messages_urgent_old.
Referenced by pubsub_on_rx_notify_request().
|
static |
Definition at line 3956 of file res_pjsip_pubsub.c.
References ast_sip_subscription::handler, pubsub_module, ast_sip_subscriber::state_change, sub, and ast_sip_subscription_handler::subscriber.
|
static |
Definition at line 3697 of file res_pjsip_pubsub.c.
References ast_sip_is_content_type(), and pubsub_on_rx_mwi_notify_request().
Referenced by pubsub_on_rx_request().
|
static |
Definition at line 3326 of file res_pjsip_pubsub.c.
References ao2_cleanup, ao2_find, ao2_link, ao2_ref, ast_assert, ast_atomic_fetchadd_int(), ast_copy_pj_str(), ast_log, ast_pjsip_rdata_get_endpoint(), AST_SCHED_DEL_UNREF, AST_SCHED_REPLACE_UNREF, ast_sip_get_pjsip_endpoint(), AST_SIP_PUBLISH_STATE_ACTIVE, AST_SIP_PUBLISH_STATE_TERMINATED, ast_sorcery_object_get_id(), determine_sip_publish_type(), esc_etag_counter, find_pub_handler(), handler(), LOG_WARNING, NULL, OBJ_KEY, OBJ_UNLINK, ast_sip_publish_handler::publication_state_change, ast_sip_publish_handler::publications, publish_expire(), publish_request_initial(), RAII_VAR, sip_publication_respond(), SIP_PUBLISH_INITIAL, SIP_PUBLISH_MODIFY, SIP_PUBLISH_REFRESH, SIP_PUBLISH_REMOVE, SIP_PUBLISH_UNKNOWN, and str_event_name.
Referenced by pubsub_on_rx_request().
|
static |
Called whenever an in-dialog SUBSCRIBE is received.
This includes both SUBSCRIBE requests that actually refresh the subscription as well as SUBSCRIBE requests that end the subscription.
In either case we push serialized_pubsub_on_refresh_timeout to send an appropriate NOTIFY request.
Definition at line 3911 of file res_pjsip_pubsub.c.
References ao2_bump, ao2_cleanup, ao2_ref, ast_debug, ast_log, ast_sip_push_task(), ast_sip_sched_task_cancel(), ast_sip_sched_task_get_name(), create_require_eventlist(), sip_subscription_tree::evsub, sip_subscription_tree::expiration_task, sip_subscription_tree::is_list, LOG_ERROR, NULL, pubsub_module, serialized_pubsub_on_refresh_timeout(), sip_subscription_tree::serializer, SIP_SUB_TREE_NORMAL, SIP_SUB_TREE_TERMINATE_PENDING, sip_subscription_tree::state, sub_tree_state_description, SUBSCRIPTION_PERSISTENCE_REFRESHED, and subscription_persistence_update().
|
static |
Opaque structure representing an RFC 3265 SIP subscription.
Definition at line 3707 of file res_pjsip_pubsub.c.
References pjsip_publish_method, pubsub_on_rx_notify_request(), pubsub_on_rx_publish_request(), and pubsub_on_rx_subscribe_request().
|
static |
Definition at line 2969 of file res_pjsip_pubsub.c.
References ao2_bump, ao2_cleanup, ao2_ref, ast_alloca, ast_assert, ast_copy_pj_str(), ast_debug, ast_free, ast_log, ast_malloc, ast_pjsip_rdata_get_endpoint(), ast_sip_get_pjsip_endpoint(), ast_sip_pubsub_has_eventlist_support(), ast_sip_push_task(), AST_SIP_USER_OPTIONS_TRUNCATE_CHECK, ast_sorcery_object_get_id(), build_resource_tree(), create_subscription_tree(), sip_subscription_tree::evsub, initial_notify_data::expires, generator, handler(), initial_notify_task(), LOG_WARNING, NULL, sip_subscription_tree::persistence, PJSIP_EXPIRES_NOT_SPECIFIED, RAII_VAR, resource_tree_destroy(), sip_subscription_tree::serializer, sip_subscription_accept(), initial_notify_data::sub_tree, subscription_get_generator_from_rdata(), subscription_get_handler_from_rdata(), subscription_persistence_create(), SUBSCRIPTION_PERSISTENCE_CREATED, and subscription_persistence_update().
Referenced by pubsub_on_rx_request().
|
static |
Definition at line 4002 of file res_pjsip_pubsub.c.
References ao2_bump, ao2_cleanup, ast_sip_push_task(), pubsub_module, serialized_pubsub_on_refresh_timeout(), sip_subscription_tree::serializer, SIP_SUB_TREE_NORMAL, SIP_SUB_TREE_TERMINATE_PENDING, and sip_subscription_tree::state.
|
static |
Definition at line 1182 of file res_pjsip_pubsub.c.
References ast_debug, AST_RWLIST_REMOVE_CURRENT, AST_RWLIST_TRAVERSE_SAFE_BEGIN, AST_RWLIST_TRAVERSE_SAFE_END, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_sip_subscription_get_resource_name(), ast_sorcery_object_get_id(), sip_subscription_tree::endpoint, sip_subscription_tree::next, and sip_subscription_tree::root.
Referenced by pubsub_on_evsub_state().
|
static |
Definition at line 5526 of file res_pjsip_pubsub.c.
References ast_free, ast_strdup, ast_sip_publication_resource::endpoint, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 5536 of file res_pjsip_pubsub.c.
References ast_strlen_zero, ast_variable_new, ast_sip_publication_resource::events, item, ast_variable::name, ast_variable::next, and ast_variable::value.
Referenced by load_module().
|
static |
Definition at line 4764 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_sorcery_generic_alloc(), AST_VECTOR_INIT, resource_list::items, NULL, resource_list_destructor(), and RESOURCE_LIST_INIT_SIZE.
Referenced by apply_list_configuration().
|
static |
Definition at line 4838 of file res_pjsip_pubsub.c.
References ast_log, ast_sorcery_object_get_id(), ast_strlen_zero, AST_VECTOR_SIZE, resource_list::event, resource_list::items, and LOG_WARNING.
Referenced by apply_list_configuration().
|
static |
Definition at line 4752 of file res_pjsip_pubsub.c.
References ast_free, AST_VECTOR_FREE, AST_VECTOR_GET, AST_VECTOR_SIZE, and resource_list::items.
Referenced by resource_list_alloc().
|
static |
Destroy a resource tree.
This function makes no assumptions about how the tree itself was allocated and does not attempt to free the tree itself. Callers of this function are responsible for freeing the tree.
tree | The tree to destroy. |
Definition at line 1109 of file res_pjsip_pubsub.c.
References resource_tree::root, and tree_node_destroy().
Referenced by pubsub_on_rx_subscribe_request(), sub_persistence_recreate(), and test_resource_tree_destroy().
|
static |
Helper function for retrieving a resource list for a given event.
This will retrieve a resource list that corresponds to the resource and event provided.
resource | The name of the resource list to retrieve |
event | The expected event name on the resource list |
Definition at line 902 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_log, ast_sip_get_sorcery(), ast_sorcery_retrieve_by_id(), resource_list::event, LOG_WARNING, and NULL.
Referenced by build_node_children(), and build_resource_tree().
|
static |
Definition at line 2140 of file res_pjsip_pubsub.c.
Referenced by build_rlmi_body().
|
static |
Definition at line 2127 of file res_pjsip_pubsub.c.
References AST_PJSIP_XML_PROLOG_LEN.
Referenced by build_rlmi_body().
|
static |
Definition at line 2500 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_sip_push_task(), serialized_send_notify(), and sip_subscription_tree::serializer.
Referenced by schedule_notification().
|
static |
Definition at line 2512 of file res_pjsip_pubsub.c.
References ao2_bump, ao2_cleanup, ast_sched_add(), sip_subscription_tree::notification_batch_interval, sip_subscription_tree::notify_sched_id, sched_cb(), and sip_subscription_tree::send_scheduled_notify.
Referenced by ast_sip_subscription_notify().
|
static |
Send a NOTIFY request to a subscriber.
sub_tree | The subscription tree representing the subscription |
force_full_state | If true, ignore resource list settings and send full resource list state. |
0 | Success |
non-zero | Failure |
Definition at line 2425 of file res_pjsip_pubsub.c.
References ast_shutdown_final(), create_require_eventlist(), sip_subscription_tree::evsub, generate_notify_body(), sip_subscription_tree::is_list, NULL, sip_subscription_tree::persistence, sip_subscription_tree::root, sip_subscription_tree::send_scheduled_notify, and sip_subscription_send_request().
Referenced by ast_sip_subscription_notify(), initial_notify_task(), pubsub_on_refresh_timeout(), and serialized_send_notify().
|
static |
Definition at line 3969 of file res_pjsip_pubsub.c.
References ao2_cleanup, sip_subscription_tree::evsub, and NULL.
Referenced by pubsub_on_client_refresh().
|
static |
Definition at line 3889 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, pubsub_on_refresh_timeout(), sip_subscription_tree::state, and sub_tree_state_description.
Referenced by pubsub_on_rx_refresh(), and pubsub_on_server_timeout().
|
static |
Definition at line 2462 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_test_suite_event_notify, sip_subscription_tree::dlg, sip_subscription_tree::notify_sched_id, sip_subscription_tree::root, send_notify(), sip_subscription_tree::send_scheduled_notify, SIP_SUB_TREE_TERMINATE_IN_PROGRESS, SIP_SUB_TREE_TERMINATED, and sip_subscription_tree::state.
Referenced by sched_cb().
|
static |
Definition at line 3720 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, and AST_VECTOR_SIZE.
Referenced by pubsub_on_refresh_timeout().
|
static |
Definition at line 1328 of file res_pjsip_pubsub.c.
References AST_VECTOR_GET, AST_VECTOR_SIZE, ast_sip_subscription::handler, and ast_sip_subscription_handler::subscription_shutdown.
Referenced by pubsub_on_evsub_state().
|
static |
Definition at line 3145 of file res_pjsip_pubsub.c.
References ao2_alloc, ao2_ref, ast_assert, ast_atomic_fetchadd_int(), ast_datastores_alloc(), ast_module_ref, ast_sip_publication::data, ast_sip_publication::datastores, DEFAULT_PUBLISH_EXPIRES, ast_sip_publication::endpoint, ast_sip_publication::entity_tag, esc_etag_counter, ast_sip_publication::event_configuration_name, ast_sip_publication::expires, NULL, publication_destroy_fn(), ast_sip_publication::resource, ast_sip_publication::sched_id, and ast_module_info::self.
Referenced by publish_request_initial().
|
static |
Definition at line 3179 of file res_pjsip_pubsub.c.
References ast_sip_add_header(), ast_sip_get_pjsip_endpoint(), buf, ast_sip_publication::entity_tag, ast_sip_publication::expires, NULL, and pubsub_module.
Referenced by publish_request_initial(), and pubsub_on_rx_publish_request().
|
static |
Definition at line 2606 of file res_pjsip_pubsub.c.
References ast_sip_mod_data_get, create_require_eventlist(), sip_subscription_tree::evsub, sip_subscription_tree::is_list, MOD_DATA_PERSISTENCE, and pubsub_module.
Referenced by pubsub_on_rx_subscribe_request().
|
static |
Definition at line 1989 of file res_pjsip_pubsub.c.
References allocate_tdata_buffer(), ast_log, ast_sorcery_object_get_id(), ast_test_suite_event_notify, sip_subscription_tree::endpoint, sip_subscription_tree::evsub, LOG_ERROR, NULL, SUBSCRIPTION_PERSISTENCE_SEND_REQUEST, and subscription_persistence_update().
Referenced by send_notify().
|
static |
Definition at line 1820 of file res_pjsip_pubsub.c.
References ast_callerid_merge(), ast_copy_pj_str(), ast_copy_string(), ast_sorcery_object_get_id(), ast_str_append(), sip_subscription_tree::dlg, sip_subscription_tree::endpoint, sip_subscription_tree::evsub, ast_sip_subscription::handler, ast_sip_endpoint::id, ast_party_id::name, NULL, ast_party_id::number, sip_subscription_tree::role, sip_subscription_tree::root, S_COR, ast_sip_endpoint_id_configuration::self, sip_subscription_roles_map, str, ast_party_name::str, ast_party_number::str, ast_sip_subscription_handler::to_ami, ast_party_name::valid, and ast_party_number::valid.
Referenced by ami_subscription_detail(), and cli_show_subscription_common().
|
static |
Definition at line 2756 of file res_pjsip_pubsub.c.
References AST_RWLIST_INSERT_TAIL, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, and ast_sip_publish_handler::next.
Referenced by ast_sip_register_subscription_handler().
|
static |
Definition at line 1556 of file res_pjsip_pubsub.c.
References ao2_bump, ao2_ref, ast_alloca, ast_copy_pj_str(), ast_debug, ast_free, ast_log, ast_malloc, ast_sip_get_sorcery(), ast_sip_mod_data_set, ast_sip_pubsub_has_eventlist_support(), ast_sip_push_task(), AST_SIP_USER_OPTIONS_TRUNCATE_CHECK, ast_sorcery_delete(), ast_sorcery_retrieve_by_id(), ast_tvdiff_ms(), ast_tvnow(), build_resource_tree(), create_subscription_tree(), subscription_persistence::endpoint, error(), sip_subscription_tree::evsub, subscription_persistence::expires, initial_notify_data::expires, generator, handler(), initial_notify_task(), LOG_WARNING, MOD_DATA_PERSISTENCE, ast_sip_subscription_handler::notifier, persistence_recreate_data::persistence, pubsub_module, persistence_recreate_data::rdata, resource_tree_destroy(), sip_subscription_tree::serializer, initial_notify_data::sub_tree, subscription_get_generator_from_rdata(), subscription_get_handler_from_rdata(), SUBSCRIPTION_PERSISTENCE_RECREATED, subscription_persistence_update(), and subscription_persistence::tag.
Referenced by subscription_persistence_recreate().
|
static |
Definition at line 572 of file res_pjsip_pubsub.c.
References ao2_ref, ast_debug, subscription_persistence::endpoint, sip_subscription_tree::evsub, sip_subscription_tree::persistence, subscription_persistence::prune_on_boot, sip_subscription_tree::root, SIP_SUB_TREE_TERMINATE_IN_PROGRESS, and sip_subscription_tree::state.
Referenced by sub_tree_transport_cb().
|
static |
Definition at line 603 of file res_pjsip_pubsub.c.
References ao2_ref, ast_sip_push_task(), sip_subscription_tree::serializer, and sub_tree_subscription_terminate_cb().
Referenced by subscription_persistence_remove(), subscription_persistence_update(), and unload_module().
|
static |
Retrieve a body generator using the Accept header of an rdata message.
Definition at line 831 of file res_pjsip_pubsub.c.
References ast_copy_pj_str(), ast_copy_string(), AST_SIP_MAX_ACCEPT, ast_sip_subscription_handler::body_type, ast_sip_notifier::default_accept, exceptional_accept(), find_body_generator(), ast_sip_subscription_handler::notifier, and while().
Referenced by pubsub_on_rx_subscribe_request(), and sub_persistence_recreate().
|
static |
Retrieve a handler using the Event header of an rdata message.
Definition at line 771 of file res_pjsip_pubsub.c.
References ast_copy_pj_str(), ast_log, find_sub_handler_for_event_name(), handler(), LOG_WARNING, NULL, and str_event_name.
Referenced by pubsub_on_rx_subscribe_request(), and sub_persistence_recreate().
|
static |
Allocator for subscription persistence.
Definition at line 631 of file res_pjsip_pubsub.c.
References ast_sorcery_generic_alloc(), and subscription_persistence_destroy().
Referenced by load_module().
|
static |
Function which creates initial persistence information of a subscription in sorcery.
Definition at line 637 of file res_pjsip_pubsub.c.
References ast_copy_pj_str(), ast_sip_get_sorcery(), ast_sorcery_alloc(), ast_sorcery_create(), ast_sorcery_object_get_id(), ast_strdup, sip_subscription_tree::dlg, subscription_persistence::endpoint, sip_subscription_tree::endpoint, NULL, and subscription_persistence::tag.
Referenced by pubsub_on_rx_subscribe_request().
|
static |
Destructor for subscription persistence.
Definition at line 621 of file res_pjsip_pubsub.c.
References ast_free, ast_json_unref(), subscription_persistence::endpoint, subscription_persistence::generator_data, and subscription_persistence::tag.
Referenced by subscription_persistence_alloc().
|
static |
Event callback which fires subscription persistence recreation when the system is fully booted.
Definition at line 1772 of file res_pjsip_pubsub.c.
References ast_json_object_get(), ast_json_string_get(), ast_manager_get_generic_type(), ast_sip_push_task(), ast_json_payload::json, NULL, stasis_message_data(), stasis_message_type(), stasis_unsubscribe(), subscription_persistence_load(), and type.
Referenced by load_module().
|
static |
Function which loads and recreates persisted subscriptions upon startup when the system is fully booted.
Definition at line 1750 of file res_pjsip_pubsub.c.
References ao2_callback, ao2_ref, ast_log, AST_RETRIEVE_FLAG_ALL, AST_RETRIEVE_FLAG_MULTIPLE, ast_sip_get_pjsip_endpoint(), ast_sip_get_sorcery(), ast_sorcery_retrieve_by_fields(), LOG_WARNING, NULL, OBJ_NODATA, pool, and subscription_persistence_recreate().
Referenced by load_module(), and subscription_persistence_event_cb().
|
static |
Callback function to perform the actual recreation of a subscription.
Definition at line 1684 of file res_pjsip_pubsub.c.
References ast_debug, ast_log, ast_sip_create_rdata_with_contact(), ast_sip_get_distributor_serializer(), ast_sip_get_sorcery(), ast_sip_push_task_wait_serializer(), ast_sorcery_delete(), ast_taskprocessor_unreference(), ast_tvdiff_ms(), ast_tvnow(), subscription_persistence::contact_uri, subscription_persistence::endpoint, subscription_persistence::expires, subscription_persistence::local_name, subscription_persistence::local_port, LOG_NOTICE, LOG_WARNING, subscription_persistence::packet, persistence_recreate_data::persistence, pool, subscription_persistence::prune_on_boot, persistence_recreate_data::rdata, subscription_persistence::src_name, subscription_persistence::src_port, sub_persistence_recreate(), subscription_persistence::tag, and subscription_persistence::transport_key.
Referenced by subscription_persistence_load().
|
static |
Function which removes persistence of a subscription from sorcery.
Definition at line 745 of file res_pjsip_pubsub.c.
References ao2_ref, ast_debug, ast_sip_get_sorcery(), AST_SIP_MAX_ACCEPT, ast_sip_transport_monitor_unregister(), ast_sorcery_delete(), ast_sorcery_object_get_id(), ast_sip_pubsub_body_generator::body_type, sip_subscription_tree::endpoint, ast_sip_subscription_handler::event_name, find_body_generator(), find_sub_handler_for_event_name(), NULL, sip_subscription_tree::persistence, subscription_persistence::prune_on_boot, sip_subscription_tree::root, sub_tree_transport_cb(), and sip_subscription_tree::transport.
Referenced by pubsub_on_evsub_state().
|
static |
Function which updates persistence information of a subscription in sorcery.
Definition at line 662 of file res_pjsip_pubsub.c.
References ast_copy_pj_str(), ast_copy_string(), ast_debug, ast_log, ast_samp2tv(), ast_sip_get_sorcery(), ast_sip_transport_monitor_register(), ast_sip_will_uri_survive_restart(), ast_sorcery_update(), ast_tvadd(), ast_tvnow(), subscription_persistence::contact_uri, subscription_persistence::cseq, DEFAULT_PUBLISH_EXPIRES, sip_subscription_tree::dlg, subscription_persistence::endpoint, sip_subscription_tree::endpoint, subscription_persistence::expires, subscription_persistence::local_name, subscription_persistence::local_port, LOG_WARNING, MIN, NULL, subscription_persistence::packet, sip_subscription_tree::persistence, subscription_persistence::prune_on_boot, sip_subscription_tree::root, subscription_persistence::src_name, subscription_persistence::src_port, sub_tree_transport_cb(), SUBSCRIPTION_PERSISTENCE_CREATED, SUBSCRIPTION_PERSISTENCE_RECREATED, sip_subscription_tree::transport, and subscription_persistence::transport_key.
Referenced by pubsub_on_rx_refresh(), pubsub_on_rx_subscribe_request(), sip_subscription_send_request(), and sub_persistence_recreate().
|
static |
Definition at line 1396 of file res_pjsip_pubsub.c.
References ast_sip_dialog_set_endpoint(), ast_sip_dialog_set_serializer(), sip_subscription_tree::dlg, sip_subscription_tree::endpoint, sip_subscription_tree::evsub, pubsub_module, and sip_subscription_tree::serializer.
Referenced by ast_sip_create_subscription(), and create_subscription_tree().
|
static |
Definition at line 1367 of file res_pjsip_pubsub.c.
References ao2_cleanup, ast_debug, ast_module_unref, ast_sip_push_task_wait_servant(), ast_sorcery_object_get_id(), ast_taskprocessor_unreference(), destroy_subscriptions(), sip_subscription_tree::dlg, sip_subscription_tree::endpoint, sip_subscription_tree::root, ast_module_info::self, sip_subscription_tree::serializer, and subscription_unreference_dialog().
Referenced by allocate_subscription_tree().
|
static |
Definition at line 1348 of file res_pjsip_pubsub.c.
References sip_subscription_tree::dlg, NULL, and pubsub_module.
Referenced by subscription_tree_destructor().
|
static |
new_subscribe callback for unit tests
Will give a 200 OK response to any resource except the "bad" ones.
Definition at line 4901 of file res_pjsip_pubsub.c.
References ARRAY_LEN, and bad_resources.
|
static |
RAII_VAR callback to destroy an allocated resource tree.
Definition at line 5047 of file res_pjsip_pubsub.c.
References ast_free, and resource_tree_destroy().
Referenced by AST_TEST_DEFINE().
|
static |
Allocate a tree node.
In addition to allocating and initializing the tree node, the node is also added to the vector of visited resources. See build_resource_tree for more information on the visited resources.
resource | The name of the resource for this tree node. |
visited | The vector of resources that have been visited. |
if | allocating a list, indicate whether full state is requested in notifications. |
NULL | Allocation failure. |
non-NULL | The newly-allocated tree_node |
Definition at line 934 of file res_pjsip_pubsub.c.
References ast_calloc, ast_free, AST_VECTOR_APPEND, AST_VECTOR_INIT, resource_list::full_state, and NULL.
Referenced by build_node_children(), and build_resource_tree().
|
static |
Destructor for a tree node.
This function calls recursively in order to destroy all nodes lower in the tree from the given node in addition to the node itself.
node | The node to destroy. |
Definition at line 965 of file res_pjsip_pubsub.c.
References ast_free, AST_VECTOR_FREE, AST_VECTOR_GET, and AST_VECTOR_SIZE.
Referenced by build_node_children(), and resource_tree_destroy().
|
static |
Definition at line 5682 of file res_pjsip_pubsub.c.
References AMI_SHOW_SUBSCRIPTIONS_INBOUND, AMI_SHOW_SUBSCRIPTIONS_OUTBOUND, ARRAY_LEN, ast_cli_unregister_multiple(), ast_manager_unregister(), AST_MODFLAG_GLOBAL_SYMBOLS, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CHANNEL_DEPEND, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ast_sched_context_destroy(), ast_sip_transport_monitor_unregister_all(), ast_sip_unregister_service(), AST_TEST_UNREGISTER, ASTERISK_GPL_KEY, load_module(), NULL, pubsub_module, and sub_tree_transport_cb().
|
static |
Definition at line 5714 of file res_pjsip_pubsub.c.
const char* accept_exceptions[] |
Accept headers that are exceptions to the rule.
Typically, when a SUBSCRIBE arrives, we attempt to find a body generator that matches one of the Accept headers in the request. When subscribing to a single resource, this works great. However, when subscribing to a list, things work differently. Most Accept header values are fine, but there are a couple that are endemic to resource lists that need to be ignored when searching for a body generator to use for the individual resources of the subscription.
Definition at line 806 of file res_pjsip_pubsub.c.
Referenced by exceptional_accept().
|
static |
Definition at line 5714 of file res_pjsip_pubsub.c.
const char* bad_resources[] |
"bad" resources
These are resources that the test handler will reject subscriptions to.
Definition at line 4889 of file res_pjsip_pubsub.c.
Referenced by test_new_subscribe().
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 |
Definition at line 4667 of file res_pjsip_pubsub.c.
|
static |
Used to create new entity IDs by ESCs.
Definition at line 340 of file res_pjsip_pubsub.c.
Referenced by pubsub_on_rx_publish_request(), and sip_create_publication().
const pjsip_method pjsip_publish_method |
Defined method for PUBLISH.
Definition at line 256 of file res_pjsip_pubsub.c.
Referenced by pubsub_on_rx_request().
struct publish_handlers publish_handlers = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
|
static |
Definition at line 549 of file res_pjsip_pubsub.c.
Referenced by ast_sip_create_subscription(), and create_subscription_tree().
|
static |
Definition at line 229 of file res_pjsip_pubsub.c.
Referenced by ast_sip_pubsub_register_body_generator(), ast_sip_register_subscription_handler(), ast_sip_subscription_get_header(), create_subscription_tree(), load_module(), pubsub_on_client_refresh(), pubsub_on_evsub_state(), pubsub_on_rx_notify(), pubsub_on_rx_refresh(), pubsub_on_server_timeout(), sip_publication_respond(), sip_subscription_accept(), sub_persistence_recreate(), subscription_setup_dialog(), subscription_unreference_dialog(), and unload_module().
|
static |
Definition at line 539 of file res_pjsip_pubsub.c.
Referenced by build_rlmi_body(), and load_module().
|
static |
Scheduler used for automatically expiring publications.
Definition at line 241 of file res_pjsip_pubsub.c.
|
static |
Definition at line 518 of file res_pjsip_pubsub.c.
Referenced by sip_subscription_to_ami().
|
static |
Definition at line 238 of file res_pjsip_pubsub.c.
Referenced by pubsub_on_rx_publish_request(), and subscription_get_handler_from_rdata().
|
static |
Definition at line 415 of file res_pjsip_pubsub.c.
Referenced by pubsub_on_evsub_state(), pubsub_on_refresh_timeout(), pubsub_on_rx_refresh(), and serialized_pubsub_on_refresh_timeout().
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} } , } |
struct ast_sip_subscription_handler test_handler |
Subscription handler for unit tests.
Definition at line 4927 of file res_pjsip_pubsub.c.
struct ast_sip_notifier test_notifier |
Subscription notifier for unit tests.
Since unit tests are only concerned with building a resource tree, only the new_subscribe callback needs to be defined.
Definition at line 4920 of file res_pjsip_pubsub.c.