Asterisk - The Open Source Telephony Project
18.5.0
|
Call Detail Record API. More...
#include "asterisk.h"
#include <signal.h>
#include <inttypes.h>
#include "asterisk/lock.h"
#include "asterisk/channel.h"
#include "asterisk/cdr.h"
#include "asterisk/callerid.h"
#include "asterisk/manager.h"
#include "asterisk/module.h"
#include "asterisk/causes.h"
#include "asterisk/linkedlists.h"
#include "asterisk/utils.h"
#include "asterisk/sched.h"
#include "asterisk/config.h"
#include "asterisk/cli.h"
#include "asterisk/stringfields.h"
#include "asterisk/config_options.h"
#include "asterisk/json.h"
#include "asterisk/parking.h"
#include "asterisk/stasis.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_bridges.h"
#include "asterisk/stasis_message_router.h"
#include "asterisk/astobj2.h"
#include "asterisk/taskprocessor.h"
Go to the source code of this file.
Data Structures | |
struct | be_list |
List of registered backends. More... | |
struct | bridge_leave_data |
struct | cdr_batch |
The actual batch queue. More... | |
struct | cdr_batch_item |
Queued CDR waiting to be batched. More... | |
struct | cdr_beitem |
Registration object for CDR backends. More... | |
struct | cdr_object |
An in-memory representation of an active CDR. More... | |
struct | cdr_object_fn_table |
A virtual table used for cdr_object. More... | |
struct | cdr_object_snapshot |
A wrapper object around a snapshot. Fields that are mutable by the CDR engine are replicated here. More... | |
struct | mo_list |
List of registered modifiers. More... | |
struct | module_config |
The configuration settings for this module. More... | |
struct | party_b_userfield_update |
Macros | |
#define | CDR_DEBUG(fmt, ...) |
#define | cdr_set_debug_mode(mod_cfg) |
#define | DEFAULT_BATCH_SAFE_SHUTDOWN "1" |
#define | DEFAULT_BATCH_SCHEDULER_ONLY "0" |
#define | DEFAULT_BATCH_SIZE "100" |
#define | DEFAULT_BATCH_TIME "300" |
#define | DEFAULT_BATCHMODE "0" |
#define | DEFAULT_CONGESTION "0" |
#define | DEFAULT_ENABLED "1" |
#define | DEFAULT_END_BEFORE_H_EXTEN "1" |
#define | DEFAULT_INITIATED_SECONDS "0" |
#define | DEFAULT_UNANSWERED "0" |
#define | FORMAT_STRING "%-25.25s %-25.25s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8ld %-8.8ld\n" |
#define | FORMAT_STRING "%-10.10s %-20.20s %-25.25s %-15.15s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8ld %-8.8ld\n" |
#define | MAX_BATCH_SIZE 1000 |
#define | MAX_BATCH_TIME 86400 |
#define | TITLE_STRING "%-25.25s %-25.25s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8s %-8.8s\n" |
#define | TITLE_STRING "%-10.10s %-20.20s %-25.25s %-15.15s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8s %-8.8s\n" |
Enumerations | |
enum | process_bridge_enter_results { BRIDGE_ENTER_ONLY_PARTY, BRIDGE_ENTER_OBTAINED_PARTY_B, BRIDGE_ENTER_NO_PARTY_B, BRIDGE_ENTER_NEED_CDR } |
Return types for process_bridge_enter functions. More... | |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static | AO2_GLOBAL_OBJ_STATIC (module_configs) |
The container for the module configuration. More... | |
struct ast_cdr * | ast_cdr_alloc (void) |
Allocate a CDR record. More... | |
int | ast_cdr_backend_suspend (const char *name) |
Suspend a CDR backend temporarily. More... | |
int | ast_cdr_backend_unsuspend (const char *name) |
Unsuspend a CDR backend. More... | |
int | ast_cdr_clear_property (const char *channel_name, enum ast_cdr_options option) |
Clear a property on a CDR for a channel. More... | |
const char * | ast_cdr_disp2str (int disposition) |
Disposition to a string. More... | |
struct ast_cdr * | ast_cdr_dup (struct ast_cdr *cdr) |
Duplicate a public CDR. More... | |
void | ast_cdr_engine_term (void) |
int | ast_cdr_fork (const char *channel_name, struct ast_flags *options) |
Fork a CDR. More... | |
void | ast_cdr_format_var (struct ast_cdr *cdr, const char *name, char **ret, char *workspace, int workspacelen, int raw) |
Format a CDR variable from an already posted CDR. More... | |
void | ast_cdr_free (struct ast_cdr *cdr) |
Free a CDR record. More... | |
static int | ast_cdr_generic_unregister (struct be_list *generic_list, const char *name) |
struct ast_cdr_config * | ast_cdr_get_config (void) |
Obtain the current CDR configuration. More... | |
int | ast_cdr_getvar (const char *channel_name, const char *name, char *value, size_t length) |
Retrieve a CDR variable from a channel's current CDR. More... | |
int | ast_cdr_is_enabled (void) |
Return TRUE if CDR subsystem is enabled. More... | |
struct stasis_message_router * | ast_cdr_message_router (void) |
Return the message router for the CDR engine. More... | |
int | ast_cdr_modifier_register (const char *name, const char *desc, ast_cdrbe be) |
Register a CDR modifier. More... | |
int | ast_cdr_modifier_unregister (const char *name) |
Unregister a CDR modifier. More... | |
int | ast_cdr_register (const char *name, const char *desc, ast_cdrbe be) |
Register a CDR handling engine. More... | |
int | ast_cdr_reset (const char *channel_name, int keep_variables) |
Reset the detail record. More... | |
int | ast_cdr_serialize_variables (const char *channel_name, struct ast_str **buf, char delim, char sep) |
Serializes all the data and variables for a current CDR record. More... | |
void | ast_cdr_set_config (struct ast_cdr_config *config) |
Set the current CDR configuration. More... | |
int | ast_cdr_set_property (const char *channel_name, enum ast_cdr_options option) |
Set a property on a CDR for a channel. More... | |
void | ast_cdr_setuserfield (const char *channel_name, const char *userfield) |
Set CDR user field for channel (stored in CDR) More... | |
int | ast_cdr_setvar (const char *channel_name, const char *name, const char *value) |
Set a variable on a CDR. More... | |
int | ast_cdr_unregister (const char *name) |
Unregister a CDR handling engine. More... | |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
static enum process_bridge_enter_results | base_process_bridge_enter (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static int | base_process_bridge_leave (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static int | base_process_dial_end (struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer, const char *dial_status) |
static int | base_process_parked_channel (struct cdr_object *cdr, struct ast_parked_call_payload *parking_info) |
static int | base_process_party_a (struct cdr_object *cdr, struct ast_channel_snapshot *snapshot) |
static void | bridge_candidate_add_to_cdr (struct cdr_object *cdr, struct cdr_object_snapshot *party_b) |
static void | bridge_candidate_process (struct cdr_object *cdr, struct cdr_object *base_cand_cdr) |
Process a single bridge_candidate. More... | |
static int | bridge_state_process_bridge_leave (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static void | bridge_state_process_party_b (struct cdr_object *cdr, struct ast_channel_snapshot *snapshot) |
static int | cdr_all_cmp_fn (void *obj, void *arg, int flags) |
static int | cdr_all_hash_fn (const void *obj, const int flags) |
static void | cdr_all_print_fn (void *v_obj, void *where, ao2_prnt_fn *prnt) |
static void | cdr_all_relink (struct cdr_object *cdr) |
static void | cdr_all_unlink (struct cdr_object *cdr) |
static void | cdr_detach (struct ast_cdr *cdr) |
static void | cdr_enable_batch_mode (struct ast_cdr_config *config) |
static void | cdr_engine_shutdown (void) |
static const char * | cdr_format_var_internal (struct ast_cdr *cdr, const char *name) |
static int | cdr_generic_register (struct be_list *generic_list, const char *name, const char *desc, ast_cdrbe be) |
static void | cdr_get_tv (struct timeval when, const char *fmt, char *buf, int bufsize) |
static int | cdr_master_cmp_fn (void *obj, void *arg, int flags) |
static int | cdr_master_hash_fn (const void *obj, const int flags) |
static void | cdr_master_print_fn (void *v_obj, void *where, ao2_prnt_fn *prnt) |
static struct cdr_object * | cdr_object_alloc (struct ast_channel_snapshot *chan, const struct timeval *event_time) |
cdr_object constructor More... | |
static void | cdr_object_check_party_a_answer (struct cdr_object *cdr) |
Check to see if a CDR needs to be answered based on its Party A. Note that this is safe to call as much as you want - we won't answer twice. More... | |
static void | cdr_object_check_party_a_hangup (struct cdr_object *cdr) |
Check to see if a CDR needs to move to the finalized state because its Party A hungup. More... | |
static struct cdr_object * | cdr_object_create_and_append (struct cdr_object *cdr, const struct timeval *event_time) |
Create a new cdr_object and append it to an existing chain. More... | |
static struct ast_cdr * | cdr_object_create_public_records (struct cdr_object *cdr) |
Create a chain of ast_cdr objects from a chain of cdr_object suitable for consumption by the registered CDR backends. More... | |
static void | cdr_object_dispatch (struct cdr_object *cdr) |
Dispatch a CDR. More... | |
static int | cdr_object_dispatch_all_cb (void *obj, void *arg, int flags) |
This dispatches all cdr_objects. It should only be used during shutdown, so that we get billing records for everything that we can. More... | |
static void | cdr_object_dtor (void *obj) |
cdr_object Destructor More... | |
static void | cdr_object_finalize (struct cdr_object *cdr) |
Finalize a CDR. More... | |
static int | cdr_object_finalize_party_b (void *obj, void *arg, void *data, int flags) |
static int | cdr_object_format_property (struct cdr_object *cdr_obj, const char *name, char *value, size_t length) |
Format one of the standard properties on a cdr_object. More... | |
static void | cdr_object_format_var_internal (struct cdr_object *cdr, const char *name, char *value, size_t length) |
Format a variable on a cdr_object. More... | |
static long | cdr_object_get_billsec (struct cdr_object *cdr) |
Compute the billsec for a cdr_object. More... | |
static struct cdr_object * | cdr_object_get_by_name (const char *name) |
static int | cdr_object_get_by_name_cb (void *obj, void *arg, int flags) |
static long | cdr_object_get_duration (struct cdr_object *cdr) |
static int | cdr_object_party_b_left_bridge_cb (void *obj, void *arg, void *data, int flags) |
Callback used to notify CDRs of a Party B leaving the bridge. More... | |
static struct cdr_object_snapshot * | cdr_object_pick_party_a (struct cdr_object_snapshot *left, struct cdr_object_snapshot *right) |
Given two CDR snapshots, figure out who should be Party A for the resulting CDR. More... | |
static int | cdr_object_select_all_by_name_cb (void *obj, void *arg, int flags) |
static void | cdr_object_set_disposition (struct cdr_object *cdr, int hangupcause) |
Set the disposition on a cdr_object based on a hangupcause code. More... | |
static void | cdr_object_snapshot_copy (struct cdr_object_snapshot *dst, struct cdr_object_snapshot *src) |
Copy a snapshot and its details. More... | |
static void | cdr_object_swap_snapshot (struct cdr_object_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) |
Swap an old cdr_object_snapshot's ast_channel_snapshot for a new ast_channel_snapshot. More... | |
static void | cdr_object_transition_state (struct cdr_object *cdr, struct cdr_object_fn_table *fn_table) |
Transition a cdr_object to a new state. More... | |
static void | cdr_object_transition_state_init (struct cdr_object *cdr, struct cdr_object_fn_table *fn_table, int do_init) |
Transition a cdr_object to a new state with initiation flag. More... | |
static void | cdr_object_update_cid (struct cdr_object_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) |
static int | cdr_object_update_party_b (void *obj, void *arg, void *data, int flags) |
static int | cdr_object_update_party_b_userfield_cb (void *obj, void *arg, void *data, int flags) |
Callback used to update the userfield on Party B on all CDRs. More... | |
static void | cdr_submit_batch (int shutdown) |
static int | cdr_toggle_runtime_options (void) |
Checks if CDRs are enabled and enables/disables the necessary options. More... | |
static int | check_new_cdr_needed (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) |
Determine if we need to add a new CDR based on snapshots. More... | |
static char * | cli_complete_show (struct ast_cli_args *a) |
Complete user input for 'cdr show'. More... | |
static void | cli_show_channel (struct ast_cli_args *a) |
static void | cli_show_channels (struct ast_cli_args *a) |
CONFIG_INFO_CORE ("cdr", cfg_info, module_configs, module_config_alloc,.files=ACO_FILES(&module_file_conf),.post_apply_config=module_config_post_apply,) | |
static int | copy_variables (struct varshead *to_list, struct varshead *from_list) |
Copy variables from one list to another. More... | |
static int | create_subscriptions (void) |
Create the Stasis subcriptions for CDRs. More... | |
static void | destroy_subscriptions (void) |
Destroy the active Stasis subscriptions. More... | |
static enum process_bridge_enter_results | dial_state_process_bridge_enter (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static int | dial_state_process_dial_begin (struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer) |
static int | dial_state_process_dial_end (struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer, const char *dial_status) |
static void | dial_state_process_party_b (struct cdr_object *cdr, struct ast_channel_snapshot *snapshot) |
static int | dial_status_end (const char *dialstatus) |
static enum ast_cdr_disposition | dial_status_to_disposition (const char *dial_status) |
static enum process_bridge_enter_results | dialed_pending_state_process_bridge_enter (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static int | dialed_pending_state_process_dial_begin (struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer) |
static int | dialed_pending_state_process_parking_bridge_enter (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static int | dialed_pending_state_process_party_a (struct cdr_object *cdr, struct ast_channel_snapshot *snapshot) |
static void * | do_batch_backend_process (void *data) |
static void * | do_cdr (void *data) |
static int | filter_bridge_messages (struct ast_bridge_snapshot *bridge) |
Filter bridge messages based on bridge technology. More... | |
static int | filter_channel_snapshot (struct ast_channel_snapshot *snapshot) |
static int | filter_channel_snapshot_message (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) |
static void | finalize_batch_mode (void) |
static void | finalized_state_init_function (struct cdr_object *cdr) |
static int | finalized_state_process_party_a (struct cdr_object *cdr, struct ast_channel_snapshot *snapshot) |
static void | free_variables (struct varshead *headp) |
Delete all variables from a variable list. More... | |
static void | handle_bridge_enter_message (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
static void | handle_bridge_leave_message (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Handler for when a channel leaves a bridge. More... | |
static void | handle_bridge_pairings (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge) |
Handle creating bridge pairings for the cdr_object that just entered a bridge. More... | |
static void | handle_cdr_sync_message (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Handler for a synchronization message. More... | |
static void | handle_channel_snapshot_update_message (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Handler for channel snapshot update messages. More... | |
static char * | handle_cli_debug (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_show (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_status (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static char * | handle_cli_submit (struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) |
static void | handle_dial_message (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Handler for Stasis-Core dial messages. More... | |
static void | handle_parked_call_message (void *data, struct stasis_subscription *sub, struct stasis_message *message) |
Handler for when a channel is parked. More... | |
static void | handle_parking_bridge_enter_message (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel, const struct timeval *event_time) |
Handle entering into a parking bridge. More... | |
static void | handle_standard_bridge_enter_message (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel, const struct timeval *event_time) |
Handle a bridge enter message for a 'normal' bridge. More... | |
static int | init_batch (void) |
static int | is_cdr_flag_set (unsigned int cdr_flag) |
static int | load_module (void) |
static void * | module_config_alloc (void) |
Create a new module config object. More... | |
static void | module_config_destructor (void *obj) |
Dispose of a module config object. More... | |
static void | module_config_post_apply (void) |
static int | parked_state_process_bridge_leave (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static void | post_cdr (struct ast_cdr *cdr) |
static int | process_config (int reload) |
static int | reload_module (void) |
static void | reset_batch (void) |
static void | set_variable (struct varshead *headp, const char *name, const char *value) |
static int | single_state_bridge_enter_comparison (struct cdr_object *cdr, struct cdr_object *cand_cdr) |
Handle a comparison between our cdr_object and a cdr_object already in the bridge while in the Single state. The goal of this is to find a Party B for our CDR. More... | |
static void | single_state_init_function (struct cdr_object *cdr) |
static enum process_bridge_enter_results | single_state_process_bridge_enter (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static int | single_state_process_dial_begin (struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer) |
static int | single_state_process_parking_bridge_enter (struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel) |
static void | single_state_process_party_b (struct cdr_object *cdr, struct ast_channel_snapshot *snapshot) |
static int | snapshot_cep_changed (struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot) |
Return whether or not a channel has changed its state in the dialplan, subject to endbeforehexten logic. More... | |
static int | snapshot_is_dialed (struct ast_channel_snapshot *snapshot) |
Return whether or not a ast_channel_snapshot is for a channel that was created as the result of a dial operation. More... | |
static void | start_batch_mode (void) |
STASIS_MESSAGE_TYPE_DEFN_LOCAL (cdr_sync_message_type) | |
A message type used to synchronize with the CDR topic. More... | |
static int | submit_scheduled_batch (const void *data) |
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 = "CDR 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 = "30ef0c93b36035ec78c9cfd712d36d9b" , .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .reload = reload_module, .load_pri = AST_MODPRI_CORE, .requires = "extconfig", } |
static struct ao2_container * | active_cdrs_all |
A container of all active CDRs with a Party B indexed by Party B channel name. More... | |
static struct ao2_container * | active_cdrs_master |
A container of the active master CDRs indexed by Party A channel uniqueid. More... | |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static struct cdr_batch * | batch = NULL |
static struct be_list | be_list = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
struct cdr_object_fn_table | bridge_state_fn_table |
The virtual table for the Bridged state. More... | |
static struct stasis_forward * | bridge_subscription |
Our subscription for bridges. More... | |
static ast_mutex_t | cdr_batch_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
Lock protecting modifications to the batch queue. More... | |
static int | cdr_debug_enabled |
static ast_cond_t | cdr_pending_cond |
static ast_mutex_t | cdr_pending_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
These are used to wake up the CDR thread when there's work to do. More... | |
static const char *const | cdr_readonly_vars [] |
static int | cdr_sched = -1 |
static ast_mutex_t | cdr_sched_lock = { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP , NULL, {1, 0} } |
static pthread_t | cdr_thread = AST_PTHREADT_NULL |
static struct stasis_topic * | cdr_topic |
The parent topic for all topics we want to aggregate for CDRs. More... | |
static struct stasis_forward * | channel_subscription |
Our subscription for channels. More... | |
static struct ast_cli_entry | cli_commands [] |
struct cdr_object_fn_table | dial_state_fn_table |
The virtual table for the Dial state. More... | |
struct cdr_object_fn_table | dialed_pending_state_fn_table |
The virtual table for the Dialed Pending state. More... | |
struct cdr_object_fn_table | finalized_state_fn_table |
The virtual table for the finalized state. More... | |
static struct aco_type | general_option |
The type definition for general options. More... | |
static struct aco_type * | general_options [] = ACO_TYPES(&general_option) |
static int | global_cdr_sequence = 0 |
The global sequence counter used for CDRs. More... | |
static const char * | ignore_categories [] |
static struct aco_type | ignore_option |
static struct mo_list | mo_list = { .first = NULL, .last = NULL, .lock = { PTHREAD_RWLOCK_INITIALIZER , NULL, {1, 0} } , } |
static struct aco_file | module_file_conf |
The file definition. More... | |
struct cdr_object_fn_table | parked_state_fn_table |
The virtual table for the Parked state. More... | |
static struct stasis_forward * | parking_subscription |
Our subscription for parking. More... | |
static struct ast_sched_context * | sched |
Scheduler items. More... | |
struct cdr_object_fn_table | single_state_fn_table |
The virtual table for the Single state. More... | |
static struct stasis_message_router * | stasis_router |
Message router for stasis messages regarding channel state. More... | |
Call Detail Record API.
Definition in file cdr.c.
#define CDR_DEBUG | ( | fmt, | |
... | |||
) |
Definition at line 210 of file cdr.c.
Referenced by bridge_candidate_add_to_cdr(), bridge_candidate_process(), cdr_object_alloc(), cdr_object_check_party_a_answer(), cdr_object_dispatch(), cdr_object_transition_state_init(), handle_bridge_enter_message(), handle_bridge_leave_message(), handle_channel_snapshot_update_message(), handle_cli_debug(), handle_dial_message(), handle_parked_call_message(), handle_parking_bridge_enter_message(), handle_standard_bridge_enter_message(), process_config(), single_state_bridge_enter_comparison(), and single_state_process_dial_begin().
#define cdr_set_debug_mode | ( | mod_cfg | ) |
Definition at line 203 of file cdr.c.
Referenced by ast_cdr_set_config(), handle_cli_debug(), module_config_post_apply(), and process_config().
#define DEFAULT_BATCH_SAFE_SHUTDOWN "1" |
Definition at line 201 of file cdr.c.
Referenced by process_config().
#define DEFAULT_BATCH_SCHEDULER_ONLY "0" |
Definition at line 200 of file cdr.c.
Referenced by process_config().
#define DEFAULT_BATCH_SIZE "100" |
Definition at line 196 of file cdr.c.
Referenced by process_config().
#define DEFAULT_BATCH_TIME "300" |
Definition at line 198 of file cdr.c.
Referenced by process_config().
#define DEFAULT_BATCHMODE "0" |
Definition at line 190 of file cdr.c.
Referenced by process_config().
#define DEFAULT_ENABLED "1" |
Definition at line 189 of file cdr.c.
Referenced by process_config().
#define DEFAULT_END_BEFORE_H_EXTEN "1" |
Definition at line 193 of file cdr.c.
Referenced by process_config().
#define DEFAULT_INITIATED_SECONDS "0" |
Definition at line 194 of file cdr.c.
Referenced by process_config().
#define DEFAULT_UNANSWERED "0" |
Definition at line 191 of file cdr.c.
Referenced by process_config().
#define FORMAT_STRING "%-25.25s %-25.25s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8ld %-8.8ld\n" |
Referenced by cli_show_channel(), and cli_show_channels().
#define FORMAT_STRING "%-10.10s %-20.20s %-25.25s %-15.15s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8ld %-8.8ld\n" |
#define MAX_BATCH_SIZE 1000 |
Definition at line 197 of file cdr.c.
Referenced by process_config().
#define MAX_BATCH_TIME 86400 |
Definition at line 199 of file cdr.c.
Referenced by process_config().
#define TITLE_STRING "%-25.25s %-25.25s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8s %-8.8s\n" |
Referenced by cli_show_channel(), and cli_show_channels().
#define TITLE_STRING "%-10.10s %-20.20s %-25.25s %-15.15s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8s %-8.8s\n" |
Return types for process_bridge_enter functions.
|
static |
The container for the module configuration.
struct ast_cdr* ast_cdr_alloc | ( | void | ) |
Allocate a CDR record.
a | malloc'd ast_cdr structure |
NULL | on error (malloc failure) |
Definition at line 3422 of file cdr.c.
References ast_calloc.
Referenced by ast_cdr_dup().
int ast_cdr_backend_suspend | ( | const char * | name | ) |
Suspend a CDR backend temporarily.
0 | The backend is suspdended |
-1 | The backend could not be suspended |
Definition at line 2866 of file cdr.c.
References ast_debug, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cdr_beitem::name, and NULL.
Referenced by load_config(), my_unload_module(), and odbc_load_module().
int ast_cdr_backend_unsuspend | ( | const char * | name | ) |
Unsuspend a CDR backend.
0 | The backend was unsuspended |
-1 | The back could not be unsuspended |
Definition at line 2884 of file cdr.c.
References ast_debug, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, cdr_beitem::name, and NULL.
Referenced by load_config(), my_load_module(), and odbc_load_module().
int ast_cdr_clear_property | ( | const char * | channel_name, |
enum ast_cdr_options | option | ||
) |
Clear a property on a CDR for a channel.
channel_name | The CDR's channel |
option | Option to clear from the CDR |
0 | on success |
1 | on error |
Definition at line 3575 of file cdr.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_clear_flag, cdr_object_get_by_name(), cdr_object::flags, cdr_object::fn_table, and cdr_object::next.
Referenced by appcdr_callback(), AST_TEST_DEFINE(), and cdr_prop_write_callback().
const char* ast_cdr_disp2str | ( | int | disposition | ) |
Disposition to a string.
disposition | input binary form Converts the binary form of a disposition to string form. |
Definition at line 3430 of file cdr.c.
References AST_CDR_ANSWERED, AST_CDR_BUSY, AST_CDR_CONGESTION, AST_CDR_FAILED, AST_CDR_NOANSWER, and AST_CDR_NULL.
Referenced by ast_cdr_format_var(), beanstalk_put(), build_csv_record(), build_radius_record(), cdr_object_finalize(), cdr_read_callback(), execute_cb(), manager_log(), and tds_log().
Duplicate a public CDR.
cdr | the record to duplicate |
a | malloc'd ast_cdr structure, |
NULL | on error (malloc failure) |
Definition at line 2998 of file cdr.c.
References ast_cdr_alloc(), AST_LIST_HEAD_INIT_NOLOCK, copy_variables(), ast_cdr::next, NULL, and ast_cdr::varshead.
Referenced by custom_log(), load_values_config(), manager_log(), and syslog_log().
void ast_cdr_engine_term | ( | void | ) |
Submit any remaining CDRs and prepare for shutdown
Definition at line 4577 of file cdr.c.
References ao2_alloc, ao2_cleanup, ao2_global_obj_ref, ast_debug, ast_test_flag, BATCH_MODE_SAFE_SHUTDOWN, CDR_BATCHMODE, cdr_submit_batch(), NULL, RAII_VAR, stasis_message_create(), and stasis_message_router_publish_sync().
Referenced by can_safely_quit(), and finalize_batch_mode().
int ast_cdr_fork | ( | const char * | channel_name, |
struct ast_flags * | options | ||
) |
Fork a CDR.
channel_name | The name of the channel whose CDR should be forked |
options | Options to control how the fork occurs. |
0 | on success |
-1 | on failure |
Definition at line 3637 of file cdr.c.
References cdr_object::answer, ao2_cleanup, ao2_ref, cdr_object::appl, AST_CDR_FLAG_FINALIZE, AST_CDR_FLAG_KEEP_VARS, AST_CDR_FLAG_RESET, AST_CDR_FLAG_SET_ANSWER, AST_CDR_LOCK_APP, ast_clear_flag, ast_debug, AST_STATE_UP, ast_string_field_set, ast_test_flag, ast_tvnow(), ast_channel_snapshot::base, cdr_object::bridge, cdr_all_relink(), cdr_object_create_and_append(), cdr_object_finalize(), cdr_object_get_by_name(), cdr_object_transition_state(), context, cdr_object::context, copy_variables(), cdr_object::data, exten, cdr_object::exten, cdr_object_snapshot::flags, cdr_object::flags, cdr_object::fn_table, free_variables(), cdr_object::last, cdr_object::lastevent, lock, ast_channel_snapshot_base::name, cdr_object::next, cdr_object::party_a, cdr_object::party_b, RAII_VAR, SCOPED_AO2LOCK, cdr_object_snapshot::snapshot, cdr_object::start, ast_channel_snapshot::state, cdr_object_snapshot::userfield, and cdr_object_snapshot::variables.
Referenced by AST_TEST_DEFINE(), and forkcdr_callback().
void ast_cdr_format_var | ( | struct ast_cdr * | cdr, |
const char * | name, | ||
char ** | ret, | ||
char * | workspace, | ||
int | workspacelen, | ||
int | raw | ||
) |
Format a CDR variable from an already posted CDR.
cdr | The dispatched CDR to process |
name | The name of the variable |
ret | Pointer to the formatted buffer |
workspace | A pointer to the buffer to use to format the variable |
workspacelen | The size of workspace |
raw | If non-zero and a date/time is extraced, provide epoch seconds. Otherwise format as a date/time stamp |
Definition at line 3050 of file cdr.c.
References ast_cdr::accountcode, ast_cdr::amaflags, ast_cdr::answer, ast_cdr_disp2str(), ast_channel_amaflags2string(), ast_copy_string(), ast_strlen_zero, ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), ast_cdr::billsec, cdr_format_var_internal(), cdr_get_tv(), ast_cdr::channel, ast_cdr::clid, ast_cdr::dcontext, ast_cdr::disposition, ast_cdr::dst, ast_cdr::dstchannel, ast_cdr::duration, ast_cdr::end, ast_cdr::lastapp, ast_cdr::lastdata, ast_cdr::linkedid, NULL, ast_cdr::peeraccount, ast_cdr::sequence, ast_cdr::src, ast_cdr::start, ast_cdr::uniqueid, and ast_cdr::userfield.
Referenced by cdr_handler(), cdr_read_callback(), cdr_retrieve_time(), mysql_log(), odbc_log(), and pgsql_log().
void ast_cdr_free | ( | struct ast_cdr * | cdr | ) |
Free a CDR record.
cdr | ast_cdr structure to free Returns nothing |
Definition at line 3411 of file cdr.c.
References ast_free, free_variables(), ast_cdr::next, and ast_cdr::varshead.
Referenced by ast_channel_destructor(), ast_dummy_channel_destructor(), cdr_detach(), clear_mock_cdr_backend(), and do_batch_backend_process().
|
static |
Definition at line 2953 of file cdr.c.
References ao2_container_count(), ast_free, ast_log, AST_LOG_WARNING, AST_RWLIST_REMOVE, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, ast_verb, match(), cdr_beitem::name, and NULL.
Referenced by ast_cdr_modifier_unregister(), and ast_cdr_unregister().
struct ast_cdr_config* ast_cdr_get_config | ( | void | ) |
Obtain the current CDR configuration.
NULL | on error |
The | current CDR configuration |
Definition at line 2826 of file cdr.c.
References ao2_bump, ao2_cleanup, ao2_global_obj_ref, module_config::general, and NULL.
Referenced by test_cdr_init_cb().
int ast_cdr_getvar | ( | const char * | channel_name, |
const char * | name, | ||
char * | value, | ||
size_t | length | ||
) |
Retrieve a CDR variable from a channel's current CDR.
channel_name | The name of the party A channel that the CDR is associated with |
name | The name of the variable to retrieve |
value | Buffer to hold the value |
length | The size of the buffer |
0 | on success |
non-zero | on failure |
Definition at line 3324 of file cdr.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_log, AST_LOG_ERROR, ast_strlen_zero, cdr_object_format_property(), cdr_object_format_var_internal(), cdr_object_get_by_name(), and cdr_object::last.
Referenced by AST_TEST_DEFINE(), cdr_read_callback(), and cdr_retrieve_time().
int ast_cdr_is_enabled | ( | void | ) |
Return TRUE if CDR subsystem is enabled.
Definition at line 2861 of file cdr.c.
References CDR_ENABLED, and is_cdr_flag_set().
Referenced by action_coresettings(), and handle_show_settings().
struct stasis_message_router* ast_cdr_message_router | ( | void | ) |
Return the message router for the CDR engine.
This returns the stasis_message_router that the CDR engine uses for dispatching Stasis Message Bus API messages. The reference on the message router is bumped and must be released by the caller of this function.
NULL | if the CDR engine is disabled or unavailable |
the | stasis_message_router otherwise |
Definition at line 4291 of file cdr.c.
References ao2_bump, NULL, and stasis_router.
Referenced by cdr_prop_write(), cdr_read(), cdr_write(), forkcdr_exec(), load_module(), publish_app_cdr_message(), and unload_module().
int ast_cdr_modifier_register | ( | const char * | name, |
const char * | desc, | ||
ast_cdrbe | be | ||
) |
Register a CDR modifier.
name | name associated with the particular CDR modifier |
desc | description of the CDR modifier |
be | function pointer to a CDR modifier |
Used to register a Call Detail Record modifier.
This gives modules a chance to modify CDR fields before they are dispatched to registered backends (odbc, syslog, etc).
0 | on success. |
-1 | on error |
Definition at line 2948 of file cdr.c.
References cdr_generic_register().
int ast_cdr_modifier_unregister | ( | const char * | name | ) |
Unregister a CDR modifier.
name | name of CDR modifier to unregister Unregisters a CDR modifier by its name |
0 | The modifier unregistered successfully |
-1 | The modifier could not be unregistered at this time |
Definition at line 2993 of file cdr.c.
References ast_cdr_generic_unregister().
int ast_cdr_register | ( | const char * | name, |
const char * | desc, | ||
ast_cdrbe | be | ||
) |
Register a CDR handling engine.
name | name associated with the particular CDR handler |
desc | description of the CDR handler |
be | function pointer to a CDR handler Used to register a Call Detail Record handler. |
0 | on success. |
-1 | on error |
Definition at line 2943 of file cdr.c.
References cdr_generic_register().
Referenced by load_module(), load_values_config(), my_load_module(), odbc_load_module(), and unload_module().
int ast_cdr_reset | ( | const char * | channel_name, |
int | keep_variables | ||
) |
Reset the detail record.
channel_name | The channel that the CDR is associated with |
keep_variables | Keep the variables during the reset. If zero, variables are discarded during the reset. |
0 | on success |
-1 | on failure |
Definition at line 3598 of file cdr.c.
References cdr_object::answer, ao2_cleanup, ao2_lock, ao2_unlock, AST_LIST_REMOVE_HEAD, ast_tvnow(), ast_var_delete(), cdr_object_check_party_a_answer(), cdr_object_get_by_name(), cdr_object::end, cdr_object::lastevent, cdr_object::next, cdr_object::party_a, cdr_object::party_b, cdr_object_snapshot::snapshot, cdr_object::start, and cdr_object_snapshot::variables.
Referenced by appcdr_callback(), and dial_exec_full().
int ast_cdr_serialize_variables | ( | const char * | channel_name, |
struct ast_str ** | buf, | ||
char | delim, | ||
char | sep | ||
) |
Serializes all the data and variables for a current CDR record.
channel_name | The channel to get the CDR for |
buf | A buffer to use for formatting the data |
delim | A delimeter to use to separate variable keys/values |
sep | A separator to use between nestings |
the | total number of serialized variables |
Definition at line 3353 of file cdr.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_assert, AST_LIST_TRAVERSE, ast_log, AST_LOG_ERROR, ast_str_append(), ast_str_reset(), ast_strlen_zero, ast_var_name(), ast_var_value(), CDR_ENABLED, cdr_object_format_property(), cdr_object_get_by_name(), ast_var_t::entries, is_cdr_flag_set(), LOG_ERROR, cdr_object::next, cdr_object::party_a, S_OR, total, var, and cdr_object_snapshot::variables.
Referenced by handle_showchan().
void ast_cdr_set_config | ( | struct ast_cdr_config * | config | ) |
Set the current CDR configuration.
config | The new CDR configuration |
Definition at line 2840 of file cdr.c.
References ao2_cleanup, ao2_global_obj_ref, ao2_replace, cdr_set_debug_mode, cdr_toggle_runtime_options(), and module_config::general.
Referenced by test_cdr_cleanup_cb().
int ast_cdr_set_property | ( | const char * | channel_name, |
enum ast_cdr_options | option | ||
) |
Set a property on a CDR for a channel.
channel_name | The CDR's channel |
option | Option to apply to the CDR |
0 | on success |
1 | on error |
Definition at line 3548 of file cdr.c.
References ao2_cleanup, ao2_lock, ao2_unlock, ast_set_flag, cdr_object_get_by_name(), cdr_object::flags, cdr_object::fn_table, cdr_object::next, and cdr_object::party_a.
Referenced by appcdr_callback(), AST_TEST_DEFINE(), and cdr_prop_write_callback().
void ast_cdr_setuserfield | ( | const char * | channel_name, |
const char * | userfield | ||
) |
Set CDR user field for channel (stored in CDR)
channel_name | The name of the channel that owns the CDR |
userfield | The user field to set |
Definition at line 3477 of file cdr.c.
References ao2_callback_data, ao2_cleanup, ao2_lock, ao2_unlock, ast_copy_string(), cdr_object_get_by_name(), cdr_object_update_party_b_userfield_cb(), party_b_userfield_update::channel_name, cdr_object::fn_table, cdr_object::next, NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_SEARCH_KEY, cdr_object::party_a, cdr_object_snapshot::userfield, and party_b_userfield_update::userfield.
Referenced by AST_TEST_DEFINE(), cdr_write_callback(), handle_request_info(), and start_monitor_exec().
int ast_cdr_setvar | ( | const char * | channel_name, |
const char * | name, | ||
const char * | value | ||
) |
Set a variable on a CDR.
channel_name | The channel to set the variable on |
name | The name of the variable to set |
value | The value of the variable to set |
0 | on success |
non-zero | on failure |
Definition at line 3178 of file cdr.c.
References ao2_callback, ao2_cleanup, ao2_iterator_destroy(), ao2_iterator_next, ao2_lock, ao2_unlock, ast_log, AST_LOG_ERROR, ast_strdupa, ast_channel_snapshot::base, cdr_object_select_all_by_name_cb(), cdr_object::fn_table, LOG_ERROR, ast_channel_snapshot_base::name, cdr_object::next, NULL, OBJ_MULTIPLE, cdr_object::party_a, cdr_object::party_b, set_variable(), cdr_object_snapshot::snapshot, and cdr_object_snapshot::variables.
Referenced by AST_TEST_DEFINE(), and cdr_write_callback().
int ast_cdr_unregister | ( | const char * | name | ) |
Unregister a CDR handling engine.
name | name of CDR handler to unregister Unregisters a CDR by it's name |
0 | The backend unregistered successfully |
-1 | The backend could not be unregistered at this time |
Definition at line 2988 of file cdr.c.
References ast_cdr_generic_unregister().
Referenced by load_module(), load_values_config(), my_unload_module(), reload(), tds_unload_module(), and unload_module().
struct ast_module* AST_MODULE_SELF_SYM | ( | void | ) |
|
static |
|
static |
|
static |
|
static |
Definition at line 1617 of file cdr.c.
References ast_assert, AST_CDR_LOCK_APP, ast_set_flag, ast_string_field_set, ast_channel_snapshot::base, cdr_object::flags, cdr_object::fn_table, ast_channel_snapshot_base::name, ast_parked_call_payload::parkee, ast_parked_call_payload::parkinglot, ast_parked_call_payload::parkingspace, cdr_object::party_a, cdr_object_fn_table::process_party_a, and cdr_object_snapshot::snapshot.
|
static |
Definition at line 1540 of file cdr.c.
References ast_channel_snapshot_dialplan::appl, cdr_object::appl, ast_assert, AST_CDR_LOCK_APP, AST_FLAG_SUBROUTINE_EXEC, ast_set_flag, AST_SOFTHANGUP_HANGUP_EXEC, ast_string_field_set, ast_strlen_zero, ast_test_flag, ast_channel_snapshot::base, CDR_END_BEFORE_H_EXTEN, cdr_object_check_party_a_answer(), cdr_object_check_party_a_hangup(), cdr_object_finalize(), cdr_object_swap_snapshot(), ast_channel_snapshot_dialplan::context, context, cdr_object::context, ast_channel_snapshot_dialplan::data, cdr_object::data, ast_channel_snapshot::dialplan, ast_channel_snapshot_dialplan::exten, exten, cdr_object::exten, ast_channel_snapshot::flags, cdr_object::flags, is_cdr_flag_set(), ast_channel_snapshot_peer::linkedid, ast_cdr::linkedid, cdr_object::linkedid, ast_channel_snapshot_base::name, cdr_object::party_a, ast_channel_snapshot::peer, cdr_object_snapshot::snapshot, and ast_channel_snapshot::softhangup_flags.
Referenced by dialed_pending_state_process_party_a(), and single_state_process_dial_begin().
|
static |
Definition at line 2472 of file cdr.c.
References ast_string_field_set, ast_channel_snapshot::base, cdr_object::bridge, cdr_all_relink(), CDR_DEBUG, cdr_object_check_party_a_answer(), cdr_object_create_and_append(), cdr_object_snapshot_copy(), cdr_object_transition_state(), cdr_object::lastevent, ast_channel_snapshot_base::name, cdr_object::party_a, cdr_object::party_b, and cdr_object_snapshot::snapshot.
Referenced by bridge_candidate_process().
|
static |
Process a single bridge_candidate.
When a CDR enters a bridge, it needs to make pairings with everyone else that it is not currently paired with. This function determines, for the CDR for the channel that entered the bridge and the CDR for every other channel currently in the bridge, who is Party A and makes new CDRs.
cdr | The cdr_obj being processed |
cand_cdr | The cdr_object that is a candidate |
Definition at line 2503 of file cdr.c.
References ao2_lock, ao2_unlock, ast_channel_snapshot::base, cdr_object::bridge, bridge_candidate_add_to_cdr(), cdr_all_relink(), CDR_DEBUG, cdr_object_pick_party_a(), cdr_object_snapshot_copy(), cdr_object::end, ast_channel_snapshot_base::name, cdr_object::next, cdr_object::party_a, cdr_object::party_b, and cdr_object_snapshot::snapshot.
Referenced by handle_bridge_pairings().
|
static |
Definition at line 2015 of file cdr.c.
References ast_channel_snapshot::base, cdr_object::bridge, cdr_object_transition_state(), ast_channel_snapshot_base::name, cdr_object::party_a, cdr_object::party_b, cdr_object_snapshot::snapshot, and ast_bridge_snapshot::uniqueid.
|
static |
Definition at line 2002 of file cdr.c.
References ast_assert, AST_FLAG_DEAD, ast_test_flag, ast_channel_snapshot::base, cdr_object_swap_snapshot(), cdr_object_transition_state(), ast_channel_snapshot::flags, ast_channel_snapshot_base::name, cdr_object::party_b, and cdr_object_snapshot::snapshot.
|
static |
Definition at line 912 of file cdr.c.
References ast_assert, CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and cdr_object::party_b_name.
Referenced by load_module().
|
static |
Definition at line 888 of file cdr.c.
References ast_assert, ast_str_case_hash(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and cdr_object::party_b_name.
Referenced by load_module().
|
static |
Definition at line 4472 of file cdr.c.
References ast_channel_snapshot::base, cdr_object::bridge, ast_channel_snapshot_base::name, cdr_object::party_a, cdr_object::party_b, and cdr_object_snapshot::snapshot.
Referenced by load_module().
|
static |
Definition at line 949 of file cdr.c.
References ao2_link_flags, ao2_lock, ao2_unlink_flags, ao2_unlock, ast_string_field_set, ast_channel_snapshot::base, ast_channel_snapshot_base::name, OBJ_NOLOCK, cdr_object::party_b, cdr_object::party_b_name, and cdr_object_snapshot::snapshot.
Referenced by ast_cdr_fork(), bridge_candidate_add_to_cdr(), bridge_candidate_process(), single_state_bridge_enter_comparison(), and single_state_process_dial_begin().
|
static |
Definition at line 972 of file cdr.c.
References ao2_lock, ao2_ref, ao2_unlink_flags, ao2_unlock, ast_assert, ast_string_field_set, cdr_object::is_root, cdr_object::next, OBJ_NOLOCK, and cdr_object::party_b_name.
Referenced by cdr_object_dispatch_all_cb(), and handle_channel_snapshot_update_message().
|
static |
Definition at line 3841 of file cdr.c.
References ao2_cleanup, ao2_global_obj_ref, ast_calloc, ast_cdr_free(), ast_debug, ast_mutex_lock, ast_mutex_unlock, ast_test_flag, batch, cdr_batch_item::cdr, cdr_batch_lock, CDR_BATCHMODE, CDR_ENABLED, cdr_batch::head, init_batch(), cdr_batch_item::next, post_cdr(), RAII_VAR, cdr_batch::size, start_batch_mode(), and cdr_batch::tail.
Referenced by cdr_object_dispatch().
|
static |
Definition at line 4416 of file cdr.c.
References ast_cond_init, ast_log, ast_pthread_create_background, AST_PTHREADT_NULL, ast_cdr_config::batch_settings, cdr_pending_cond, cdr_thread, do_cdr(), LOG_ERROR, LOG_NOTICE, NULL, ast_cdr_config::batch_settings::size, start_batch_mode(), and ast_cdr_config::batch_settings::time.
Referenced by cdr_toggle_runtime_options().
|
static |
Definition at line 4385 of file cdr.c.
References aco_info_destroy(), ao2_callback, ao2_cleanup, ao2_container_unregister(), ao2_global_obj_release, ARRAY_LEN, ast_cli_unregister_multiple(), ast_free, ast_sched_context_destroy(), batch, cdr_object_dispatch_all_cb(), finalize_batch_mode(), NULL, OBJ_MULTIPLE, OBJ_NODATA, OBJ_UNLINK, stasis_message_router_unsubscribe_and_join(), and STASIS_MESSAGE_TYPE_CLEANUP.
Referenced by load_module().
|
static |
Definition at line 3018 of file cdr.c.
References AST_LIST_TRAVERSE, ast_strlen_zero, ast_var_name(), ast_var_value(), ast_var_t::entries, NULL, and ast_cdr::varshead.
Referenced by ast_cdr_format_var().
|
static |
Definition at line 2902 of file cdr.c.
References ast_calloc, ast_copy_string(), ast_free, ast_log, AST_RWLIST_INSERT_HEAD, AST_RWLIST_TRAVERSE, AST_RWLIST_UNLOCK, AST_RWLIST_WRLOCK, be, cdr_beitem::be, cdr_beitem::desc, LOG_WARNING, and cdr_beitem::name.
Referenced by ast_cdr_modifier_register(), and ast_cdr_register().
|
static |
Definition at line 3035 of file cdr.c.
References ast_localtime(), ast_strftime(), and NULL.
Referenced by ast_cdr_format_var(), cdr_object_format_property(), cli_show_channel(), and cli_show_channels().
|
static |
Definition at line 854 of file cdr.c.
References ast_assert, CMP_MATCH, OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, OBJ_SEARCH_PARTIAL_KEY, and cdr_object::uniqueid.
Referenced by load_module().
|
static |
Definition at line 830 of file cdr.c.
References ast_assert, ast_str_case_hash(), OBJ_SEARCH_KEY, OBJ_SEARCH_MASK, OBJ_SEARCH_OBJECT, and cdr_object::uniqueid.
Referenced by load_module().
|
static |
Definition at line 4445 of file cdr.c.
References ast_channel_snapshot::base, cdr_object::bridge, ast_channel_snapshot_base::name, cdr_object::next, cdr_object::party_a, cdr_object::party_b, and cdr_object_snapshot::snapshot.
Referenced by load_module().
|
static |
cdr_object constructor
chan | The ast_channel_snapshot that is the CDR's Party A |
This implicitly sets the state of the newly created CDR to the Single state (single_state_fn_table)
Definition at line 1039 of file cdr.c.
References ao2_alloc, ao2_cleanup, ao2_t_ref, ast_assert, ast_atomic_fetchadd_int(), AST_CDR_NULL, ast_string_field_init, ast_string_field_set, ast_channel_snapshot::base, CDR_DEBUG, cdr_object_dtor(), cdr_object_transition_state(), cdr_object::disposition, global_cdr_sequence, cdr_object::last, cdr_object::lastevent, ast_channel_snapshot_peer::linkedid, cdr_object::linkedid, name, ast_channel_snapshot_base::name, NULL, cdr_object::party_a, ast_channel_snapshot::peer, cdr_object::sequence, cdr_object_snapshot::snapshot, ast_channel_snapshot_base::uniqueid, and cdr_object::uniqueid.
Referenced by cdr_object_create_and_append(), and handle_channel_snapshot_update_message().
|
static |
Check to see if a CDR needs to be answered based on its Party A. Note that this is safe to call as much as you want - we won't answer twice.
Definition at line 1494 of file cdr.c.
References cdr_object::answer, AST_STATE_UP, ast_tvzero(), CDR_DEBUG, cdr_object::lastevent, cdr_object::party_a, cdr_object_snapshot::snapshot, and ast_channel_snapshot::state.
Referenced by ast_cdr_reset(), base_process_party_a(), bridge_candidate_add_to_cdr(), and single_state_init_function().
|
static |
Check to see if a CDR needs to move to the finalized state because its Party A hungup.
Definition at line 1477 of file cdr.c.
References AST_FLAG_DEAD, AST_SOFTHANGUP_HANGUP_EXEC, ast_test_flag, CDR_END_BEFORE_H_EXTEN, cdr_object_finalize(), cdr_object_transition_state(), ast_channel_snapshot::flags, cdr_object::fn_table, is_cdr_flag_set(), cdr_object::party_a, cdr_object_snapshot::snapshot, and ast_channel_snapshot::softhangup_flags.
Referenced by base_process_party_a().
|
static |
Create a new cdr_object and append it to an existing chain.
cdr | The cdr_object to append to |
Definition at line 1075 of file cdr.c.
References cdr_object::appl, AST_CDR_FLAG_DISABLE_ALL, AST_CDR_NULL, ast_set_flag, ast_string_field_set, ast_test_flag, cdr_object_alloc(), cdr_object_snapshot_copy(), context, cdr_object::context, cdr_object::data, cdr_object::disposition, exten, cdr_object::exten, cdr_object::flags, cdr_object::last, cdr_object::linkedid, cdr_object::next, NULL, cdr_object::party_a, and cdr_object_snapshot::snapshot.
Referenced by ast_cdr_fork(), bridge_candidate_add_to_cdr(), handle_channel_snapshot_update_message(), handle_dial_message(), handle_parked_call_message(), handle_parking_bridge_enter_message(), and handle_standard_bridge_enter_message().
|
static |
Create a chain of ast_cdr objects from a chain of cdr_object suitable for consumption by the registered CDR backends.
cdr | The cdr_object to convert to a public record |
A | chain of ast_cdr objects on success |
NULL | on failure |
Definition at line 1287 of file cdr.c.
References ast_channel_snapshot_base::accountcode, ast_cdr::accountcode, ast_channel_snapshot::amaflags, ast_cdr::amaflags, ast_cdr::answer, cdr_object::answer, cdr_object::appl, ast_assert, ast_callerid_merge(), ast_calloc, ast_copy_flags, ast_copy_string(), ast_debug, AST_FLAGS_ALL, ast_free, AST_LIST_INSERT_TAIL, AST_LIST_TRAVERSE, ast_strlen_zero, ast_var_assign, ast_var_name(), ast_var_value(), ast_channel_snapshot::base, ast_cdr::billsec, ast_channel_snapshot::caller, cdr_object_get_billsec(), cdr_object_get_duration(), ast_cdr::channel, ast_cdr::clid, cdr_object::context, copy_variables(), cdr_object::data, ast_cdr::dcontext, ast_cdr::disposition, cdr_object::disposition, ast_cdr::dst, ast_cdr::dstchannel, ast_cdr::duration, ast_cdr::end, cdr_object::end, ast_var_t::entries, cdr_object::exten, cdr_object::flags, ast_cdr::lastapp, ast_cdr::lastdata, ast_cdr::linkedid, cdr_object::linkedid, ast_channel_snapshot_caller::name, ast_channel_snapshot_base::name, ast_cdr::next, cdr_object::next, NULL, ast_channel_snapshot_caller::number, cdr_object::party_a, cdr_object::party_b, ast_cdr::peeraccount, ast_cdr::sequence, cdr_object::sequence, cdr_object_snapshot::snapshot, snapshot_is_dialed(), ast_cdr::src, ast_cdr::start, cdr_object::start, ast_channel_snapshot_base::uniqueid, ast_cdr::uniqueid, ast_cdr::userfield, cdr_object_snapshot::userfield, cdr_object_snapshot::variables, and ast_cdr::varshead.
Referenced by cdr_object_dispatch().
|
static |
Dispatch a CDR.
cdr | The cdr_object to dispatch |
This will create a ast_cdr object and publish it to the various backends
Definition at line 1386 of file cdr.c.
References ast_channel_snapshot::base, CDR_DEBUG, cdr_detach(), cdr_object_create_public_records(), ast_channel_snapshot_base::name, cdr_object::party_a, cdr_object::party_b, and cdr_object_snapshot::snapshot.
Referenced by cdr_object_dispatch_all_cb(), and handle_channel_snapshot_update_message().
|
static |
This dispatches all cdr_objects. It should only be used during shutdown, so that we get billing records for everything that we can.
Definition at line 4260 of file cdr.c.
References ao2_lock, ao2_unlock, cdr_all_unlink(), cdr_object_dispatch(), cdr_object_transition_state(), CMP_MATCH, and cdr_object::next.
Referenced by cdr_engine_shutdown().
|
static |
cdr_object Destructor
Definition at line 999 of file cdr.c.
References ao2_cleanup, AST_LIST_REMOVE_HEAD, ast_string_field_free_memory, ast_var_delete(), ast_var_t::entries, cdr_object::is_root, cdr_object::next, cdr_object::party_a, cdr_object::party_b, cdr_object_snapshot::snapshot, and cdr_object_snapshot::variables.
Referenced by cdr_object_alloc().
|
static |
Finalize a CDR.
This function is safe to call multiple times. Note that you can call this explicitly before going to the finalized state if there's a chance the CDR will be re-activated, in which case the cdr_object's end time should be cleared. This function is implicitly called when a CDR transitions to the finalized state and right before it is dispatched
cdr_object | The CDR to finalize |
Definition at line 1440 of file cdr.c.
References cdr_object::answer, AST_CDR_ANSWERED, ast_cdr_disp2str(), AST_CDR_FAILED, AST_CDR_NULL, ast_debug, ast_tvdiff_ms(), ast_tvzero(), ast_channel_snapshot::base, ast_channel_snapshot_hangup::cause, cdr_object_set_disposition(), cdr_object::disposition, cdr_object::end, ast_channel_snapshot::hangup, cdr_object::lastevent, ast_channel_snapshot_base::name, cdr_object::party_a, cdr_object::party_b, cdr_object_snapshot::snapshot, and cdr_object::start.
Referenced by ast_cdr_fork(), base_process_party_a(), cdr_object_check_party_a_hangup(), cdr_object_finalize_party_b(), cdr_object_party_b_left_bridge_cb(), dial_state_process_bridge_enter(), finalized_state_init_function(), handle_channel_snapshot_update_message(), handle_standard_bridge_enter_message(), and single_state_bridge_enter_comparison().
|
static |
Definition at line 2196 of file cdr.c.
References ast_assert, ast_channel_snapshot::base, cdr_object_finalize(), ast_channel_snapshot_base::name, cdr_object::party_b, cdr_object::party_b_name, and cdr_object_snapshot::snapshot.
Referenced by handle_channel_snapshot_update_message().
|
static |
Format one of the standard properties on a cdr_object.
Definition at line 3243 of file cdr.c.
References ast_channel_snapshot_base::accountcode, ast_channel_snapshot::amaflags, cdr_object::answer, ast_channel_snapshot_dialplan::appl, ast_callerid_merge(), ast_copy_string(), ast_channel_snapshot::base, ast_channel_snapshot::caller, cdr_get_tv(), cdr_object_get_billsec(), cdr_object_get_duration(), ast_channel_snapshot_dialplan::context, ast_channel_snapshot_dialplan::data, ast_channel_snapshot::dialplan, cdr_object::disposition, cdr_object::end, ast_channel_snapshot_dialplan::exten, cdr_object::linkedid, ast_channel_snapshot_caller::name, ast_channel_snapshot_base::name, NULL, ast_channel_snapshot_caller::number, cdr_object::party_a, cdr_object::party_b, cdr_object::sequence, cdr_object_snapshot::snapshot, cdr_object::start, ast_channel_snapshot_base::uniqueid, and cdr_object_snapshot::userfield.
Referenced by ast_cdr_getvar(), and ast_cdr_serialize_variables().
|
static |
Format a variable on a cdr_object.
Definition at line 3226 of file cdr.c.
References ast_copy_string(), AST_LIST_TRAVERSE, ast_var_name(), ast_var_value(), ast_var_t::entries, cdr_object::party_a, and cdr_object_snapshot::variables.
Referenced by ast_cdr_getvar().
|
static |
Compute the billsec for a cdr_object.
Definition at line 1235 of file cdr.c.
References cdr_object::answer, ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), CDR_INITIATED_SECONDS, cdr_object::end, and is_cdr_flag_set().
Referenced by cdr_object_create_public_records(), and cdr_object_format_property().
|
static |
Definition at line 3312 of file cdr.c.
References ao2_callback, ast_strdupa, ast_strlen_zero, cdr_object_get_by_name_cb(), and NULL.
Referenced by ast_cdr_clear_property(), ast_cdr_fork(), ast_cdr_getvar(), ast_cdr_reset(), ast_cdr_serialize_variables(), ast_cdr_set_property(), ast_cdr_setuserfield(), and cli_show_channel().
|
static |
Definition at line 3142 of file cdr.c.
References ast_channel_snapshot::base, CMP_MATCH, name, ast_channel_snapshot_base::name, cdr_object::party_a, and cdr_object_snapshot::snapshot.
Referenced by cdr_object_get_by_name().
|
static |
Compute the duration for a cdr_object
Definition at line 1227 of file cdr.c.
References ast_tvdiff_ms(), ast_tvnow(), ast_tvzero(), cdr_object::end, and cdr_object::start.
Referenced by cdr_object_create_public_records(), and cdr_object_format_property().
|
static |
Callback used to notify CDRs of a Party B leaving the bridge.
Definition at line 2361 of file cdr.c.
References ast_assert, ast_channel_snapshot::base, cdr_object::bridge, bridge_leave_data::bridge, cdr_object_finalize(), bridge_leave_data::channel, cdr_object::fn_table, cdr_object::lastevent, bridge_leave_data::lastevent, ast_channel_snapshot_base::name, cdr_object::party_b, cdr_object::party_b_name, cdr_object_snapshot::snapshot, and ast_bridge_snapshot::uniqueid.
Referenced by handle_bridge_leave_message().
|
static |
Given two CDR snapshots, figure out who should be Party A for the resulting CDR.
left | One of the snapshots |
right | The other snapshot |
The | snapshot that won |
Definition at line 1192 of file cdr.c.
References AST_CDR_FLAG_PARTY_A, ast_test_flag, ast_channel_snapshot::base, ast_channel_snapshot_base::creationtime, cdr_object_snapshot::snapshot, and snapshot_is_dialed().
Referenced by bridge_candidate_process(), and single_state_bridge_enter_comparison().
|
static |
Definition at line 3126 of file cdr.c.
References ast_channel_snapshot::base, CMP_MATCH, name, ast_channel_snapshot_base::name, cdr_object::party_a, cdr_object::party_b, and cdr_object_snapshot::snapshot.
Referenced by ast_cdr_setvar().
|
static |
Set the disposition on a cdr_object based on a hangupcause code.
cdr | The cdr_object |
hangupcause | The Asterisk hangup cause code |
Definition at line 1402 of file cdr.c.
References AST_CAUSE_BUSY, AST_CAUSE_CONGESTION, AST_CAUSE_NO_ANSWER, AST_CAUSE_NO_ROUTE_DESTINATION, AST_CAUSE_NORMAL_CLEARING, AST_CAUSE_UNREGISTERED, AST_CDR_BUSY, AST_CDR_CONGESTION, AST_CDR_FAILED, AST_CDR_NOANSWER, CDR_CONGESTION, cdr_object::disposition, and is_cdr_flag_set().
Referenced by cdr_object_finalize().