Asterisk - The Open Source Telephony Project
18.5.0
|
Call Event Logging API. More...
#include "asterisk/event.h"
Go to the source code of this file.
Data Structures | |
struct | ast_cel_event_record |
Helper struct for getting the fields out of a CEL event. More... | |
struct | ast_cel_general_config |
A structure to hold CEL global configuration options. More... | |
Macros | |
#define | AST_CEL_EVENT_RECORD_VERSION 2 |
struct ABI version More... | |
Typedefs | |
typedef void(* | ast_cel_backend_cb) (struct ast_event *event) |
CEL backend callback. More... | |
Enumerations | |
enum | ast_cel_event_type { AST_CEL_INVALID_VALUE = -1, AST_CEL_ALL = 0, AST_CEL_CHANNEL_START = 1, AST_CEL_CHANNEL_END = 2, AST_CEL_HANGUP = 3, AST_CEL_ANSWER = 4, AST_CEL_APP_START = 5, AST_CEL_APP_END = 6, AST_CEL_BRIDGE_ENTER = 7, AST_CEL_BRIDGE_EXIT = 8, AST_CEL_PARK_START = 9, AST_CEL_PARK_END = 10, AST_CEL_BLINDTRANSFER = 11, AST_CEL_ATTENDEDTRANSFER = 12, AST_CEL_USER_DEFINED = 13, AST_CEL_LINKEDID_END = 14, AST_CEL_PICKUP = 15, AST_CEL_FORWARD = 16, AST_CEL_LOCAL_OPTIMIZE = 17 } |
CEL event types. More... | |
Functions | |
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) |
Check to see if CEL is enabled. 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_str) |
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_str) |
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 *event, 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_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... | |
Call Event Logging API.
Definition in file cel.h.
#define AST_CEL_EVENT_RECORD_VERSION 2 |
struct ABI version
Definition at line 141 of file cel.h.
Referenced by ast_cel_fabricate_channel_from_event(), ast_cel_fill_record(), cel_bs_put(), manager_log(), odbc_log(), pgsql_log(), radius_log(), and tds_log().
enum ast_cel_event_type |
CEL event types.
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 1740 of file cel.c.
References AO2_ALLOC_OPT_LOCK_NOLOCK, ao2_alloc_options, ao2_cleanup, ao2_global_obj_ref, ao2_link, ao2_ref, AST_MODFLAG_GLOBAL_SYMBOLS, AST_MODFLAG_LOAD_ORDER, AST_MODPRI_CORE, AST_MODULE_INFO(), AST_MODULE_SUPPORT_CORE, ast_strlen_zero, ASTERISK_GPL_KEY, cel_backend::callback, load_module(), cel_backend::name, NULL, RAII_VAR, reload(), reload_module(), and unload_module().
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 1728 of file cel.c.
References ao2_find, ao2_global_obj_ref, ao2_ref, 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 | ) |
Check to see if CEL is enabled.
zero | not enabled |
non-zero | enabled |
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 343 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 517 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 527 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_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::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 660 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_name_set(), 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, 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 819 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_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::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 188 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.
NULL | on error |
The | current CEL configuration |
Definition at line 1690 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 491 of file cel.c.
References cel_event_types, and S_OR.
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 1666 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 celgenuserevent_exec().
void ast_cel_set_config | ( | struct ast_cel_general_config * | config | ) |
Set the current CEL configuration.
config | The new CEL configuration |
Definition at line 1702 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 418 of file cel.c.
References ARRAY_LEN, AST_CEL_INVALID_VALUE, ast_log, cel_event_types, and LOG_ERROR.
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 1685 of file cel.c.
References cel_topic.
Referenced by ast_cel_publish_event(), and create_subscriptions().