Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Channel Event Logging API. More...
#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/cel.h"
#include "asterisk/logger.h"
#include "asterisk/linkedlists.h"
#include "asterisk/utils.h"
#include "asterisk/config.h"
#include "asterisk/config_options.h"
#include "asterisk/cli.h"
#include "asterisk/astobj2.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/bridge.h"
#include "asterisk/parking.h"
#include "asterisk/pickup.h"
#include "asterisk/core_local.h"
#include "asterisk/taskprocessor.h"
Go to the source code of this file.
Data Structures | |
struct | cel_backend |
struct | cel_config |
A container that holds all config-related information. More... | |
struct | cel_dialstatus |
struct | cel_linkedid |
Macros | |
#define | BACKEND_BUCKETS 13 |
#define | CEL_MAX_EVENT_IDS 64 |
Maximum possible CEL event IDs. More... | |
#define | NUM_APP_BUCKETS 97 |
Number of buckets for the appset container. More... | |
#define | NUM_DIALSTATUS_BUCKETS 251 |
Number of buckets for the dialstatus container. More... | |
Typedefs | |
typedef void(* | cel_channel_snapshot_monitor) (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *event_time) |
Typedef for callbacks that get called on channel snapshot updates. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static | AO2_GLOBAL_OBJ_STATIC (cel_backends) |
static | AO2_GLOBAL_OBJ_STATIC (cel_configs) |
static | AO2_GLOBAL_OBJ_STATIC (cel_dialstatus_store) |
static | AO2_GLOBAL_OBJ_STATIC (cel_linkedids) |
static int | apps_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
int | ast_cel_backend_register (const char *name, ast_cel_backend_cb backend_callback) |
Register a CEL backend. More... | |
int | ast_cel_backend_unregister (const char *name) |
Unregister a CEL backend. More... | |
unsigned int | ast_cel_check_enabled (void) |
Hashing function for cel_backend. More... | |
struct ast_event * | ast_cel_create_event (struct ast_channel_snapshot *snapshot, enum ast_cel_event_type event_type, const char *userdefevname, struct ast_json *extra, const char *peer) |
Allocate and populate a CEL event structure. More... | |
struct ast_event * | ast_cel_create_event_with_time (struct ast_channel_snapshot *snapshot, enum ast_cel_event_type event_type, const struct timeval *event_time, const char *userdefevname, struct ast_json *extra, const char *peer) |
Allocate and populate a CEL event structure. More... | |
struct ast_channel * | ast_cel_fabricate_channel_from_event (const struct ast_event *event) |
Create a fake channel from data in a CEL event. More... | |
int | ast_cel_fill_record (const struct ast_event *e, struct ast_cel_event_record *r) |
Fill in an ast_cel_event_record from a CEL event. More... | |
void * | ast_cel_general_config_alloc (void) |
Allocate a CEL configuration object. More... | |
struct ast_cel_general_config * | ast_cel_get_config (void) |
Obtain the current CEL configuration. More... | |
const char * | ast_cel_get_type_name (enum ast_cel_event_type type) |
Get the name of a CEL event type. More... | |
void | ast_cel_publish_event (struct ast_channel *chan, enum ast_cel_event_type event_type, struct ast_json *blob) |
Publish a CEL event. More... | |
void | ast_cel_publish_user_event (struct ast_channel *chan, const char *event, const char *extra) |
Publish a CEL user event. More... | |
void | ast_cel_set_config (struct ast_cel_general_config *config) |
Set the current CEL configuration. More... | |
enum ast_cel_event_type | ast_cel_str_to_event_type (const char *name) |
Get the event type from a string. More... | |
struct stasis_topic * | ast_cel_topic (void) |
Get the CEL topic. More... | |
static int | ast_cel_track_event (enum ast_cel_event_type et) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static void | cel_attended_transfer_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | cel_backend_send_cb (void *obj, void *arg, int flags) |
static void | cel_blind_transfer_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | cel_bridge_enter_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | cel_bridge_leave_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | cel_channel_app_change (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *event_time) |
static void | cel_channel_linkedid_change (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *event_time) |
static void | cel_channel_state_change (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *event_time) |
Handle channel state changes. More... | |
static void * | cel_config_alloc (void) |
static void | cel_config_dtor (void *obj) |
Destructor for cel_config. More... | |
static void | cel_dial_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | cel_filter_channel_snapshot (struct ast_channel_snapshot *snapshot) |
static void | cel_general_config_dtor (void *obj) |
Destructor for cel_config. More... | |
static struct ast_str * | cel_generate_peer_str (struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *chan) |
static void | cel_generic_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
struct stasis_message_type * | cel_generic_type (void) |
static int | cel_linkedid_ref (const char *linkedid) |
static void | cel_local_optimization_begin_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | cel_local_optimization_cb_helper (void *data, struct stasis_subscription *sub, struct stasis_message *message, enum ast_cel_event_type event_type) |
static void | cel_local_optimization_end_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | cel_parking_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | cel_pickup_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | cel_pre_apply_config (void) |
static int | cel_report_event (struct ast_channel_snapshot *snapshot, enum ast_cel_event_type event_type, const struct timeval *event_time, const char *userdefevname, struct ast_json *extra, const char *peer_str) |
static void | cel_snapshot_update_cb (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static int | cel_track_app (const char *const_app) |
static void | check_retire_linkedid (struct ast_channel_snapshot *snapshot, const struct timeval *event_time) |
CONFIG_INFO_CORE ("cel", cel_cfg_info, cel_configs, cel_config_alloc,.files=ACO_FILES(&cel_conf),.pre_apply_config=cel_pre_apply_config,) | |
static int | create_routes (void) |
Create the Stasis message router and routes for CEL. More... | |
static int | create_subscriptions (void) |
Create the Stasis subscriptions for CEL. More... | |
static void | destroy_routes (void) |
static void | destroy_subscriptions (void) |
static int | events_handler (const struct aco_option *opt, struct ast_variable *var, void *obj) |
static const char * | get_blob_variable (struct ast_multi_channel_blob *blob, const char *varname) |
static struct cel_dialstatus * | get_dialstatus (const char *uniqueid) |
static char * | handle_cli_status (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static int | is_valid_dialstatus (struct ast_multi_channel_blob *blob) |
static int | load_module (void) |
static int | reload_module (void) |
static void | save_dialstatus (struct ast_multi_channel_blob *blob, struct ast_channel_snapshot *snapshot) |
STASIS_MESSAGE_TYPE_DEFN (cel_generic_type) | |
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 = "CEL Engine" , .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_module, .load_pri = AST_MODPRI_CORE, .requires = "extconfig", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct stasis_topic * | cel_aggregation_topic |
static struct stasis_forward * | cel_bridge_forwarder |
static struct stasis_forward * | cel_cel_forwarder |
static struct stasis_forward * | cel_channel_forwarder |
cel_channel_snapshot_monitor | cel_channel_monitors [] |
Handlers for channel snapshot changes. More... | |
static struct aco_file | cel_conf |
The config file to be processed for the module. More... | |
static const char *const | cel_event_types [CEL_MAX_EVENT_IDS] |
Map of ast_cel_event_type to strings. More... | |
static struct stasis_forward * | cel_parking_forwarder |
static struct stasis_message_router * | cel_state_router |
static struct stasis_topic * | cel_topic |
static struct ast_cli_entry | cli_status = { .handler = handle_cli_status , .summary = "Display the CEL status" ,} |
static const struct ast_datastore_info | fabricated_channel_datastore |
static struct aco_type | general_option |
An aco_type structure to link the "general" category to the ast_cel_general_config type. More... | |
static struct aco_type * | general_options [] = ACO_TYPES(&general_option) |
static const char * | ignore_categories [] |
static struct aco_type | ignore_option |
Channel Event Logging API.
Definition in file cel.c.
#define BACKEND_BUCKETS 13 |
#define CEL_MAX_EVENT_IDS 64 |
#define NUM_APP_BUCKETS 97 |
#define NUM_DIALSTATUS_BUCKETS 251 |
typedef void(* cel_channel_snapshot_monitor) (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot, const struct timeval *event_time) |
|
static |
Container for CEL backend information
|
static |
|
static |
Container for dial end multichannel blobs for holding on to dial statuses
|
static |
Container of channel references to a linkedid for CEL purposes.
|
static |
Definition at line 474 of file cel.c.
References ast_cel_general_config::apps, ast_str_container_add(), ast_str_to_lower(), ast_strdupa, ast_strip(), ast_strlen_zero(), strsep(), and var.
Referenced by load_module().
int ast_cel_backend_register | ( | const char * | name, |
ast_cel_backend_cb | backend_callback | ||
) |
Register a CEL backend.
name | Name of backend to register |
backend_callback | Callback to register |
zero | on success |
non-zero | on failure |
Definition at line 1783 of file cel.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_global_obj_ref, ao2_link, ao2_ref, ast_strlen_zero(), cel_backend::callback, cel_backend::name, name, NULL, and RAII_VAR.
Referenced by load_config(), load_module(), my_load_module(), and test_cel_init_cb().
int ast_cel_backend_unregister | ( | const char * | name | ) |
Unregister a CEL backend.
name | Name of backend to unregister |
zero | on success |
non-zero | on failure |
Definition at line 1771 of file cel.c.
References ao2_find, ao2_global_obj_ref, ao2_ref, name, OBJ_NODATA, OBJ_SEARCH_KEY, and OBJ_UNLINK.
Referenced by cel_verify_and_cleanup_cb(), load_config(), my_unload_module(), tds_unload_module(), and unload_module().
unsigned int ast_cel_check_enabled | ( | void | ) |
Hashing function for cel_backend.
Check to see if CEL is enabled.
Comparator function for cel_backend
Hashing function for dialstatus container
Comparator function for dialstatus container
Definition at line 345 of file cel.c.
References ao2_cleanup, ao2_global_obj_ref, ast_cel_general_config::enable, enabled, and cel_config::general.
Referenced by ast_cel_set_config(), handle_cli_status(), load_module(), and reload_module().
struct ast_event * ast_cel_create_event | ( | struct ast_channel_snapshot * | snapshot, |
enum ast_cel_event_type | event_type, | ||
const char * | userdefevname, | ||
struct ast_json * | extra, | ||
const char * | peer_str | ||
) |
Allocate and populate a CEL event structure.
snapshot | An ast_channel_snapshot of the primary channel associated with this channel event. |
event_type | The type of call event being reported. |
userdefevname | Custom name for the call event. (optional) |
extra | An event-specific opaque JSON blob to be rendered and placed in the "CEL_EXTRA" information element of the call event. (optional) |
peer_str | A list of comma-separated peer channel names. (optional) |
The | created ast_event structure |
NULL | on failure |
Definition at line 519 of file cel.c.
References ast_cel_create_event_with_time(), and ast_tvnow().
Referenced by append_expected_event_snapshot().
struct ast_event * ast_cel_create_event_with_time | ( | struct ast_channel_snapshot * | snapshot, |
enum ast_cel_event_type | event_type, | ||
const struct timeval * | event_time, | ||
const char * | userdefevname, | ||
struct ast_json * | extra, | ||
const char * | peer_str | ||
) |
Allocate and populate a CEL event structure.
snapshot | An ast_channel_snapshot of the primary channel associated with this channel event. |
event_type | The type of call event being reported. |
event_time | The time at which the event occurred. |
userdefevname | Custom name for the call event. (optional) |
extra | An event-specific opaque JSON blob to be rendered and placed in the "CEL_EXTRA" information element of the call event. (optional) |
peer_str | A list of comma-separated peer channel names. (optional) |
The | created ast_event structure |
NULL | on failure |
Definition at line 529 of file cel.c.
References ast_channel_snapshot_peer::account, ast_channel_snapshot_base::accountcode, ast_channel_snapshot::amaflags, ast_channel_snapshot_caller::ani, ast_channel_snapshot_dialplan::appl, AST_EVENT_CEL, AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_CEL_EVENT_TIME, AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_CEL_EVENT_TYPE, AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_CEL_EXTRA, AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_CEL_TENANTID, AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_CEL_USERFIELD, AST_EVENT_IE_END, AST_EVENT_IE_PLTYPE_STR, AST_EVENT_IE_PLTYPE_UINT, ast_event_new(), ast_json_dump_string, ast_json_free(), ast_channel_snapshot::base, ast_channel_snapshot::caller, ast_channel_snapshot_dialplan::context, ast_channel_snapshot_dialplan::data, ast_channel_snapshot::dialplan, ast_channel_snapshot_caller::dnid, ast_channel_snapshot_dialplan::exten, ast_channel_snapshot_peer::linkedid, ast_channel_snapshot_caller::name, ast_channel_snapshot_base::name, NULL, ast_channel_snapshot_caller::number, ast_channel_snapshot::peer, RAII_VAR, ast_channel_snapshot_caller::rdnis, S_OR, ast_channel_snapshot_base::tenantid, ast_channel_snapshot_base::uniqueid, and ast_channel_snapshot_base::userfield.
Referenced by ast_cel_create_event(), and cel_report_event().
struct ast_channel * ast_cel_fabricate_channel_from_event | ( | const struct ast_event * | event | ) |
Create a fake channel from data in a CEL event.
event | the CEL event |
Definition at line 663 of file cel.c.
References ast_cel_event_record::account_code, ast_cel_event_record::amaflag, ast_party_caller::ani, ao2_cleanup, ao2_global_obj_ref, ast_cel_event_record::application_data, ast_cel_event_record::application_name, AST_CEL_EVENT_RECORD_VERSION, ast_cel_fill_record(), AST_CEL_USER_DEFINED, ast_channel_amaflags_set(), ast_channel_appl_set(), ast_channel_caller(), ast_channel_context_set(), ast_channel_data_set(), ast_channel_datastore_add(), ast_channel_dialed(), ast_channel_exten_set(), ast_channel_internal_set_fake_ids(), ast_channel_redirecting(), ast_channel_unref, ast_channel_varshead(), ast_datastore_alloc, ast_datastore_free(), ast_dummy_channel_alloc, AST_LIST_INSERT_HEAD, ast_localtime(), ast_malloc, ast_strdup, ast_strftime(), ast_strlen_zero(), ast_var_assign, ast_cel_event_record::caller_id_ani, ast_cel_event_record::caller_id_dnid, ast_cel_event_record::caller_id_name, ast_cel_event_record::caller_id_num, ast_cel_event_record::caller_id_rdnis, ast_cel_event_record::channel_name, ast_cel_event_record::context, ast_datastore::data, ast_cel_event_record::event_name, ast_cel_event_record::event_time, ast_cel_event_record::event_type, ast_cel_event_record::extension, ast_cel_event_record::extra, fabricated_channel_datastore, ast_party_redirecting::from, ast_party_caller::id, if(), ast_cel_event_record::linked_id, ast_party_id::name, NULL, ast_party_id::number, ast_party_dialed::number, ast_cel_event_record::peer, ast_cel_event_record::peer_account, RAII_VAR, ast_party_name::str, ast_party_number::str, ast_party_dialed::str, ast_cel_event_record::unique_id, ast_cel_event_record::user_defined_name, ast_cel_event_record::user_field, ast_party_name::valid, ast_party_number::valid, and ast_cel_event_record::version.
Referenced by custom_log(), and write_cel().
int ast_cel_fill_record | ( | const struct ast_event * | event, |
struct ast_cel_event_record * | r | ||
) |
Fill in an ast_cel_event_record from a CEL event.
[in] | event | the CEL event |
[out] | r | the ast_cel_event_record to fill in |
0 | success |
non-zero | failure |
Definition at line 822 of file cel.c.
References ast_cel_event_record::account_code, ast_cel_event_record::amaflag, ast_cel_event_record::application_data, ast_cel_event_record::application_name, AST_CEL_EVENT_RECORD_VERSION, ast_cel_get_type_name(), AST_CEL_USER_DEFINED, ast_event_get_ie_str(), ast_event_get_ie_uint(), AST_EVENT_IE_CEL_ACCTCODE, AST_EVENT_IE_CEL_AMAFLAGS, AST_EVENT_IE_CEL_APPDATA, AST_EVENT_IE_CEL_APPNAME, AST_EVENT_IE_CEL_CHANNAME, AST_EVENT_IE_CEL_CIDANI, AST_EVENT_IE_CEL_CIDDNID, AST_EVENT_IE_CEL_CIDNAME, AST_EVENT_IE_CEL_CIDNUM, AST_EVENT_IE_CEL_CIDRDNIS, AST_EVENT_IE_CEL_CONTEXT, AST_EVENT_IE_CEL_EVENT_TIME, AST_EVENT_IE_CEL_EVENT_TIME_USEC, AST_EVENT_IE_CEL_EVENT_TYPE, AST_EVENT_IE_CEL_EXTEN, AST_EVENT_IE_CEL_EXTRA, AST_EVENT_IE_CEL_LINKEDID, AST_EVENT_IE_CEL_PEER, AST_EVENT_IE_CEL_PEERACCT, AST_EVENT_IE_CEL_TENANTID, AST_EVENT_IE_CEL_UNIQUEID, AST_EVENT_IE_CEL_USEREVENT_NAME, AST_EVENT_IE_CEL_USERFIELD, ast_log, ast_cel_event_record::caller_id_ani, ast_cel_event_record::caller_id_dnid, ast_cel_event_record::caller_id_name, ast_cel_event_record::caller_id_num, ast_cel_event_record::caller_id_rdnis, ast_cel_event_record::channel_name, ast_cel_event_record::context, ast_cel_event_record::event_name, ast_cel_event_record::event_time, ast_cel_event_record::event_type, ast_cel_event_record::extension, ast_cel_event_record::extra, ast_cel_event_record::linked_id, LOG_ERROR, ast_cel_event_record::peer, ast_cel_event_record::peer_account, S_OR, ast_cel_event_record::tenant_id, ast_cel_event_record::unique_id, ast_cel_event_record::user_defined_name, ast_cel_event_record::user_field, and ast_cel_event_record::version.
Referenced by ast_cel_fabricate_channel_from_event(), cel_bs_put(), manager_log(), odbc_log(), pgsql_log(), radius_log(), and tds_log().
void * ast_cel_general_config_alloc | ( | void | ) |
Allocate a CEL configuration object.
NULL | on error |
The | new CEL configuration object |
Definition at line 189 of file cel.c.
References ao2_alloc, ao2_cleanup, ao2_ref, ast_str_container_alloc, ast_string_field_init, cel_general_config_dtor(), NULL, NUM_APP_BUCKETS, and RAII_VAR.
Referenced by cel_config_alloc(), and load_module().
struct ast_cel_general_config * ast_cel_get_config | ( | void | ) |
Obtain the current CEL configuration.
The configuration is a ref counted object. The caller of this function must decrement the ref count when finished with the configuration.
NULL | on error |
The | current CEL configuration |
Definition at line 1733 of file cel.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_ref, NULL, and RAII_VAR.
Referenced by test_cel_init_cb().
const char * ast_cel_get_type_name | ( | enum ast_cel_event_type | type | ) |
Get the name of a CEL event type.
type | the type to get the name of |
Definition at line 493 of file cel.c.
References cel_event_types, S_OR, and type.
Referenced by ast_cel_fill_record(), cel_generic_cb(), dump_event(), and handle_cli_status().
void ast_cel_publish_event | ( | struct ast_channel * | chan, |
enum ast_cel_event_type | event_type, | ||
struct ast_json * | blob | ||
) |
Publish a CEL event.
chan | This is the primary channel associated with this channel event. |
event_type | This is the type of call event being reported. |
blob | This contains any additional parameters that need to be conveyed for this event. |
Definition at line 1709 of file cel.c.
References ao2_cleanup, ast_cel_topic(), ast_channel_blob_create_from_cache(), ast_channel_uniqueid(), ast_json_pack(), ast_json_ref(), ast_json_unref(), cel_generic_type(), and stasis_publish().
Referenced by ast_cel_publish_user_event(), and celgenuserevent_exec().
void ast_cel_publish_user_event | ( | struct ast_channel * | chan, |
const char * | event, | ||
const char * | extra | ||
) |
Publish a CEL user event.
chan | This is the primary channel associated with this channel event. |
event | This is the user event being reported. |
extra | This contains any extra parameters that need to be conveyed for this event. |
Definition at line 1694 of file cel.c.
References ast_cel_publish_event(), AST_CEL_USER_DEFINED, ast_json_pack(), ast_json_unref(), NULL, RAII_VAR, and S_OR.
void ast_cel_set_config | ( | struct ast_cel_general_config * | config | ) |
Set the current CEL configuration.
config | The new CEL configuration |
Definition at line 1745 of file cel.c.
References ao2_bump, ao2_cleanup, ao2_global_obj_ref, ao2_ref, ast_cel_check_enabled(), config, create_routes(), destroy_routes(), cel_config::general, and is_enabled().
Referenced by cel_verify_and_cleanup_cb(), and test_cel_init_cb().
enum ast_cel_event_type ast_cel_str_to_event_type | ( | const char * | name | ) |
Get the event type from a string.
name | the event type name as a string |
Definition at line 420 of file cel.c.
References ARRAY_LEN, AST_CEL_INVALID_VALUE, ast_log, cel_event_types, LOG_ERROR, and name.
Referenced by events_handler().
struct stasis_topic * ast_cel_topic | ( | void | ) |
Get the CEL topic.
The | CEL topic |
NULL | if not allocated |
Definition at line 1728 of file cel.c.
References cel_topic.
Referenced by ast_cel_publish_event(), and create_subscriptions().
|
static |
Definition at line 434 of file cel.c.
References ao2_cleanup, ao2_global_obj_ref, and RAII_VAR.
Referenced by cel_channel_linkedid_change(), cel_channel_state_change(), and cel_report_event().
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
|
static |
Definition at line 1309 of file cel.c.
References ast_attended_transfer_message::app, AST_ATTENDED_TRANSFER_DEST_APP, AST_ATTENDED_TRANSFER_DEST_BRIDGE_MERGE, AST_ATTENDED_TRANSFER_DEST_FAIL, AST_ATTENDED_TRANSFER_DEST_LINK, AST_ATTENDED_TRANSFER_DEST_LOCAL_APP, AST_ATTENDED_TRANSFER_DEST_THREEWAY, AST_CEL_ATTENDEDTRANSFER, ast_json_pack(), ast_json_unref(), ast_channel_snapshot::base, ast_bridge_channel_snapshot_pair::bridge_snapshot, cel_report_event(), ast_bridge_channel_snapshot_pair::channel_snapshot, ast_attended_transfer_message::dest, ast_attended_transfer_message::dest_type, ast_channel_snapshot_base::name, NULL, stasis_message_data(), stasis_message_timestamp(), ast_attended_transfer_message::target, ast_attended_transfer_message::to_transfer_target, ast_attended_transfer_message::to_transferee, ast_attended_transfer_message::transferee, ast_bridge_snapshot::uniqueid, and ast_channel_snapshot_base::uniqueid.
Referenced by create_routes().
|
static |
Definition at line 564 of file cel.c.
References cel_backend::callback.
Referenced by cel_report_event().
|
static |
Definition at line 1283 of file cel.c.
References AST_BRIDGE_TRANSFER_SUCCESS, AST_CEL_BLINDTRANSFER, ast_json_pack(), ast_json_unref(), ast_channel_snapshot::base, ast_blind_transfer_message::bridge, cel_report_event(), ast_blind_transfer_message::context, ast_blind_transfer_message::exten, ast_channel_snapshot_base::name, NULL, ast_blind_transfer_message::result, stasis_message_data(), stasis_message_timestamp(), ast_blind_transfer_message::transferee, ast_blind_transfer_message::transferer, ast_bridge_snapshot::uniqueid, and ast_channel_snapshot_base::uniqueid.
Referenced by create_routes().
|
static |
Definition at line 1051 of file cel.c.
References AST_CEL_BRIDGE_ENTER, ast_free, ast_json_pack(), ast_json_unref(), ast_str_buffer(), ast_bridge_blob::blob, ast_bridge_blob::bridge, cel_filter_channel_snapshot(), cel_generate_peer_str(), cel_report_event(), ast_bridge_blob::channel, NULL, RAII_VAR, stasis_message_data(), stasis_message_timestamp(), ast_bridge_snapshot::technology, and ast_bridge_snapshot::uniqueid.
Referenced by create_routes().
|
static |
Definition at line 1081 of file cel.c.
References AST_CEL_BRIDGE_EXIT, ast_free, ast_json_pack(), ast_json_unref(), ast_str_buffer(), ast_bridge_blob::blob, ast_bridge_blob::bridge, cel_filter_channel_snapshot(), cel_generate_peer_str(), cel_report_event(), ast_bridge_blob::channel, NULL, RAII_VAR, stasis_message_data(), stasis_message_timestamp(), ast_bridge_snapshot::technology, and ast_bridge_snapshot::uniqueid.
Referenced by create_routes().
|
static |
Definition at line 959 of file cel.c.
References ast_channel_snapshot_dialplan::appl, AST_CEL_APP_END, AST_CEL_APP_START, ast_strlen_zero(), cel_report_event(), ast_channel_snapshot::dialplan, and NULL.
|
static |
Definition at line 940 of file cel.c.
References ast_assert, AST_CEL_LINKEDID_END, ast_cel_track_event(), ast_strlen_zero(), cel_linkedid_ref(), check_retire_linkedid(), ast_channel_snapshot_peer::linkedid, and ast_channel_snapshot::peer.
|
static |
Handle channel state changes.
Definition at line 900 of file cel.c.
References ao2_cleanup, AST_CEL_ANSWER, AST_CEL_CHANNEL_END, AST_CEL_CHANNEL_START, AST_CEL_HANGUP, AST_CEL_LINKEDID_END, ast_cel_track_event(), AST_FLAG_DEAD, ast_json_pack(), ast_json_unref(), AST_STATE_UP, ast_test_flag, ast_channel_snapshot::base, ast_channel_snapshot_hangup::cause, cel_report_event(), check_retire_linkedid(), cel_dialstatus::dialstatus, ast_channel_snapshot::flags, get_dialstatus(), ast_channel_snapshot::hangup, NULL, ast_channel_snapshot_hangup::source, ast_channel_snapshot::state, and ast_channel_snapshot_base::uniqueid.
|
static |
Definition at line 225 of file cel.c.
References ao2_alloc, ao2_cleanup, ao2_ref, ast_cel_general_config_alloc(), cel_config_dtor(), NULL, and RAII_VAR.
Referenced by load_module().
|
static |
Destructor for cel_config.
Definition at line 218 of file cel.c.
References ao2_cleanup, cel_config::general, and NULL.
Referenced by cel_config_alloc().
|
static |
Definition at line 1233 of file cel.c.
References AST_CEL_FORWARD, ast_json_pack(), ast_json_unref(), ast_multi_channel_blob_get_channel(), ast_strlen_zero(), ast_multi_channel_blob::blob, cel_filter_channel_snapshot(), cel_report_event(), get_blob_variable(), is_valid_dialstatus(), NULL, save_dialstatus(), stasis_message_data(), and stasis_message_timestamp().
Referenced by create_routes().
|
static |
Definition at line 990 of file cel.c.
References AST_CHAN_TP_INTERNAL, ast_channel_snapshot::base, and ast_channel_snapshot_base::tech_properties.
Referenced by cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_dial_cb(), and cel_snapshot_update_cb().
|
static |
Destructor for cel_config.
Definition at line 181 of file cel.c.
References ao2_cleanup, ast_cel_general_config::apps, ast_string_field_free_memory, and NULL.
Referenced by ast_cel_general_config_alloc().
|
static |
Definition at line 1013 of file cel.c.
References ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ast_channel_snapshot_get_latest(), ast_str_append(), ast_str_create, ast_str_truncate(), ast_channel_snapshot::base, ast_bridge_snapshot::channels, ast_channel_snapshot_base::name, NULL, and ast_channel_snapshot_base::uniqueid.
Referenced by cel_bridge_enter_cb(), and cel_bridge_leave_cb().
|
static |
Definition at line 1260 of file cel.c.
References ast_cel_get_type_name(), AST_CEL_USER_DEFINED, ast_json_integer_get(), ast_json_object_get(), ast_json_string_get(), ast_log, ast_channel_blob::blob, cel_report_event(), LOG_ERROR, NULL, ast_channel_blob::snapshot, stasis_message_data(), and stasis_message_timestamp().
Referenced by create_routes().
struct stasis_message_type * cel_generic_type | ( | void | ) |
Referenced by ast_cel_publish_event(), create_routes(), load_module(), and unload_module().
|
static |
Definition at line 784 of file cel.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_link, ao2_lock, ao2_ref, ao2_unlock, ast_log, ast_strlen_zero(), cel_linkedid::count, cel_linkedid::id, LOG_ERROR, NULL, OBJ_SEARCH_KEY, and RAII_VAR.
Referenced by cel_channel_linkedid_change(), and cel_report_event().
|
static |
Definition at line 1432 of file cel.c.
References AST_CEL_LOCAL_OPTIMIZE_BEGIN, cel_local_optimization_cb_helper(), and sub.
Referenced by create_routes().
|
static |
Definition at line 1397 of file cel.c.
References ast_json_pack(), ast_json_unref(), ast_multi_channel_blob_get_channel(), ast_channel_snapshot::base, cel_report_event(), ast_channel_snapshot_base::name, NULL, stasis_message_data(), stasis_message_timestamp(), and ast_channel_snapshot_base::uniqueid.
Referenced by cel_local_optimization_begin_cb(), and cel_local_optimization_end_cb().
|
static |
Definition at line 1422 of file cel.c.
References AST_CEL_LOCAL_OPTIMIZE, cel_local_optimization_cb_helper(), and sub.
Referenced by create_routes().
|
static |
Definition at line 1111 of file cel.c.
References AST_CEL_PARK_END, AST_CEL_PARK_START, ast_json_pack(), ast_json_unref(), ast_channel_snapshot::base, cel_report_event(), ast_parked_call_payload::event_type, ast_channel_snapshot_base::name, NULL, PARKED_CALL, PARKED_CALL_FAILED, PARKED_CALL_GIVEUP, PARKED_CALL_SWAP, PARKED_CALL_TIMEOUT, PARKED_CALL_UNPARKED, ast_parked_call_payload::parkee, ast_parked_call_payload::parker_dial_string, ast_parked_call_payload::parkinglot, RAII_VAR, ast_parked_call_payload::retriever, stasis_message_data(), and stasis_message_timestamp().
Referenced by create_routes().
|
static |
Definition at line 1372 of file cel.c.
References AST_CEL_PICKUP, ast_json_pack(), ast_json_unref(), ast_multi_channel_blob_get_channel(), ast_channel_snapshot::base, cel_report_event(), ast_channel_snapshot_base::name, NULL, stasis_message_data(), stasis_message_timestamp(), and ast_channel_snapshot_base::uniqueid.
Referenced by create_routes().
|
static |
Definition at line 277 of file cel.c.
References aco_pending_config(), ao2_container_count(), ast_cel_general_config::apps, AST_CEL_APP_END, AST_CEL_APP_START, ast_log, ast_cel_general_config::events, cel_config::general, and LOG_ERROR.
|
static |
Definition at line 572 of file cel.c.
References ao2_callback, ao2_cleanup, ao2_global_obj_ref, ast_channel_snapshot_dialplan::appl, AST_CEL_APP_END, AST_CEL_APP_START, AST_CEL_CHANNEL_START, ast_cel_create_event_with_time(), AST_CEL_LINKEDID_END, ast_cel_track_event(), ast_event_destroy(), cel_backend_send_cb(), cel_linkedid_ref(), cel_track_app(), ast_channel_snapshot::dialplan, ast_channel_snapshot_peer::linkedid, OBJ_MULTIPLE, OBJ_NODATA, ast_channel_snapshot::peer, and RAII_VAR.
Referenced by cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_channel_app_change(), cel_channel_state_change(), cel_dial_cb(), cel_generic_cb(), cel_local_optimization_cb_helper(), cel_parking_cb(), cel_pickup_cb(), and check_retire_linkedid().
|
static |
Definition at line 998 of file cel.c.
References ARRAY_LEN, cel_channel_monitors, cel_filter_channel_snapshot(), stasis_message_data(), stasis_message_timestamp(), and update().
Referenced by create_routes().
|
static |
Definition at line 498 of file cel.c.
References ao2_cleanup, ao2_find, ao2_global_obj_ref, app, ast_str_to_lower(), ast_strdupa, NULL, OBJ_SEARCH_KEY, and RAII_VAR.
Referenced by cel_report_event().
|
static |
Definition at line 617 of file cel.c.
References ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_lock, ao2_ref, ao2_unlink, ao2_unlock, AST_CEL_LINKEDID_END, ast_log, ast_strlen_zero(), cel_report_event(), cel_linkedid::count, ast_channel_snapshot_peer::linkedid, LOG_ERROR, NULL, OBJ_SEARCH_KEY, ast_channel_snapshot::peer, and RAII_VAR.
Referenced by cel_channel_linkedid_change(), and cel_channel_state_change().
CONFIG_INFO_CORE | ( | "cel" | , |
cel_cfg_info | , | ||
cel_configs | , | ||
cel_config_alloc | , | ||
. | files = ACO_FILES(&cel_conf) , |
||
. | pre_apply_config = cel_pre_apply_config |
||
) |
|
static |
Create the Stasis message router and routes for CEL.
Definition at line 1523 of file cel.c.
References ast_attended_transfer_type(), ast_blind_transfer_type(), ast_call_pickup_type(), ast_channel_dial_type(), ast_channel_entered_bridge_type(), ast_channel_left_bridge_type(), ast_channel_snapshot_type(), ast_local_optimization_begin_type(), ast_local_optimization_end_type(), ast_log, AST_LOG_ERROR, ast_parked_call_type(), AST_TASKPROCESSOR_HIGH_WATER_LEVEL, cel_aggregation_topic, cel_attended_transfer_cb(), cel_blind_transfer_cb(), cel_bridge_enter_cb(), cel_bridge_leave_cb(), cel_dial_cb(), cel_generic_cb(), cel_generic_type(), cel_local_optimization_begin_cb(), cel_local_optimization_end_cb(), cel_parking_cb(), cel_pickup_cb(), cel_snapshot_update_cb(), cel_state_router, NULL, stasis_message_router_add(), stasis_message_router_create, and stasis_message_router_set_congestion_limits().
Referenced by ast_cel_set_config(), load_module(), and reload_module().
|
static |
Create the Stasis subscriptions for CEL.
Definition at line 1477 of file cel.c.
References ast_bridge_topic_all(), ast_cel_topic(), ast_channel_topic_all(), ast_parking_topic(), cel_aggregation_topic, cel_bridge_forwarder, cel_cel_forwarder, cel_channel_forwarder, cel_parking_forwarder, cel_topic, stasis_forward_all(), and stasis_topic_create().
Referenced by load_module().
|
static |
Definition at line 1439 of file cel.c.
References cel_state_router, NULL, and stasis_message_router_unsubscribe_and_join().
Referenced by ast_cel_set_config(), reload_module(), and unload_module().
|
static |
Definition at line 1445 of file cel.c.
References ao2_cleanup, cel_aggregation_topic, cel_bridge_forwarder, cel_cel_forwarder, cel_channel_forwarder, cel_parking_forwarder, cel_topic, NULL, and stasis_forward_cancel().
Referenced by unload_module().
|
static |
Definition at line 445 of file cel.c.
References AST_CEL_ALL, AST_CEL_INVALID_VALUE, ast_cel_str_to_event_type(), ast_strdupa, ast_strip(), ast_strlen_zero(), events, ast_cel_general_config::events, strsep(), and var.
Referenced by load_module().
|
static |
Definition at line 884 of file cel.c.
References ast_json_object_get(), ast_json_string_get(), ast_multi_channel_blob_get_json(), and NULL.
Referenced by cel_dial_cb(), is_valid_dialstatus(), and save_dialstatus().
|
static |
Definition at line 872 of file cel.c.
References ao2_find, ao2_global_obj_ref, ao2_ref, cel_dialstatus::dialstatus, NULL, OBJ_SEARCH_KEY, OBJ_UNLINK, and cel_dialstatus::uniqueid.
Referenced by cel_channel_state_change().
|
static |
Definition at line 355 of file cel.c.
References a, ao2_cleanup, ao2_global_obj_ref, ao2_iterator_destroy(), ao2_iterator_init(), ao2_iterator_next, ao2_ref, app, ast_cel_check_enabled(), ast_cel_get_type_name(), ast_cli(), CLI_GENERATE, CLI_HANDLER, CLI_INIT, CLI_SHOWUSAGE, CLI_SUCCESS, ast_cli_entry::command, cel_backend::name, name, NULL, RAII_VAR, and ast_cli_entry::usage.
|
static |
Definition at line 1204 of file cel.c.
References ast_strlen_zero(), cel_dialstatus::dialstatus, and get_blob_variable().
Referenced by cel_dial_cb().
|
static |
Definition at line 1599 of file cel.c.
References ACO_EXACT, aco_info_init(), aco_option_register, aco_option_register_custom, aco_process_config(), aco_set_defaults(), AO2_ALLOC_OPT_LOCK_MUTEX, ao2_cleanup, ao2_container_alloc_hash, ao2_global_obj_replace_unref, ao2_ref, apps_handler(), ast_cel_check_enabled(), ast_cli_register, ast_log, AST_MODULE_LOAD_FAILURE, AST_MODULE_LOAD_SUCCESS, BACKEND_BUCKETS, cel_config_alloc(), cel_generic_type(), cli_status, container, create_routes(), create_subscriptions(), events_handler(), FLDSET, cel_config::general, general_option, general_options, LOG_NOTICE, NULL, NUM_APP_BUCKETS, NUM_DIALSTATUS_BUCKETS, OPT_BOOL_T, OPT_STRINGFIELD_T, STASIS_MESSAGE_TYPE_INIT, and STRFLDSET.
|
static |
Definition at line 1670 of file cel.c.
References aco_process_config(), ACO_PROCESS_ERROR, ast_cel_check_enabled(), ast_verb, create_routes(), destroy_routes(), and is_enabled().
|
static |
Definition at line 1160 of file cel.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_find, ao2_global_obj_ref, ao2_link, ao2_ref, ao2_unlink, ast_copy_string(), ast_strlen_zero(), ast_channel_snapshot::base, cel_dialstatus::dialstatus, get_blob_variable(), NULL, OBJ_SEARCH_KEY, and ast_channel_snapshot_base::uniqueid.
Referenced by cel_dial_cb().
STASIS_MESSAGE_TYPE_DEFN | ( | cel_generic_type | ) |
|
static |
Definition at line 1458 of file cel.c.
References aco_info_destroy(), ao2_global_obj_release, ast_cli_unregister(), cel_generic_type(), cli_status, destroy_routes(), destroy_subscriptions(), and STASIS_MESSAGE_TYPE_CLEANUP.
|
static |
|
static |
|
static |
Aggregation topic for all topics CEL needs to know about
Definition at line 121 of file cel.c.
Referenced by create_routes(), create_subscriptions(), and destroy_subscriptions().
|
static |
Subscription for forwarding the channel caching topic
Definition at line 127 of file cel.c.
Referenced by create_subscriptions(), and destroy_subscriptions().
|
static |
Subscription for forwarding the CEL-specific topic
Definition at line 133 of file cel.c.
Referenced by create_subscriptions(), and destroy_subscriptions().
|
static |
Subscription for forwarding the channel caching topic
Definition at line 124 of file cel.c.
Referenced by create_subscriptions(), and destroy_subscriptions().
cel_channel_snapshot_monitor cel_channel_monitors[] |
Handlers for channel snapshot changes.
Definition at line 984 of file cel.c.
Referenced by cel_snapshot_update_cb().
|
static |
The config file to be processed for the module.
|
static |
Map of ast_cel_event_type to strings.
Definition at line 306 of file cel.c.
Referenced by ast_cel_get_type_name(), and ast_cel_str_to_event_type().
|
static |
Subscription for forwarding the parking topic
Definition at line 130 of file cel.c.
Referenced by create_subscriptions(), and destroy_subscriptions().
|
static |
Message router for state that CEL needs to know about
Definition at line 115 of file cel.c.
Referenced by create_routes(), and destroy_routes().
|
static |
Topic for CEL-specific messages
Definition at line 118 of file cel.c.
Referenced by ast_cel_topic(), create_subscriptions(), and destroy_subscriptions().
|
static |
Definition at line 418 of file cel.c.
Referenced by load_module(), and unload_module().
|
static |
Definition at line 658 of file cel.c.
Referenced by ast_cel_fabricate_channel_from_event().
|
static |
An aco_type structure to link the "general" category to the ast_cel_general_config type.
Definition at line 242 of file cel.c.
Referenced by load_module().
|
static |
Definition at line 301 of file cel.c.
Referenced by load_module().
|
static |