Asterisk - The Open Source Telephony Project GIT-master-0644429
|
XMPP client and component module. More...
#include "asterisk.h"
#include <ctype.h>
#include <iksemel.h>
#include "asterisk/xmpp.h"
#include "asterisk/module.h"
#include "asterisk/manager.h"
#include "asterisk/app.h"
#include "asterisk/mwi.h"
#include "asterisk/message.h"
#include "asterisk/cli.h"
#include "asterisk/config_options.h"
#include "asterisk/json.h"
Go to the source code of this file.
Data Structures | |
struct | ast_xmpp_client_config |
XMPP Client Configuration. More... | |
struct | ast_xmpp_global_config |
XMPP Global Configuration. More... | |
struct | xmpp_config |
struct | xmpp_pak_handler |
Defined handlers for different PAK types. More... | |
struct | xmpp_state_handler |
Defined handlers for XMPP client states. More... | |
Macros | |
#define | BUDDY_BUCKETS 53 |
Number of buckets for buddies (per client) More... | |
#define | BUDDY_NOT_IN_ROSTER 7 |
#define | BUDDY_OFFLINE 6 |
#define | CLIENT_BUCKETS 53 |
Number of buckets for client connections. More... | |
#define | RESOURCE_BUCKETS 53 |
Number of buckets for resources (per buddy) More... | |
#define | STATUS_DISAPPEAR 6 |
Status for a disappearing buddy. More... | |
#define | XMPP_TLS_NS "urn:ietf:params:xml:ns:xmpp-tls" |
Namespace for TLS support. More... | |
Enumerations | |
enum | { XMPP_AUTOPRUNE = (1 << 0) , XMPP_AUTOREGISTER = (1 << 1) , XMPP_AUTOACCEPT = (1 << 2) , XMPP_DEBUG = (1 << 3) , XMPP_USETLS = (1 << 4) , XMPP_USESASL = (1 << 5) , XMPP_FORCESSL = (1 << 6) , XMPP_KEEPALIVE = (1 << 7) , XMPP_COMPONENT = (1 << 8) , XMPP_SEND_TO_DIALPLAN = (1 << 9) , XMPP_DISTRIBUTE_EVENTS = (1 << 10) } |
Supported general configuration flags. More... | |
enum | { XMPP_XEP0248 = (1 << 0) , XMPP_PUBSUB = (1 << 1) , XMPP_PUBSUB_AUTOCREATE = (1 << 2) } |
Supported pubsub configuration flags. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | acf_jabberreceive_read (struct ast_channel *chan, const char *name, char *data, char *buf, size_t buflen) |
static int | acf_jabberstatus_read (struct ast_channel *chan, const char *name, char *data, char *buf, size_t buflen) |
static | AO2_GLOBAL_OBJ_STATIC (globals) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
int | ast_xmpp_chatroom_invite (struct ast_xmpp_client *client, const char *user, const char *room, const char *message) |
Invite a user to an XMPP multi-user chatroom. More... | |
int | ast_xmpp_chatroom_join (struct ast_xmpp_client *client, const char *room, const char *nickname) |
Join an XMPP multi-user chatroom. More... | |
int | ast_xmpp_chatroom_leave (struct ast_xmpp_client *client, const char *room, const char *nickname) |
Leave an XMPP multi-user chatroom. More... | |
int | ast_xmpp_chatroom_send (struct ast_xmpp_client *client, const char *nickname, const char *address, const char *message) |
Send a message to an XMPP multi-user chatroom. More... | |
static void * | ast_xmpp_client_config_alloc (const char *cat) |
Allocator function for configuration. More... | |
static void | ast_xmpp_client_config_destructor (void *obj) |
Destructor function for configuration. More... | |
int | ast_xmpp_client_disconnect (struct ast_xmpp_client *client) |
Disconnect an XMPP client connection. More... | |
struct ast_xmpp_client * | ast_xmpp_client_find (const char *name) |
Find an XMPP client connection using a given name. More... | |
void | ast_xmpp_client_lock (struct ast_xmpp_client *client) |
Lock an XMPP client connection. More... | |
int | ast_xmpp_client_send (struct ast_xmpp_client *client, iks *stanza) |
Send an XML stanza out using an established XMPP client connection. More... | |
int | ast_xmpp_client_send_message (struct ast_xmpp_client *client, const char *user, const char *message) |
Send a message to a given user using an established XMPP client connection. More... | |
void | ast_xmpp_client_unlock (struct ast_xmpp_client *client) |
Unlock an XMPP client connection. More... | |
void | ast_xmpp_client_unref (struct ast_xmpp_client *client) |
Release XMPP client connection reference. More... | |
void | ast_xmpp_increment_mid (char *mid) |
Helper function which increments the message identifier. More... | |
static int | cached_devstate_cb (void *obj, void *arg, int flags) |
static int | client_bitfield_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | client_buddy_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | client_status_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
CONFIG_INFO_STANDARD (cfg_info, globals, xmpp_config_alloc,.files=ACO_FILES(&res_xmpp_conf),.post_apply_config=xmpp_config_post_apply,) | |
static int | delete_old_messages (struct ast_xmpp_client *client, char *from) |
static int | fetch_access_token (struct ast_xmpp_client_config *cfg) |
static int | get_buddy_status (struct ast_xmpp_client_config *clientcfg, char *screenname, char *resource) |
static int | global_bitfield_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static int | load_module (void) |
Load the module. More... | |
static int | manager_jabber_send (struct mansession *s, const struct message *m) |
static int | reload (void) |
static void | sleep_with_backoff (unsigned int *sleep_time) |
static int | unload_module (void) |
static int | xmpp_action_hook (void *data, int type, iks *node) |
Action hook for when things occur. More... | |
static int | xmpp_buddy_cmp (void *obj, void *arg, int flags) |
Comparator function for XMPP buddy. More... | |
static void | xmpp_buddy_destructor (void *obj) |
Destructor callback function for XMPP buddy. More... | |
static int | xmpp_buddy_hash (const void *obj, const int flags) |
Hashing function for XMPP buddy. More... | |
static char * | xmpp_cli_create_collection (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Method to expose PubSub collection node creation via CLI. More... | |
static char * | xmpp_cli_create_leafnode (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Method to expose PubSub leaf node creation via CLI. More... | |
static char * | xmpp_cli_delete_pubsub_node (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Method to expose PubSub node deletion via CLI. More... | |
static char * | xmpp_cli_list_pubsub_nodes (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Method to expose PubSub node list via CLI. More... | |
static char * | xmpp_cli_purge_pubsub_nodes (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Method to purge PubSub nodes via CLI. More... | |
static struct ast_xmpp_client * | xmpp_client_alloc (const char *name) |
Allocator function for ast_xmpp_client. More... | |
static int | xmpp_client_authenticate (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we need to authenticate. More... | |
static int | xmpp_client_authenticate_digest (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we need to authenticate using non-SASL. More... | |
static int | xmpp_client_authenticate_sasl (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we need to authenticate using SASL. More... | |
static int | xmpp_client_authenticating (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we are authenticating. More... | |
static void | xmpp_client_change_state (struct ast_xmpp_client *client, int state) |
Internal function which changes the XMPP client state. More... | |
static int | xmpp_client_config_merge_buddies (void *obj, void *arg, int flags) |
static int | xmpp_client_config_post_apply (void *obj, void *arg, int flags) |
static struct ast_xmpp_buddy * | xmpp_client_create_buddy (struct ao2_container *container, const char *id) |
Internal function which creates a buddy on a client. More... | |
static void | xmpp_client_destructor (void *obj) |
Destructor callback function for XMPP client. More... | |
static void * | xmpp_client_find_or_create (const char *category) |
Look up existing client or create a new one. More... | |
static int | xmpp_client_receive (struct ast_xmpp_client *client, unsigned int timeout) |
Internal function which receives data from the XMPP client connection. More... | |
static int | xmpp_client_reconnect (struct ast_xmpp_client *client) |
Internal function used to reconnect an XMPP client to its server. More... | |
static int | xmpp_client_request_tls (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we need to request TLS support. More... | |
static int | xmpp_client_requested_tls (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we receive a response to our TLS initiation request. More... | |
static int | xmpp_client_send_disco_info_request (struct ast_xmpp_client *client, const char *to, const char *from) |
Helper function which sends a discovery information request to a user. More... | |
static int | xmpp_client_send_message (struct ast_xmpp_client *client, int group, const char *nick, const char *address, const char *message) |
Internal function used to send a message to a user or chatroom. More... | |
static int | xmpp_client_send_raw_message (struct ast_xmpp_client *client, const char *message) |
Internal function which sends a raw message. More... | |
static int | xmpp_client_service_discovery_get_hook (void *data, ikspak *pak) |
Hook function called when client receives a service discovery get message. More... | |
static int | xmpp_client_service_discovery_result_hook (void *data, ikspak *pak) |
Hook function called when client receives a service discovery result message. More... | |
static int | xmpp_client_set_group_presence (struct ast_xmpp_client *client, const char *room, int level, const char *nick) |
static void | xmpp_client_set_presence (struct ast_xmpp_client *client, const char *to, const char *from, int level, const char *desc) |
Internal function which changes the presence status of an XMPP client. More... | |
static int | xmpp_client_subscribe_user (void *obj, void *arg, int flags) |
Callback function which subscribes to a user if needed. More... | |
static void * | xmpp_client_thread (void *data) |
XMPP client connection thread. More... | |
static int | xmpp_client_unsubscribe_user (struct ast_xmpp_client *client, const char *user) |
Helper function which unsubscribes a user and removes them from the roster. More... | |
static int | xmpp_component_authenticate (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we should authenticate as a component. More... | |
static int | xmpp_component_authenticating (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) |
Internal function called when we authenticated as a component. More... | |
static int | xmpp_component_register_get_hook (void *data, ikspak *pak) |
Hook function called when the component is queried about registration. More... | |
static int | xmpp_component_register_set_hook (void *data, ikspak *pak) |
Hook function called when someone registers to the component. More... | |
static int | xmpp_component_service_discovery_get_hook (void *data, ikspak *pak) |
Hook function called when component receives a service discovery get message. More... | |
static int | xmpp_component_service_discovery_items_hook (void *data, ikspak *pak) |
Hook function called when we receive a service discovery items request. More... | |
static void * | xmpp_config_alloc (void) |
Allocator for XMPP configuration. More... | |
static int | xmpp_config_cmp (void *obj, void *arg, int flags) |
Comparator function for configuration. More... | |
static void | xmpp_config_destructor (void *obj) |
Destructor for XMPP configuration. More... | |
static void * | xmpp_config_find (struct ao2_container *tmp_container, const char *category) |
Find function for configuration. More... | |
static void | xmpp_config_post_apply (void) |
static int | xmpp_config_prelink (void *newitem) |
static int | xmpp_connect_hook (void *data, ikspak *pak) |
Hook function called when client finishes authenticating with the server. More... | |
static char * | xmpp_do_set_debug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void | xmpp_init_event_distribution (struct ast_xmpp_client *client) |
Initialize collections for event distribution. More... | |
static int | xmpp_io_recv (struct ast_xmpp_client *client, char *buffer, size_t buf_len, int timeout) |
Internal function which polls on an XMPP client and receives data. More... | |
static int | xmpp_is_secure (struct ast_xmpp_client *client) |
Helper function which returns whether an XMPP client connection is secure or not. More... | |
static int | xmpp_join_exec (struct ast_channel *chan, const char *data) |
Application to join a chat room. More... | |
static int | xmpp_leave_exec (struct ast_channel *chan, const char *data) |
Application to leave a chat room. More... | |
static void | xmpp_log_hook (void *data, const char *xmpp, size_t size, int incoming) |
Logging hook function. More... | |
static void | xmpp_message_destroy (struct ast_xmpp_message *message) |
Destroy function for XMPP messages. More... | |
static int | xmpp_pak_message (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, iks *node, ikspak *pak) |
Internal function called when a message is received. More... | |
static int | xmpp_pak_presence (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, iks *node, ikspak *pak) |
Internal function called when a presence message is received. More... | |
static int | xmpp_pak_s10n (struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, iks *node, ikspak *pak) |
Internal function called when a subscription message is received. More... | |
static int | xmpp_ping_request (struct ast_xmpp_client *client, const char *to, const char *from) |
Helper function which sends a ping request to a server. More... | |
static iks * | xmpp_pubsub_build_node_config (iks *pubsub, const char *node_type, const char *collection_name) |
static iks * | xmpp_pubsub_build_node_request (struct ast_xmpp_client *client, const char *collection) |
Build the a node request. More... | |
static iks * | xmpp_pubsub_build_publish_skeleton (struct ast_xmpp_client *client, const char *node, const char *event_type, unsigned int cachable) |
Build the skeleton of a publish. More... | |
static void | xmpp_pubsub_create_affiliations (struct ast_xmpp_client *client, const char *node) |
Add Owner affiliations for pubsub node. More... | |
static void | xmpp_pubsub_create_collection (struct ast_xmpp_client *client, const char *collection_name) |
Create a PubSub collection node. More... | |
static void | xmpp_pubsub_create_leaf (struct ast_xmpp_client *client, const char *collection_name, const char *leaf_name) |
Create a PubSub leaf node. More... | |
static void | xmpp_pubsub_create_node (struct ast_xmpp_client *client, const char *node_type, const char *name, const char *collection_name) |
Create a pubsub node. More... | |
static void | xmpp_pubsub_delete_node (struct ast_xmpp_client *client, const char *node_name) |
Delete a PubSub node. More... | |
static int | xmpp_pubsub_delete_node_list (void *data, ikspak *pak) |
Delete pubsub item lists. More... | |
static void | xmpp_pubsub_devstate_cb (void *data, struct stasis_subscription *sub, struct stasis_message *msg) |
Callback function for device state events. More... | |
static int | xmpp_pubsub_handle_error (void *data, ikspak *pak) |
static int | xmpp_pubsub_handle_event (void *data, ikspak *pak) |
Callback for handling PubSub events. More... | |
static iks * | xmpp_pubsub_iq_create (struct ast_xmpp_client *client, const char *type) |
Create an IQ packet. More... | |
static void | xmpp_pubsub_mwi_cb (void *data, struct stasis_subscription *sub, struct stasis_message *msg) |
Callback function for MWI events. More... | |
static void | xmpp_pubsub_publish_device_state (struct ast_xmpp_client *client, const char *device, const char *device_state, unsigned int cachable) |
Publish device state to a PubSub node. More... | |
static void | xmpp_pubsub_publish_mwi (struct ast_xmpp_client *client, const char *mailbox, const char *oldmsgs, const char *newmsgs) |
Publish MWI to a PubSub node. More... | |
static void | xmpp_pubsub_purge_nodes (struct ast_xmpp_client *client, const char *collection_name) |
static int | xmpp_pubsub_receive_node_list (void *data, ikspak *pak) |
Receive pubsub item lists. More... | |
static void | xmpp_pubsub_request_nodes (struct ast_xmpp_client *client, const char *collection) |
Request item list from pubsub. More... | |
static void | xmpp_pubsub_subscribe (struct ast_xmpp_client *client, const char *node) |
Subscribe to a PubSub node. More... | |
static void | xmpp_pubsub_unsubscribe (struct ast_xmpp_client *client, const char *node) |
Unsubscribe from a PubSub node. More... | |
static int | xmpp_resource_cmp (void *obj, void *arg, int flags) |
Comparator function for XMPP resource. More... | |
static void | xmpp_resource_destructor (void *obj) |
Destructor callback function for XMPP resource. More... | |
static int | xmpp_resource_hash (const void *obj, const int flags) |
Hashing function for XMPP resource. More... | |
static int | xmpp_resource_immediate (void *obj, void *arg, int flags) |
Internal astobj2 callback function which returns the first resource, which is the highest priority one. More... | |
static int | xmpp_resource_is_available (void *obj, void *arg, int flags) |
Callback function which returns when the resource is available. More... | |
static int | xmpp_roster_hook (void *data, ikspak *pak) |
Hook function called when roster is received from server. More... | |
static int | xmpp_send_cb (const struct ast_msg *msg, const char *to, const char *from) |
static int | xmpp_send_exec (struct ast_channel *chan, const char *data) |
static int | xmpp_send_stream_header (struct ast_xmpp_client *client, const struct ast_xmpp_client_config *cfg, const char *to) |
Helper function which sends an XMPP stream header to the server. More... | |
static int | xmpp_sendgroup_exec (struct ast_channel *chan, const char *data) |
Application to send a message to a groupchat. More... | |
static char * | xmpp_show_buddies (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | xmpp_show_clients (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_GLOBAL_SYMBOLS | AST_MODFLAG_LOAD_ORDER , .description = "Asterisk XMPP Interface" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload, .load_pri = AST_MODPRI_CHANNEL_DEPEND, } |
static const char * | app_ajijoin = "JabberJoin" |
static const char * | app_ajileave = "JabberLeave" |
static const char * | app_ajisend = "JabberSend" |
static const char * | app_ajisendgroup = "JabberSendGroup" |
static const char * | app_ajistatus = "JabberStatus" |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct aco_type | client_option |
struct aco_type * | client_options [] = ACO_TYPES(&client_option) |
static int | debug |
Global debug status. More... | |
static struct aco_type | global_option |
struct aco_type * | global_options [] = ACO_TYPES(&global_option) |
static struct ast_custom_function | jabberreceive_function |
static struct ast_custom_function | jabberstatus_function |
static ast_cond_t | message_received_condition |
static ast_mutex_t | messagelock |
static const struct ast_msg_tech | msg_tech |
struct aco_file | res_xmpp_conf |
static struct ast_cli_entry | xmpp_cli [] |
static const struct xmpp_pak_handler | xmpp_pak_handlers [] |
static const struct xmpp_state_handler | xmpp_state_handlers [] |
XMPP client and component module.
Iksemel http://code.google.com/p/iksemel/
A reference module for interfacting Asterisk directly as a client or component with an XMPP/Jabber compliant server.
This module is based upon the original res_jabber as done by Matt O'Gorman.
Definition in file res_xmpp.c.
#define BUDDY_BUCKETS 53 |
Number of buckets for buddies (per client)
Definition at line 429 of file res_xmpp.c.
#define BUDDY_NOT_IN_ROSTER 7 |
Definition at line 1628 of file res_xmpp.c.
#define BUDDY_OFFLINE 6 |
Definition at line 1627 of file res_xmpp.c.
#define CLIENT_BUCKETS 53 |
Number of buckets for client connections.
Definition at line 426 of file res_xmpp.c.
#define RESOURCE_BUCKETS 53 |
Number of buckets for resources (per buddy)
Definition at line 432 of file res_xmpp.c.
#define STATUS_DISAPPEAR 6 |
Status for a disappearing buddy.
Definition at line 438 of file res_xmpp.c.
#define XMPP_TLS_NS "urn:ietf:params:xml:ns:xmpp-tls" |
Namespace for TLS support.
Definition at line 435 of file res_xmpp.c.
anonymous enum |
Supported general configuration flags.
Enumerator | |
---|---|
XMPP_AUTOPRUNE | |
XMPP_AUTOREGISTER | |
XMPP_AUTOACCEPT | |
XMPP_DEBUG | |
XMPP_USETLS | |
XMPP_USESASL | |
XMPP_FORCESSL | |
XMPP_KEEPALIVE | |
XMPP_COMPONENT | |
XMPP_SEND_TO_DIALPLAN | |
XMPP_DISTRIBUTE_EVENTS |
Definition at line 404 of file res_xmpp.c.
anonymous enum |
Supported pubsub configuration flags.
Enumerator | |
---|---|
XMPP_XEP0248 | |
XMPP_PUBSUB | |
XMPP_PUBSUB_AUTOCREATE |
Definition at line 419 of file res_xmpp.c.
|
static |
Definition at line 4703 of file res_xmpp.c.
|
static |
Definition at line 4703 of file res_xmpp.c.
|
static |
Definition at line 1933 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, args, AST_APP_ARG, ast_autoservice_start(), ast_autoservice_stop(), ast_channel_name(), ast_cond_timedwait, ast_copy_string(), ast_debug, AST_DECLARE_APP_ARGS, AST_LIST_EMPTY, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_log, ast_mutex_lock, ast_mutex_unlock, AST_NONSTANDARD_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_tv(), ast_tvadd(), ast_tvdiff_ms(), ast_tvdiff_sec(), ast_tvnow(), buf, globals, LOG_NOTICE, LOG_WARNING, ast_xmpp_message::message, message_received_condition, messagelock, name, NULL, RAII_VAR, xmpp_config_find(), XMPP_MAX_JIDLEN, and xmpp_message_destroy().
|
static |
Definition at line 1666 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_NONSTANDARD_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strlen_zero(), buf, get_buddy_status(), globals, LOG_ERROR, LOG_WARNING, NULL, RAII_VAR, and xmpp_config_find().
|
static |
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 4703 of file res_xmpp.c.
int ast_xmpp_chatroom_invite | ( | struct ast_xmpp_client * | client, |
const char * | user, | ||
const char * | room, | ||
const char * | message | ||
) |
Invite a user to an XMPP multi-user chatroom.
client | Pointer to the client |
user | JID of the user |
room | Name of the chatroom |
message | Message to send with the invitation |
0 | on success |
-1 | on failure |
Definition at line 943 of file res_xmpp.c.
References ast_xmpp_client_lock(), ast_xmpp_client_send(), ast_xmpp_client_unlock(), ast_xmpp_increment_mid(), done, ast_xmpp_client::mid, and NULL.
int ast_xmpp_chatroom_join | ( | struct ast_xmpp_client * | client, |
const char * | room, | ||
const char * | nickname | ||
) |
Join an XMPP multi-user chatroom.
client | Pointer to the client |
room | Name of the chatroom |
nickname | Nickname to use |
0 | on success |
-1 | on failure |
Definition at line 1010 of file res_xmpp.c.
References xmpp_client_set_group_presence().
Referenced by xmpp_join_exec().
int ast_xmpp_chatroom_leave | ( | struct ast_xmpp_client * | client, |
const char * | room, | ||
const char * | nickname | ||
) |
Leave an XMPP multi-user chatroom.
client | Pointer to the client |
room | Name of the chatroom |
nickname | Nickname being used |
0 | on success |
-1 | on failure |
Definition at line 1020 of file res_xmpp.c.
References xmpp_client_set_group_presence().
Referenced by xmpp_leave_exec().
int ast_xmpp_chatroom_send | ( | struct ast_xmpp_client * | client, |
const char * | nickname, | ||
const char * | address, | ||
const char * | message | ||
) |
Send a message to an XMPP multi-user chatroom.
client | Pointer to the client |
nickname | Nickname to use |
address | Address of the room |
message | Message itself |
0 | on success |
-1 | on failure |
Definition at line 1015 of file res_xmpp.c.
References xmpp_client_send_message().
Referenced by xmpp_sendgroup_exec().
|
static |
Allocator function for configuration.
Definition at line 677 of file res_xmpp.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_ref, ast_string_field_init, ast_string_field_set, ast_xmpp_client_config_destructor(), ast_xmpp_client_config::buddies, BUDDY_BUCKETS, ast_xmpp_client_config::client, name, NULL, xmpp_buddy_cmp(), xmpp_buddy_hash(), and xmpp_client_find_or_create().
|
static |
Destructor function for configuration.
Definition at line 529 of file res_xmpp.c.
References ao2_cleanup, ast_string_field_free_memory, ast_xmpp_client_config::buddies, and ast_xmpp_client_config::client.
Referenced by ast_xmpp_client_config_alloc().
int ast_xmpp_client_disconnect | ( | struct ast_xmpp_client * | client | ) |
Disconnect an XMPP client connection.
client | Pointer to the client |
0 | on success |
-1 | on failure |
Definition at line 3525 of file res_xmpp.c.
References AST_PTHREADT_NULL, ast_xmpp_client::device_state_sub, ast_xmpp_client::mwi_sub, NULL, ast_xmpp_client::parser, stasis_unsubscribe_and_join(), ast_xmpp_client::thread, xmpp_client_change_state(), xmpp_pubsub_unsubscribe(), XMPP_STATE_DISCONNECTED, and XMPP_STATE_DISCONNECTING.
Referenced by xmpp_client_config_post_apply(), xmpp_client_destructor(), xmpp_client_reconnect(), and xmpp_client_thread().
struct ast_xmpp_client * ast_xmpp_client_find | ( | const char * | name | ) |
Find an XMPP client connection using a given name.
name | Name of the client connection |
non-NULL | on success |
NULL | on failure |
Definition at line 881 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_ref, globals, name, NULL, RAII_VAR, and xmpp_config_find().
Referenced by custom_connection_handler().
void ast_xmpp_client_lock | ( | struct ast_xmpp_client * | client | ) |
Lock an XMPP client connection.
client | Pointer to the client |
Definition at line 899 of file res_xmpp.c.
References ao2_lock.
Referenced by ast_xmpp_chatroom_invite(), xmpp_client_authenticate_digest(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_component_register_set_hook(), xmpp_pak_message(), xmpp_ping_request(), and xmpp_pubsub_iq_create().
int ast_xmpp_client_send | ( | struct ast_xmpp_client * | client, |
iks * | stanza | ||
) |
Send an XML stanza out using an established XMPP client connection.
client | Pointer to the client |
stanza | Pointer to the Iksemel stanza |
0 | on success |
-1 | on failure |
Definition at line 2534 of file res_xmpp.c.
References xmpp_client_send_raw_message().
Referenced by ast_xmpp_chatroom_invite(), jingle_send_error_response(), jingle_send_response(), jingle_send_session_action(), jingle_send_session_info(), jingle_send_session_terminate(), jingle_send_transport_info(), xmpp_client_authenticate_digest(), xmpp_client_authenticate_sasl(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_client_send_message(), xmpp_client_service_discovery_get_hook(), xmpp_client_set_group_presence(), xmpp_client_set_presence(), xmpp_client_subscribe_user(), xmpp_client_unsubscribe_user(), xmpp_component_register_get_hook(), xmpp_component_register_set_hook(), xmpp_component_service_discovery_get_hook(), xmpp_component_service_discovery_items_hook(), xmpp_connect_hook(), xmpp_pak_s10n(), xmpp_ping_request(), xmpp_pubsub_create_affiliations(), xmpp_pubsub_create_node(), xmpp_pubsub_delete_node(), xmpp_pubsub_handle_error(), xmpp_pubsub_publish_device_state(), xmpp_pubsub_publish_mwi(), xmpp_pubsub_purge_nodes(), xmpp_pubsub_request_nodes(), xmpp_pubsub_subscribe(), and xmpp_pubsub_unsubscribe().
int ast_xmpp_client_send_message | ( | struct ast_xmpp_client * | client, |
const char * | user, | ||
const char * | message | ||
) |
Send a message to a given user using an established XMPP client connection.
client | Pointer to the client |
user | User the message should be sent to |
message | The message to send |
0 | on success |
-1 | on failure |
Definition at line 938 of file res_xmpp.c.
References NULL, and xmpp_client_send_message().
Referenced by jingle_sendtext(), manager_jabber_send(), xmpp_send_cb(), and xmpp_send_exec().
void ast_xmpp_client_unlock | ( | struct ast_xmpp_client * | client | ) |
Unlock an XMPP client connection.
client | Pointer to the client |
Definition at line 904 of file res_xmpp.c.
References ao2_unlock.
Referenced by ast_xmpp_chatroom_invite(), xmpp_client_authenticate_digest(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_component_register_set_hook(), xmpp_pak_message(), xmpp_ping_request(), and xmpp_pubsub_iq_create().
void ast_xmpp_client_unref | ( | struct ast_xmpp_client * | client | ) |
Release XMPP client connection reference.
client | Pointer to the client |
Definition at line 894 of file res_xmpp.c.
References ao2_ref.
Referenced by jingle_endpoint_destructor(), and jingle_session_destructor().
void ast_xmpp_increment_mid | ( | char * | mid | ) |
Helper function which increments the message identifier.
mid | Pointer to a string containing the message identifier |
Definition at line 1025 of file res_xmpp.c.
Referenced by ast_xmpp_chatroom_invite(), jingle_send_session_action(), jingle_send_session_info(), jingle_send_session_terminate(), jingle_send_transport_info(), xmpp_client_authenticate_digest(), xmpp_client_authenticating(), xmpp_client_send_disco_info_request(), xmpp_component_register_set_hook(), xmpp_ping_request(), and xmpp_pubsub_iq_create().
|
static |
Definition at line 1571 of file res_xmpp.c.
References ast_xmpp_client::device_state_sub, and xmpp_pubsub_devstate_cb().
Referenced by xmpp_init_event_distribution().
|
static |
Definition at line 4525 of file res_xmpp.c.
References ast_set2_flag, ast_true(), ast_xmpp_client_config::flags, ast_xmpp_client_config::mod_flags, var, XMPP_AUTOACCEPT, XMPP_AUTOPRUNE, XMPP_AUTOREGISTER, XMPP_COMPONENT, XMPP_DEBUG, XMPP_DISTRIBUTE_EVENTS, XMPP_FORCESSL, XMPP_KEEPALIVE, XMPP_SEND_TO_DIALPLAN, XMPP_USESASL, and XMPP_USETLS.
Referenced by load_module().
|
static |
Definition at line 4590 of file res_xmpp.c.
References ao2_find, ao2_ref, ast_xmpp_client_config::buddies, OBJ_KEY, var, and xmpp_client_create_buddy().
Referenced by load_module().
|
static |
Definition at line 4561 of file res_xmpp.c.
References ast_xmpp_client_config::status, and var.
Referenced by load_module().
CONFIG_INFO_STANDARD | ( | cfg_info | , |
globals | , | ||
xmpp_config_alloc | , | ||
. | files = ACO_FILES(&res_xmpp_conf) , |
||
. | post_apply_config = xmpp_config_post_apply |
||
) |
|
static |
Definition at line 2092 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, AST_LIST_LOCK, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, AST_LIST_UNLOCK, ast_tvdiff_sec(), ast_tvnow(), ast_xmpp_message::from, globals, ast_xmpp_message::list, ast_xmpp_client::messages, ast_xmpp_client::name, NULL, RAII_VAR, xmpp_config_find(), and xmpp_message_destroy().
Referenced by xmpp_pak_message().
|
static |
Definition at line 3824 of file res_xmpp.c.
References ast_asprintf, ast_debug, ast_free, ast_func_read(), ast_json_load_string(), ast_json_object_get(), ast_json_string_get(), ast_json_unref(), ast_log, ast_string_field_set, error(), LOG_ERROR, ast_xmpp_client_config::name, NULL, ast_xmpp_client_config::oauth_clientid, ast_xmpp_client_config::oauth_secret, RAII_VAR, ast_xmpp_client_config::refresh_token, and url.
Referenced by xmpp_client_reconnect().
|
static |
Definition at line 1630 of file res_xmpp.c.
References ao2_callback, ao2_cleanup, ao2_find, ast_strlen_zero(), ast_xmpp_client::buddies, BUDDY_NOT_IN_ROSTER, BUDDY_OFFLINE, ast_xmpp_client_config::client, OBJ_KEY, ast_xmpp_buddy::resources, status, ast_xmpp_resource::status, xmpp_resource_cmp(), and xmpp_resource_immediate().
Referenced by acf_jabberstatus_read().
|
static |
Definition at line 4502 of file res_xmpp.c.
References ast_set2_flag, ast_true(), debug, global, var, XMPP_AUTOACCEPT, XMPP_AUTOPRUNE, XMPP_AUTOREGISTER, XMPP_PUBSUB_AUTOCREATE, and XMPP_XEP0248.
Referenced by load_module().
|
static |
Load the module.
Module loading including tests for configuration or dependencies. This function can return AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_DECLINE, or AST_MODULE_LOAD_SUCCESS. If a dependency or environment variable fails tests return AST_MODULE_LOAD_FAILURE. If the module can not load the configuration file or other non-critical problem return AST_MODULE_LOAD_DECLINE. On success return AST_MODULE_LOAD_SUCCESS.
Definition at line 4619 of file res_xmpp.c.
References ACO_EXACT, aco_info_destroy(), aco_info_init(), aco_option_register, aco_option_register_custom, aco_process_config(), ACO_PROCESS_ERROR, app_ajijoin, app_ajileave, app_ajisend, app_ajisendgroup, ARRAY_LEN, ast_cli_register_multiple, ast_cond_init, ast_custom_function_register, ast_eid_default, ast_eid_is_empty(), ast_log, ast_manager_register_xml, AST_MODULE_LOAD_DECLINE, AST_MODULE_LOAD_SUCCESS, ast_msg_tech_register(), ast_mutex_init, ast_register_application_xml, client_bitfield_handler(), client_buddy_handler(), client_options, client_status_handler(), voicemailpwcheck::context, EVENT_FLAG_SYSTEM, FLDSET, global_bitfield_handler(), global_options, jabberreceive_function, jabberstatus_function, LOG_WARNING, manager_jabber_send(), message_received_condition, messagelock, msg_tech, NULL, OPT_STRINGFIELD_T, OPT_UINT_T, priority, STRFLDSET, xmpp_cli, xmpp_join_exec(), xmpp_leave_exec(), xmpp_send_exec(), and xmpp_sendgroup_exec().
|
static |
Definition at line 3924 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_strlen_zero(), ast_xmpp_client_send_message(), astman_append(), astman_get_header(), astman_send_ack(), astman_send_error(), globals, NULL, RAII_VAR, and xmpp_config_find().
Referenced by load_module().
|
static |
Definition at line 4688 of file res_xmpp.c.
References aco_process_config(), ACO_PROCESS_ERROR, and AST_MODULE_LOAD_DECLINE.
|
static |
Definition at line 3716 of file res_xmpp.c.
Referenced by xmpp_client_thread().
|
static |
Definition at line 4481 of file res_xmpp.c.
References aco_info_destroy(), ao2_global_obj_release, app_ajijoin, app_ajileave, app_ajisend, app_ajisendgroup, app_ajistatus, ARRAY_LEN, ast_cli_unregister_multiple(), ast_cond_destroy, ast_custom_function_unregister(), ast_manager_unregister(), ast_msg_tech_unregister(), ast_mutex_destroy, ast_unregister_application(), globals, jabberreceive_function, jabberstatus_function, message_received_condition, messagelock, msg_tech, and xmpp_cli.
|
static |
Action hook for when things occur.
Definition at line 3455 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ARRAY_LEN, ast_log, ast_test_flag, xmpp_state_handler::component, ast_xmpp_client::filter, globals, handler(), LOG_ERROR, ast_xmpp_client::name, NULL, RAII_VAR, ast_xmpp_client::state, type, XMPP_COMPONENT, xmpp_config_find(), XMPP_MAX_ATTRLEN, xmpp_pak_handlers, XMPP_STATE_DISCONNECTING, and xmpp_state_handlers.
Referenced by xmpp_client_config_post_apply().
|
static |
Comparator function for XMPP buddy.
Definition at line 587 of file res_xmpp.c.
References CMP_MATCH, CMP_STOP, ast_xmpp_buddy::id, and OBJ_KEY.
Referenced by ast_xmpp_client_config_alloc(), and xmpp_client_alloc().
|
static |
Destructor callback function for XMPP buddy.
Definition at line 862 of file res_xmpp.c.
References ao2_ref, and ast_xmpp_buddy::resources.
Referenced by xmpp_client_create_buddy().
|
static |
Hashing function for XMPP buddy.
Definition at line 578 of file res_xmpp.c.
References ast_str_hash(), ast_xmpp_buddy::id, and OBJ_KEY.
Referenced by ast_xmpp_client_config_alloc(), and xmpp_client_alloc().
|
static |
Method to expose PubSub collection node creation via CLI.
Definition at line 4218 of file res_xmpp.c.
References a, ao2_cleanup, ao2_global_obj_ref, ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, globals, name, NULL, RAII_VAR, ast_cli_entry::usage, xmpp_config_find(), and xmpp_pubsub_create_collection().
|
static |
Method to expose PubSub leaf node creation via CLI.
Definition at line 4258 of file res_xmpp.c.
References a, ao2_cleanup, ao2_global_obj_ref, ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, globals, name, NULL, RAII_VAR, ast_cli_entry::usage, xmpp_config_find(), and xmpp_pubsub_create_leaf().
|
static |
Method to expose PubSub node deletion via CLI.
e | pointer to ast_cli_entry structure |
cmd | |
a | pointer to ast_cli_args structure |
Definition at line 4180 of file res_xmpp.c.
References a, ao2_cleanup, ao2_global_obj_ref, ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, globals, name, NULL, RAII_VAR, ast_cli_entry::usage, xmpp_config_find(), and xmpp_pubsub_delete_node().
|
static |
Method to expose PubSub node list via CLI.
e | pointer to ast_cli_entry structure |
cmd | |
a | pointer to ast_cli_args structure |
Definition at line 4049 of file res_xmpp.c.
References a, ao2_cleanup, ao2_global_obj_ref, ast_cli(), CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, globals, name, NULL, RAII_VAR, ast_cli_entry::usage, xmpp_config_find(), and xmpp_pubsub_request_nodes().
|
static |
Method to purge PubSub nodes via CLI.
e | pointer to ast_cli_entry structure |
cmd | |
a | pointer to ast_cli_args structure |
Definition at line 4135 of file res_xmpp.c.
References a, ao2_cleanup, ao2_global_obj_ref, ast_cli(), ast_test_flag, CLI_FAILURE, CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, globals, name, NULL, RAII_VAR, ast_cli_entry::usage, xmpp_config_find(), xmpp_pubsub_delete_node(), xmpp_pubsub_purge_nodes(), and XMPP_XEP0248.
|
static |
Allocator function for ast_xmpp_client.
Definition at line 610 of file res_xmpp.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_ref, ast_copy_string(), ast_endpoint_create(), AST_LIST_HEAD_INIT, ast_log, AST_PTHREADT_NULL, ast_string_field_init, ast_string_field_set, ast_xmpp_client::buddies, BUDDY_BUCKETS, ast_xmpp_client::endpoint, LOG_ERROR, ast_xmpp_client::messages, ast_xmpp_client::mid, name, NULL, ast_xmpp_client::stack, ast_xmpp_client::thread, ast_xmpp_client::timeout, xmpp_buddy_cmp(), xmpp_buddy_hash(), xmpp_client_change_state(), xmpp_client_destructor(), and XMPP_STATE_DISCONNECTED.
Referenced by xmpp_client_find_or_create().
|
static |
Internal function called when we need to authenticate.
Definition at line 2757 of file res_xmpp.c.
References ast_test_flag, ast_xmpp_client_config::flags, type, xmpp_client_authenticate_digest(), xmpp_client_authenticate_sasl(), and XMPP_USESASL.
|
static |
Internal function called when we need to authenticate using non-SASL.
Definition at line 2654 of file res_xmpp.c.
References ast_log, ast_sha1_hash(), ast_xmpp_client_lock(), ast_xmpp_client_send(), ast_xmpp_client_unlock(), ast_xmpp_increment_mid(), buf, ast_xmpp_client::filter, ast_xmpp_client::jid, LOG_ERROR, ast_xmpp_client::mid, ast_xmpp_client::name, NULL, ast_xmpp_client_config::password, xmpp_client_change_state(), xmpp_connect_hook(), and XMPP_STATE_AUTHENTICATING.
Referenced by xmpp_client_authenticate().
|
static |
Internal function called when we need to authenticate using SASL.
Definition at line 2692 of file res_xmpp.c.
References ast_base64encode(), ast_log, ast_strdupa, ast_strlen_zero(), ast_xmpp_client_send(), base64, ast_xmpp_client::jid, len(), LOG_ERROR, ast_xmpp_client::name, ast_xmpp_client::parser, ast_xmpp_client_config::password, ast_xmpp_client_config::refresh_token, strsep(), xmpp_client_change_state(), xmpp_is_secure(), and XMPP_STATE_AUTHENTICATING.
Referenced by xmpp_client_authenticate().
|
static |
Internal function called when we are authenticating.
Definition at line 2763 of file res_xmpp.c.
References ast_log, ast_xmpp_client_lock(), ast_xmpp_client_send(), ast_xmpp_client_unlock(), ast_xmpp_increment_mid(), ast_xmpp_client::filter, ast_xmpp_client::jid, LOG_ERROR, ast_xmpp_client::mid, ast_xmpp_client::name, xmpp_connect_hook(), and xmpp_send_stream_header().
|
static |
Internal function which changes the XMPP client state.
Definition at line 596 of file res_xmpp.c.
References AST_ENDPOINT_OFFLINE, AST_ENDPOINT_ONLINE, ast_endpoint_set_state(), ast_xmpp_client::endpoint, ast_xmpp_client::state, state, XMPP_STATE_CONNECTED, and XMPP_STATE_DISCONNECTED.
Referenced by ast_xmpp_client_disconnect(), xmpp_client_alloc(), xmpp_client_authenticate_digest(), xmpp_client_authenticate_sasl(), xmpp_client_reconnect(), xmpp_client_request_tls(), xmpp_client_requested_tls(), xmpp_component_authenticate(), xmpp_component_authenticating(), xmpp_connect_hook(), and xmpp_roster_hook().
|
static |
Definition at line 3808 of file res_xmpp.c.
References ao2_find, ao2_link, ao2_ref, ast_xmpp_buddy::id, and OBJ_KEY.
Referenced by xmpp_client_config_post_apply().
|
static |
Definition at line 3863 of file res_xmpp.c.
References ao2_callback, ao2_cleanup, ao2_global_obj_ref, ast_copy_flags, ast_log, ast_pthread_create_background, ast_strlen_zero(), ast_test_flag, ast_xmpp_client_disconnect(), ast_xmpp_client::buddies, ast_xmpp_client_config::buddies, ast_xmpp_client_config::client, ast_flags::flags, ast_xmpp_client_config::flags, globals, ast_xmpp_client::jid, LOG_ERROR, ast_xmpp_client_config::mod_flags, ast_xmpp_client_config::name, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, ast_xmpp_client::parser, RAII_VAR, ast_xmpp_client::reconnect, ast_xmpp_client::stack, ast_xmpp_client::state, ast_xmpp_client_config::status, ast_xmpp_client_config::statusmsg, ast_xmpp_client::thread, ast_xmpp_client_config::user, xmpp_action_hook(), XMPP_AUTOACCEPT, XMPP_AUTOPRUNE, XMPP_AUTOREGISTER, xmpp_client_config_merge_buddies(), xmpp_client_set_presence(), xmpp_client_subscribe_user(), xmpp_client_thread(), XMPP_COMPONENT, xmpp_log_hook(), and XMPP_STATE_CONNECTED.
Referenced by xmpp_config_post_apply().
|
static |
Internal function which creates a buddy on a client.
Definition at line 2163 of file res_xmpp.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_hash, ao2_link, ao2_ref, ast_copy_string(), container, ast_xmpp_buddy::id, NULL, RESOURCE_BUCKETS, ast_xmpp_buddy::resources, ast_xmpp_buddy::subscribe, xmpp_buddy_destructor(), xmpp_resource_cmp(), and xmpp_resource_hash().
Referenced by client_buddy_handler(), xmpp_pak_s10n(), and xmpp_roster_hook().
|
static |
Destructor callback function for XMPP client.
Definition at line 551 of file res_xmpp.c.
References ao2_cleanup, ast_endpoint_shutdown(), AST_LIST_HEAD_DESTROY, AST_LIST_REMOVE_HEAD, ast_xmpp_client_disconnect(), ast_xmpp_client::buddies, ast_xmpp_client::endpoint, ast_xmpp_client::filter, ast_xmpp_message::list, ast_xmpp_message::message, ast_xmpp_client::messages, NULL, ast_xmpp_client::stack, and xmpp_message_destroy().
Referenced by xmpp_client_alloc().
|
static |
Look up existing client or create a new one.
Definition at line 663 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_ref, globals, NULL, RAII_VAR, xmpp_client_alloc(), and xmpp_config_find().
Referenced by ast_xmpp_client_config_alloc().
|
static |
Internal function which receives data from the XMPP client connection.
Definition at line 3648 of file res_xmpp.c.
References ast_debug, ast_log, buf, c, IKS_NET_EXPIRED, ast_xmpp_client::jid, len(), LOG_WARNING, ast_xmpp_client::name, NET_IO_BUF_SIZE, newbuf(), ast_xmpp_client::parser, xmpp_io_recv(), xmpp_log_hook(), and xmpp_ping_request().
Referenced by xmpp_client_thread().
|
static |
Internal function used to reconnect an XMPP client to its server.
Definition at line 3564 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_debug, ast_log, ast_strlen_zero(), ast_test_flag, ast_xmpp_client_disconnect(), fetch_access_token(), ast_xmpp_client::filter, globals, ast_xmpp_client::jid, LOG_ERROR, ast_xmpp_client::name, NULL, ast_xmpp_client::parser, RAII_VAR, S_OR, ast_xmpp_client::timeout, xmpp_client_change_state(), XMPP_COMPONENT, xmpp_config_find(), XMPP_STATE_AUTHENTICATE, XMPP_STATE_REQUEST_TLS, and XMPP_USETLS.
Referenced by xmpp_client_thread().
|
static |
Internal function called when we need to request TLS support.
Definition at line 2540 of file res_xmpp.c.
References ast_log, LOG_ERROR, ast_xmpp_client::name, ast_xmpp_client::parser, xmpp_client_change_state(), xmpp_is_secure(), XMPP_STATE_AUTHENTICATE, and XMPP_STATE_REQUESTED_TLS.
|
static |
Internal function called when we receive a response to our TLS initiation request.
Definition at line 2584 of file res_xmpp.c.
References ast_debug, ast_free, ast_log, ast_xmpp_client::jid, LOG_ERROR, ast_xmpp_client::name, ast_xmpp_client::parser, xmpp_client_change_state(), xmpp_send_stream_header(), and XMPP_STATE_AUTHENTICATE.
|
static |
Helper function which sends a discovery information request to a user.
Definition at line 3192 of file res_xmpp.c.
References ast_xmpp_client_lock(), ast_xmpp_client_send(), ast_xmpp_client_unlock(), ast_xmpp_increment_mid(), and ast_xmpp_client::mid.
Referenced by xmpp_pak_presence().
|
static |
Internal function used to send a message to a user or chatroom.
Definition at line 910 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_strlen_zero(), ast_test_flag, ast_xmpp_client_send(), globals, ast_xmpp_client::jid, ast_xmpp_client::name, NULL, RAII_VAR, XMPP_COMPONENT, xmpp_config_find(), and XMPP_MAX_JIDLEN.
Referenced by ast_xmpp_chatroom_send(), and ast_xmpp_client_send_message().
|
static |
Internal function which sends a raw message.
Definition at line 2489 of file res_xmpp.c.
References len(), ast_xmpp_client::parser, ast_xmpp_client::state, xmpp_is_secure(), xmpp_log_hook(), and XMPP_STATE_DISCONNECTED.
Referenced by ast_xmpp_client_send(), xmpp_component_authenticate(), and xmpp_send_stream_header().
|
static |
Hook function called when client receives a service discovery get message.
Definition at line 2343 of file res_xmpp.c.
References ast_log, ast_xmpp_client_send(), end, ast_xmpp_client::jid, LOG_ERROR, ast_xmpp_client::name, and NULL.
Referenced by xmpp_connect_hook().
|
static |
Hook function called when client receives a service discovery result message.
Definition at line 2403 of file res_xmpp.c.
References ao2_callback, ao2_find, ao2_lock, ao2_ref, ao2_unlock, ast_xmpp_client::buddies, OBJ_KEY, ast_xmpp_resource::resource, ast_xmpp_buddy::resources, and xmpp_resource_cmp().
Referenced by xmpp_component_authenticating(), and xmpp_connect_hook().
|
static |
Definition at line 974 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_test_flag, ast_xmpp_client_send(), done, globals, ast_xmpp_client::jid, ast_xmpp_client::name, NULL, RAII_VAR, S_OR, XMPP_COMPONENT, xmpp_config_find(), and XMPP_MAX_JIDLEN.
Referenced by ast_xmpp_chatroom_join(), and ast_xmpp_chatroom_leave().
|
static |
Internal function which changes the presence status of an XMPP client.
Definition at line 2305 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_log, ast_strlen_zero(), ast_xmpp_client_send(), desc, done, globals, LOG_ERROR, ast_xmpp_client::name, NULL, priority, RAII_VAR, and xmpp_config_find().
Referenced by xmpp_client_config_post_apply(), xmpp_connect_hook(), xmpp_pak_presence(), and xmpp_pak_s10n().
|
static |
Callback function which subscribes to a user if needed.
Definition at line 2226 of file res_xmpp.c.
References ast_log, ast_xmpp_client_send(), ast_xmpp_buddy::id, LOG_WARNING, ast_xmpp_client::name, and ast_xmpp_buddy::subscribe.
Referenced by xmpp_client_config_post_apply(), and xmpp_roster_hook().
|
static |
XMPP client connection thread.
Definition at line 3728 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_debug, ast_log, ast_test_flag, ast_xmpp_client_disconnect(), globals, IKS_NET_EXPIRED, ast_xmpp_client::jid, LOG_ERROR, LOG_WARNING, ast_xmpp_client::name, NULL, RAII_VAR, sleep_with_backoff(), ast_xmpp_client::state, ast_xmpp_client::timeout, xmpp_client_receive(), xmpp_client_reconnect(), xmpp_config_find(), XMPP_KEEPALIVE, xmpp_ping_request(), XMPP_STATE_CONNECTED, and XMPP_STATE_DISCONNECTING.
Referenced by xmpp_client_config_post_apply().
|
static |
Helper function which unsubscribes a user and removes them from the roster.
Definition at line 2189 of file res_xmpp.c.
References ast_log, ast_xmpp_client_send(), done, item, ast_xmpp_client::jid, LOG_WARNING, ast_xmpp_client::name, and NULL.
Referenced by xmpp_roster_hook().
|
static |
Internal function called when we should authenticate as a component.
Definition at line 2824 of file res_xmpp.c.
References ast_log, ast_sha1_hash(), LOG_ERROR, ast_xmpp_client::name, ast_xmpp_client_config::password, xmpp_client_change_state(), xmpp_client_send_raw_message(), and XMPP_STATE_AUTHENTICATING.
|
static |
Internal function called when we authenticated as a component.
Definition at line 3090 of file res_xmpp.c.
References ast_log, ast_xmpp_client::filter, LOG_ERROR, ast_xmpp_client::name, xmpp_client_change_state(), xmpp_client_service_discovery_result_hook(), xmpp_component_register_get_hook(), xmpp_component_register_set_hook(), xmpp_component_service_discovery_get_hook(), xmpp_component_service_discovery_items_hook(), and XMPP_STATE_CONNECTED.
|
static |
Hook function called when the component is queried about registration.
Definition at line 2931 of file res_xmpp.c.
References ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_ref, ast_log, ast_xmpp_client_send(), ast_xmpp_client::buddies, done, error(), globals, LOG_ERROR, LOG_WARNING, ast_xmpp_client::name, NULL, OBJ_KEY, RAII_VAR, and xmpp_config_find().
Referenced by xmpp_component_authenticating().
|
static |
Hook function called when someone registers to the component.
Definition at line 2992 of file res_xmpp.c.
References ast_log, ast_xmpp_client_lock(), ast_xmpp_client_send(), ast_xmpp_client_unlock(), ast_xmpp_increment_mid(), done, ast_xmpp_client::jid, LOG_ERROR, LOG_WARNING, ast_xmpp_client::mid, ast_xmpp_client::name, and NULL.
Referenced by xmpp_component_authenticating().
|
static |
Hook function called when component receives a service discovery get message.
Definition at line 2844 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_debug, ast_log, ast_xmpp_client_send(), commands, done, globals, item, LOG_ERROR, LOG_WARNING, ast_xmpp_client::name, NULL, RAII_VAR, version, and xmpp_config_find().
Referenced by xmpp_component_authenticating().
|
static |
Hook function called when we receive a service discovery items request.
Definition at line 3039 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_log, ast_xmpp_client_send(), done, globals, item, LOG_ERROR, LOG_WARNING, ast_xmpp_client::name, NULL, RAII_VAR, and xmpp_config_find().
Referenced by xmpp_component_authenticating().
|
static |
Allocator for XMPP configuration.
Definition at line 724 of file res_xmpp.c.
References ao2_alloc, AO2_ALLOC_OPT_LOCK_MUTEX, ao2_container_alloc_list, ao2_ref, xmpp_config::clients, error(), xmpp_config::global, NULL, xmpp_config_cmp(), and xmpp_config_destructor().
|
static |
Comparator function for configuration.
Definition at line 716 of file res_xmpp.c.
References CMP_MATCH, CMP_STOP, ast_xmpp_client_config::flags, match(), ast_xmpp_client_config::name, and OBJ_KEY.
Referenced by xmpp_config_alloc().
|
static |
Destructor for XMPP configuration.
Definition at line 708 of file res_xmpp.c.
References ao2_cleanup, xmpp_config::clients, and xmpp_config::global.
Referenced by xmpp_config_alloc().
|
static |
Find function for configuration.
Definition at line 657 of file res_xmpp.c.
References ao2_find, and OBJ_KEY.
Referenced by acf_jabberreceive_read(), acf_jabberstatus_read(), ast_xmpp_client_find(), delete_old_messages(), manager_jabber_send(), xmpp_action_hook(), xmpp_cli_create_collection(), xmpp_cli_create_leafnode(), xmpp_cli_delete_pubsub_node(), xmpp_cli_list_pubsub_nodes(), xmpp_cli_purge_pubsub_nodes(), xmpp_client_find_or_create(), xmpp_client_reconnect(), xmpp_client_send_message(), xmpp_client_set_group_presence(), xmpp_client_set_presence(), xmpp_client_thread(), xmpp_component_register_get_hook(), xmpp_component_service_discovery_get_hook(), xmpp_component_service_discovery_items_hook(), xmpp_config_prelink(), xmpp_connect_hook(), xmpp_init_event_distribution(), xmpp_join_exec(), xmpp_leave_exec(), xmpp_log_hook(), xmpp_pubsub_iq_create(), xmpp_roster_hook(), xmpp_send_cb(), xmpp_send_exec(), and xmpp_sendgroup_exec().
|
static |
Definition at line 793 of file res_xmpp.c.
References ao2_callback, ao2_cleanup, ao2_global_obj_ref, globals, NULL, OBJ_MULTIPLE, OBJ_NODATA, RAII_VAR, and xmpp_client_config_post_apply().
|
static |
Definition at line 748 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_log, ast_strlen_zero(), ast_test_flag, ast_xmpp_client_config::client, ast_xmpp_client_config::flags, globals, LOG_ERROR, ast_xmpp_client_config::name, NULL, ast_xmpp_client_config::oauth_clientid, ast_xmpp_client_config::oauth_secret, ast_xmpp_client_config::password, ast_xmpp_client_config::port, ast_xmpp_client_config::priority, RAII_VAR, ast_xmpp_client::reconnect, ast_xmpp_client_config::refresh_token, ast_xmpp_client_config::server, ast_xmpp_client_config::user, XMPP_COMPONENT, and xmpp_config_find().
|
static |
Hook function called when client finishes authenticating with the server.
Definition at line 2433 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, ast_log, ast_test_flag, ast_xmpp_client_send(), ast_xmpp_client::filter, globals, if(), ast_xmpp_client::jid, LOG_ERROR, ast_xmpp_client::name, NULL, RAII_VAR, ast_xmpp_client::stack, xmpp_client_change_state(), xmpp_client_service_discovery_get_hook(), xmpp_client_service_discovery_result_hook(), xmpp_client_set_presence(), xmpp_config_find(), xmpp_connect_hook(), XMPP_DISTRIBUTE_EVENTS, xmpp_init_event_distribution(), xmpp_roster_hook(), and XMPP_STATE_ROSTER.
Referenced by xmpp_client_authenticate_digest(), xmpp_client_authenticating(), and xmpp_connect_hook().
|
static |
Definition at line 4300 of file res_xmpp.c.
References a, ast_cli_entry::args, ast_cli(), CLI_GENERATE, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, debug, NULL, and ast_cli_entry::usage.
|
static |
Initialize collections for event distribution.
client | the configured XMPP client we use to connect to a XMPP server |
Definition at line 1583 of file res_xmpp.c.
References ao2_callback, ao2_cleanup, ao2_global_obj_ref, ast_device_state_cache(), ast_device_state_message_type(), ast_device_state_topic_all(), ast_mwi_state_type(), ast_mwi_topic_all(), cached_devstate_cb(), ast_xmpp_client::device_state_sub, ast_xmpp_client::filter, globals, ast_xmpp_client::mwi_sub, ast_xmpp_client::name, NULL, OBJ_NODATA, RAII_VAR, stasis_cache_dump(), stasis_subscribe, stasis_subscribe_pool, stasis_subscription_accept_message_type(), STASIS_SUBSCRIPTION_FILTER_SELECTIVE, stasis_subscription_set_filter(), stasis_unsubscribe(), xmpp_config_find(), xmpp_pubsub_devstate_cb(), xmpp_pubsub_handle_error(), xmpp_pubsub_handle_event(), xmpp_pubsub_mwi_cb(), xmpp_pubsub_subscribe(), and xmpp_pubsub_unsubscribe().
Referenced by xmpp_connect_hook().
|
static |
Internal function which polls on an XMPP client and receives data.
Definition at line 3614 of file res_xmpp.c.
References ast_poll, len(), ast_xmpp_client::parser, and xmpp_is_secure().
Referenced by xmpp_client_receive().
|
static |
Helper function which returns whether an XMPP client connection is secure or not.
Definition at line 872 of file res_xmpp.c.
Referenced by xmpp_client_authenticate_sasl(), xmpp_client_request_tls(), xmpp_client_send_raw_message(), and xmpp_io_recv().
|
static |
Application to join a chat room.
chan | ast_channel |
data | Data is sender|jid|nickname. |
0 | success |
-1 | error |
Definition at line 1718 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, app_ajijoin, args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_xmpp_chatroom_join(), globals, LOG_ERROR, NULL, RAII_VAR, XMPP_COMPONENT, xmpp_config_find(), and XMPP_MAX_RESJIDLEN.
Referenced by load_module().
|
static |
Application to leave a chat room.
chan | ast_channel |
data | Data is sender|jid|nickname. |
0 | success |
-1 | error |
Definition at line 1777 of file res_xmpp.c.
References ao2_cleanup, ao2_global_obj_ref, app_ajileave, args, AST_APP_ARG, AST_DECLARE_APP_ARGS, ast_log, AST_STANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ast_test_flag, ast_xmpp_chatroom_leave(), globals, LOG_ERROR, NULL, RAII_VAR, XMPP_COMPONENT, xmpp_config_find(), and XMPP_MAX_RESJIDLEN.
Referenced by load_module().
|
static |