227#define DEFAULT_ENABLED "1"
228#define DEFAULT_BATCHMODE "0"
229#define DEFAULT_UNANSWERED "0"
230#define DEFAULT_CONGESTION "0"
231#define DEFAULT_END_BEFORE_H_EXTEN "1"
232#define DEFAULT_INITIATED_SECONDS "0"
233#define DEFAULT_CHANNEL_ENABLED "1"
234#define DEFAULT_IGNORE_STATE_CHANGES "0"
235#define DEFAULT_IGNORE_DIAL_CHANGES "0"
237#define DEFAULT_BATCH_SIZE "100"
238#define MAX_BATCH_SIZE 1000
239#define DEFAULT_BATCH_TIME "300"
240#define MAX_BATCH_TIME 86400
241#define DEFAULT_BATCH_SCHEDULER_ONLY "0"
242#define DEFAULT_BATCH_SAFE_SHUTDOWN "1"
244#define cdr_set_debug_mode(mod_cfg) \
246 cdr_debug_enabled = ast_test_flag(&(mod_cfg)->general->settings, CDR_DEBUG); \
252#define CDR_DEBUG(fmt, ...) \
254 if (cdr_debug_enabled) { \
255 ast_verbose((fmt), ##__VA_ARGS__); \
276 .category =
"general",
525 const char *dial_status);
680 .
name =
"DialedPending",
850 CDR_DEBUG(
"%p - Transitioning CDR for %s from state %s to %s\n",
902 const char *right_key = arg;
910 cmp = strcmp(left->
uniqueid, right_key);
917 cmp = strncmp(left->
uniqueid, right_key, strlen(right_key));
960 const char *right_key = arg;
975 cmp = strncasecmp(left->
party_b_name, right_key, strlen(right_key));
1022 for (cur = cdr; cur; cur =
next) {
1124 cdr_last = cdr->
last;
1150 for (it_cdr = cdr; it_cdr->
next; it_cdr = it_cdr->
next) {
1151 it_cdr->
last = new_cdr;
1153 it_cdr->
last = new_cdr;
1154 it_cdr->
next = new_cdr;
1203 && strncasecmp(new_snapshot->
dialplan->
appl,
"appdial", 7)
1285 if (ms % 1000 >= 500
1287 ms = (ms / 1000) + 1;
1336 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
1341 ast_debug(1,
"CDR for %s is dialed and has no Party B; discarding\n",
1385 cdr_copy->
end = it_cdr->
end;
1415 cdr_prev->
next = cdr_copy;
1416 cdr_prev = cdr_copy;
1433 CDR_DEBUG(
"%p - Dispatching CDR for Party A %s, Party B %s\n", cdr,
1448 switch (hangupcause) {
1503 ast_debug(1,
"Finalized CDR for %s - start %ld.%06ld answer %ld.%06ld end %ld.%06ld dur %.3f bill %.3f dispo %s\n",
1505 (
long)cdr->
start.tv_sec,
1506 (
long)cdr->
start.tv_usec,
1507 (
long)cdr->
answer.tv_sec,
1508 (
long)cdr->
answer.tv_usec,
1509 (
long)cdr->
end.tv_sec,
1510 (
long)cdr->
end.tv_usec,
1542 CDR_DEBUG(
"%p - Set answered time to %ld.%06ld\n", cdr,
1543 (
long)cdr->
answer.tv_sec,
1544 (
long)cdr->
answer.tv_usec);
1662 char park_info[128];
1700 CDR_DEBUG(
"%p - Updated Party A %s snapshot\n", cdr,
1704 CDR_DEBUG(
"%p - Updated Party B %s snapshot\n", cdr,
1715 CDR_DEBUG(
"%p - Updated Party A %s snapshot\n", cdr,
1748 CDR_DEBUG(
"%p - Party A %s has new Party B %s\n",
1769 CDR_DEBUG(
"%p - Party A %s has new Party B %s\n",
1800 if (!cand_cdr_master) {
1805 for (cand_cdr = cand_cdr_master; cand_cdr; cand_cdr = cand_cdr->
next) {
1873 if (!strcmp(dial_status,
"ANSWER")) {
1875 }
else if (!strcmp(dial_status,
"BUSY")) {
1877 }
else if (!strcmp(dial_status,
"CANCEL") || !strcmp(dial_status,
"NOANSWER")) {
1879 }
else if (!strcmp(dial_status,
"CONGESTION")) {
1885 }
else if (!strcmp(dial_status,
"FAILED")) {
1948 if (!cand_cdr_master) {
1953 for (cand_cdr = cand_cdr_master; cand_cdr; cand_cdr = cand_cdr->
next) {
2134 return (strcmp(dialstatus,
"RINGING") &&
2135 strcmp(dialstatus,
"PROCEEDING") &&
2136 strcmp(dialstatus,
"PROGRESS"));
2155 const char *dial_status =
NULL;
2160 if (!peer && !caller) {
2173 if (dial_status_blob) {
2177 CDR_DEBUG(
"Dial %s message for %s, %s: %u.%08u\n",
2179 caller ? caller->
base->
name :
"(none)",
2180 peer ? peer->
base->
name :
"(none)",
2197 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
2204 CDR_DEBUG(
"%p - Ignoring Dial Begin message\n", it_cdr);
2207 CDR_DEBUG(
"%p - Processing Dial Begin message for channel %s, peer %s\n",
2209 caller ? caller->
base->
name :
"(none)",
2210 peer ? peer->
base->
name :
"(none)");
2221 CDR_DEBUG(
"%p - Setting disposition and that's it (%s)\n", it_cdr, dial_status);
2224 CDR_DEBUG(
"%p - Processing Dial End message for channel %s, peer %s\n",
2226 caller ? caller->
base->
name :
"(none)",
2227 peer ? peer->
base->
name :
"(none)");
2292 "CDR for Party A %s(%s) has inconsistent Party B %s name. Message can be ignored but this shouldn't happen.\n",
2358 ast_debug(3,
"Disable CDR by default\n");
2375 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
2396 CDR_DEBUG(
"%p - Beginning finalize/dispatch for %s\n", cdr,
update->old_snapshot->base->name);
2397 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
2409 if (
update->new_snapshot) {
2484 int left_bridge = 0;
2494 CDR_DEBUG(
"Bridge Leave message for %s: %u.%08u\n",
2496 (
unsigned int)leave_data.
lastevent->tv_sec,
2497 (
unsigned int)leave_data.
lastevent->tv_usec);
2508 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
2513 CDR_DEBUG(
"%p - Processing Bridge Leave for %s\n",
2553 CDR_DEBUG(
"%p - Party A %s has new Party B %s\n",
2577 for (cand_cdr = base_cand_cdr; cand_cdr; cand_cdr = cand_cdr->
next) {
2604 CDR_DEBUG(
"%p - Party A %s has new Party B %s\n",
2613 memset(&cand_cdr->
end, 0,
sizeof(cand_cdr->
end));
2657 const struct timeval *event_time)
2665 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
2672 CDR_DEBUG(
"%p - Updating Party A %s snapshot\n", it_cdr,
2699 const struct timeval *event_time)
2709 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
2713 CDR_DEBUG(
"%p - Updating Party A %s snapshot\n", it_cdr,
2720 CDR_DEBUG(
"%p - Processing bridge enter for %s\n", it_cdr,
2728 handled_cdr = it_cdr;
2739 handled_cdr = it_cdr;
2792 CDR_DEBUG(
"Bridge Enter message for channel %s: %u.%08u\n",
2804 if (!strcmp(
bridge->subclass,
"parking")) {
2841 CDR_DEBUG(
"Parked Call message for channel %s: %u.%08u\n",
2855 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
2994 if (!strcasecmp(
name, cur->
name)) {
3038 if (!
match->suspended && active_count != 0) {
3041 name, active_count);
3101static void cdr_get_tv(
struct timeval when,
const char *fmt,
char *
buf,
int bufsize)
3104 snprintf(
buf, bufsize,
"%ld.%06ld", (
long)when.tv_sec, (
long)when.tv_usec);
3118 const char *fmt =
"%Y-%m-%d %T";
3127 if (!strcasecmp(
name,
"clid")) {
3129 }
else if (!strcasecmp(
name,
"src")) {
3131 }
else if (!strcasecmp(
name,
"dst")) {
3133 }
else if (!strcasecmp(
name,
"dcontext")) {
3135 }
else if (!strcasecmp(
name,
"channel")) {
3137 }
else if (!strcasecmp(
name,
"dstchannel")) {
3139 }
else if (!strcasecmp(
name,
"lastapp")) {
3141 }
else if (!strcasecmp(
name,
"lastdata")) {
3143 }
else if (!strcasecmp(
name,
"start")) {
3145 }
else if (!strcasecmp(
name,
"answer")) {
3147 }
else if (!strcasecmp(
name,
"end")) {
3149 }
else if (!strcasecmp(
name,
"duration")) {
3151 }
else if (!strcasecmp(
name,
"billsec")) {
3153 }
else if (!strcasecmp(
name,
"disposition")) {
3155 snprintf(workspace, workspacelen,
"%ld", cdr->
disposition);
3159 }
else if (!strcasecmp(
name,
"amaflags")) {
3161 snprintf(workspace, workspacelen,
"%ld", cdr->
amaflags);
3165 }
else if (!strcasecmp(
name,
"accountcode")) {
3167 }
else if (!strcasecmp(
name,
"peeraccount")) {
3169 }
else if (!strcasecmp(
name,
"uniqueid")) {
3171 }
else if (!strcasecmp(
name,
"linkedid")) {
3173 }
else if (!strcasecmp(
name,
"tenantid")) {
3175 }
else if (!strcasecmp(
name,
"peertenantid")) {
3177 }
else if (!strcasecmp(
name,
"userfield")) {
3179 }
else if (!strcasecmp(
name,
"sequence")) {
3180 snprintf(workspace, workspacelen,
"%d", cdr->
sequence);
3184 workspace[0] =
'\0';
3199 const char *
name = arg;
3215 const char *
name = arg;
3272 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
3319 if (!strcasecmp(
name,
"clid")) {
3321 }
else if (!strcasecmp(
name,
"src")) {
3323 }
else if (!strcasecmp(
name,
"dst")) {
3325 }
else if (!strcasecmp(
name,
"dcontext")) {
3327 }
else if (!strcasecmp(
name,
"channel")) {
3329 }
else if (!strcasecmp(
name,
"dstchannel")) {
3335 }
else if (!strcasecmp(
name,
"lastapp")) {
3337 }
else if (!strcasecmp(
name,
"lastdata")) {
3339 }
else if (!strcasecmp(
name,
"start")) {
3341 }
else if (!strcasecmp(
name,
"answer")) {
3343 }
else if (!strcasecmp(
name,
"end")) {
3345 }
else if (!strcasecmp(
name,
"duration")) {
3347 }
else if (!strcasecmp(
name,
"billsec")) {
3349 }
else if (!strcasecmp(
name,
"disposition")) {
3351 }
else if (!strcasecmp(
name,
"amaflags")) {
3353 }
else if (!strcasecmp(
name,
"accountcode")) {
3355 }
else if (!strcasecmp(
name,
"peeraccount")) {
3361 }
else if (!strcasecmp(
name,
"uniqueid")) {
3363 }
else if (!strcasecmp(
name,
"linkedid")) {
3365 }
else if (!strcasecmp(
name,
"tenantid")) {
3367 }
else if (!strcasecmp(
name,
"peertenantid")) {
3373 }
else if (!strcasecmp(
name,
"userfield")) {
3375 }
else if (!strcasecmp(
name,
"sequence")) {
3420 cdr_obj = cdr->
last;
3438 char workspace[256];
3439 int total = 0, x = 0, i;
3452 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
3523 return "CONGESTION";
3569 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
3597 for (; cdr ; cdr = cdr->
next) {
3602 ast_debug(1,
"Skipping CDR for %s since we weren't answered\n", cdr->
channel);
3618 if (!i->suspended) {
3638 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
3665 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
3689 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
3691 if (!keep_variables) {
3703 memset(&it_cdr->
start, 0,
sizeof(it_cdr->
start));
3704 memset(&it_cdr->
end, 0,
sizeof(it_cdr->
end));
3731 cdr_obj = cdr->
last;
3742 ast_debug(1,
"Forking CDR for channel %s\n", cdr->party_a.snapshot->base->name);
3792 for (it_cdr = cdr; it_cdr != new_cdr; it_cdr = it_cdr->
next) {
3837 processeditem = batchitem;
3838 batchitem = batchitem->
next;
3869 ast_debug(1,
"CDR single-threaded batch processing begins now\n");
3873 ast_log(
LOG_WARNING,
"CDR processing thread could not detach, now trying in this thread\n");
3876 ast_debug(1,
"CDR multi-threaded batch processing begins now\n");
3925 int submit_batch = 0;
3946 ast_debug(1,
"CDR detaching from this thread\n");
3949 if (!(newtail =
ast_calloc(1,
sizeof(*newtail)))) {
3971 if (curr >= (mod_cfg->general->batch_settings.size - 1)) {
3984 struct timespec timeout;
3995 timeout.tv_sec = now.tv_sec;
3996 timeout.tv_nsec = now.tv_usec * 1000;
4002 ast_debug(2,
"Processed %d CDR batches from the run queue\n", numevents);
4014 e->
command =
"cdr set debug [on|off]";
4015 e->
usage =
"Enable or disable extra debugging in the CDR Engine. Note\n"
4016 "that this will dump debug information to the VERBOSE setting\n"
4017 "and should only be used when debugging information from the\n"
4018 "CDR engine is needed.\n";
4030 ast_cli(
a->fd,
"Could not set CDR debugging mode\n");
4033 if (!strcasecmp(
a->argv[3],
"on")
4036 ast_cli(
a->fd,
"CDR debugging enabled\n");
4037 }
else if (!strcasecmp(
a->argv[3],
"off")
4040 ast_cli(
a->fd,
"CDR debugging disabled\n");
4051 int wordlen = strlen(
a->word);
4074 char start_time_buffer[64];
4075 char answer_time_buffer[64];
4076 char end_time_buffer[64];
4078#define TITLE_STRING "%-25.25s %-25.25s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8s %-8.8s\n"
4079#define FORMAT_STRING "%-25.25s %-25.25s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8ld %-8.8ld\n"
4082 ast_cli(
a->fd,
"Channels with Call Detail Record (CDR) Information\n");
4083 ast_cli(
a->fd,
"--------------------------------------------------\n");
4084 ast_cli(
a->fd,
TITLE_STRING,
"Channel",
"Dst. Channel",
"LastApp",
"Start",
"Answer",
"End",
"Billsec",
"Duration");
4089 struct timeval start_time = { 0, };
4090 struct timeval answer_time = { 0, };
4091 struct timeval end_time = { 0, };
4098 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
4103 start_time = it_cdr->
start;
4106 answer_time = it_cdr->
answer;
4117 cdr_get_tv(start_time,
"%T", start_time_buffer,
sizeof(start_time_buffer));
4118 cdr_get_tv(answer_time,
"%T", answer_time_buffer,
sizeof(answer_time_buffer));
4119 cdr_get_tv(end_time,
"%T", end_time_buffer,
sizeof(end_time_buffer));
4138 char start_time_buffer[64];
4139 char answer_time_buffer[64];
4140 char end_time_buffer[64];
4141 const char *channel_name =
a->argv[3];
4144#define TITLE_STRING "%-10.10s %-20.20s %-25.25s %-15.15s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8s %-8.8s\n"
4145#define FORMAT_STRING "%-10.10s %-20.20s %-25.25s %-15.15s %-15.15s %-8.8s %-8.8s %-8.8s %-8.8ld %-8.8ld\n"
4149 ast_cli(
a->fd,
"Unknown channel: %s\n", channel_name);
4154 ast_cli(
a->fd,
"Call Detail Record (CDR) Information for %s\n", channel_name);
4155 ast_cli(
a->fd,
"--------------------------------------------------\n");
4156 ast_cli(
a->fd,
TITLE_STRING,
"AccountCode",
"CallerID",
"Dst. Channel",
"LastApp",
"Data",
"Start",
"Answer",
"End",
"Billsec",
"Duration");
4159 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
4171 cdr_get_tv(it_cdr->
start,
"%T", start_time_buffer,
sizeof(start_time_buffer));
4172 cdr_get_tv(it_cdr->
answer,
"%T", answer_time_buffer,
sizeof(answer_time_buffer));
4173 cdr_get_tv(
end,
"%T", end_time_buffer,
sizeof(end_time_buffer));
4198 e->
command =
"cdr show active";
4200 "Usage: cdr show active [channel]\n"
4201 " Displays a summary of all Call Detail Records when [channel]\n"
4202 " is omitted; displays all of the Call Detail Records\n"
4203 " currently in flight for a given [channel] when [channel] is\n"
4205 " Note that this will not display Call Detail Records that\n"
4206 " have already been dispatched to a backend storage, nor for\n"
4207 " channels that are no longer active.\n";
4215 }
else if (
a->argc < 4) {
4229 long nextbatchtime = 0;
4233 e->
command =
"cdr show status";
4235 "Usage: cdr show status\n"
4236 " Displays the Call Detail Record engine system status.\n";
4252 ast_cli(
a->fd,
"Call Detail Record (CDR) settings\n");
4253 ast_cli(
a->fd,
"----------------------------------\n");
4263 ast_cli(
a->fd,
"* Batch Mode Settings\n");
4264 ast_cli(
a->fd,
" -------------------\n");
4271 ast_cli(
a->fd,
" Current batch size: %d record%s\n", cnt,
ESS(cnt));
4274 ast_cli(
a->fd,
" Next batch processing time: %ld second%s\n\n", nextbatchtime,
ESS(nextbatchtime));
4276 ast_cli(
a->fd,
"* Registered Backends\n");
4277 ast_cli(
a->fd,
" -------------------\n");
4283 ast_cli(
a->fd,
" %s%s\n", beitem->
name, beitem->suspended ?
" (suspended) " :
"");
4302 "Usage: cdr submit\n"
4303 "Posts all pending batched CDR data to the configured CDR\n"
4304 "backend engine modules.\n";
4319 ast_cli(
a->fd,
"Cannot submit CDR batch: CDR engine disabled.\n");
4321 ast_cli(
a->fd,
"Cannot submit CDR batch: batch mode not enabled.\n");
4324 ast_cli(
a->fd,
"Submitted CDRs to backend engines for processing. This may take a while.\n");
4348 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
4438 aco_option_register(&cfg_info,
"size",
ACO_EXACT,
general_options,
DEFAULT_BATCH_SIZE,
OPT_UINT_T,
PARSE_IN_RANGE,
FLDSET(
struct ast_cdr_config, batch_settings.size), 0,
MAX_BATCH_SIZE);
4439 aco_option_register(&cfg_info,
"time",
ACO_EXACT,
general_options,
DEFAULT_BATCH_TIME,
OPT_UINT_T,
PARSE_IN_RANGE,
FLDSET(
struct ast_cdr_config, batch_settings.time), 1,
MAX_BATCH_TIME);
4515 ast_log(
LOG_NOTICE,
"CDR batch mode logging enabled, first of either size %u or time %u seconds.\n",
4516 config->batch_settings.size,
config->batch_settings.time);
4536 for (it_cdr = cdr; it_cdr; it_cdr = it_cdr->
next) {
4537 prnt(where,
"Party A: %s; Party B: %s; Bridge %s\n",
4560 prnt(where,
"Party A: %s; Party B: %s; Bridge %s",
4593 return mod_cfg ? 0 : -1;
4636 CDR_DEBUG(
"Dial messages will be mostly ignored\n");
4645 CDR_DEBUG(
"All bridge and parking messages will be ignored\n");
4693 if (cdr_sync_message_type()) {
4707 ast_debug(1,
"CDR Engine termination request received; waiting on messages...\n");
4755 .
requires =
"extconfig",
Asterisk main include file. File version handling, generic pbx functions.
int ast_register_atexit(void(*func)(void))
Register a function to be executed before Asterisk exits.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
#define ao2_t_ref(o, delta, tag)
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_global_obj_replace_unref(holder, obj)
Replace an ao2 object in the global holder, throwing away any old object.
#define ao2_t_replace(dst, src, tag)
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
void ao2_container_unregister(const char *name)
Unregister a container for CLI stats and integrity check.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_callback_data(container, flags, cb_fn, arg, data)
#define ao2_unlink(container, obj)
Remove an object from a container.
#define ao2_unlink_flags(container, obj, flags)
Remove an object from a container.
#define ao2_link_flags(container, obj, flags)
Add an object to a container.
#define ao2_global_obj_ref(holder)
Get a reference to the object stored in the global holder.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_replace(dst, src)
Replace one object reference with another cleaning up the original.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
int ao2_container_register(const char *name, struct ao2_container *self, ao2_prnt_obj_fn *prnt_obj)
Register a container for CLI stats and integrity check.
#define ao2_global_obj_release(holder)
Release the ao2 object held in the global holder.
#define ao2_bump(obj)
Bump refcount on an AO2 object by one, returning the object.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
@ OBJ_SEARCH_PARTIAL_KEY
The arg parameter is a partial search key similar to OBJ_SEARCH_KEY.
@ OBJ_SEARCH_OBJECT
The arg parameter is an object of the same type.
@ OBJ_NOLOCK
Assume that the ao2_container is already locked.
@ OBJ_SEARCH_MASK
Search option field mask.
@ OBJ_SEARCH_KEY
The arg parameter is a search key, but is not an object.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
void() ao2_prnt_fn(void *where, const char *fmt,...)
Print output.
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
char * ast_callerid_merge(char *buf, int bufsiz, const char *name, const char *num, const char *unknown)
Internal Asterisk hangup causes.
#define AST_CAUSE_CONGESTION
#define AST_CAUSE_NO_ROUTE_DESTINATION
#define AST_CAUSE_UNREGISTERED
#define AST_CAUSE_NO_ANSWER
#define AST_CAUSE_NORMAL_CLEARING
static void reset_batch(void)
struct cdr_object_fn_table dial_state_fn_table
The virtual table for the Dial state.
static void finalized_state_init_function(struct cdr_object *cdr)
struct cdr_object_fn_table single_state_fn_table
The virtual table for the Single state.
static int dial_changes_ignored
static struct aco_type ignore_option
static enum ast_cdr_disposition dial_status_to_disposition(const char *dial_status)
static int finalized_state_process_party_a(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
static int cdr_object_dispatch_all_cb(void *obj, void *arg, int flags)
This dispatches all cdr_object. It should only be used during shutdown, so that we get billing record...
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.
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.
static int dialed_pending_state_process_dial_begin(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer)
#define DEFAULT_BATCH_SIZE
static void handle_parked_call_message(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Handler for when a channel is parked.
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 register...
int ast_cdr_is_enabled(void)
Return TRUE if CDR subsystem is enabled.
static struct ast_cli_entry cli_commands[]
static pthread_t cdr_thread
void ast_cdr_setuserfield(const char *channel_name, const char *userfield)
Set CDR user field for channel (stored in CDR)
static void cdr_all_unlink(struct cdr_object *cdr)
static const char *const cdr_readonly_vars[]
STASIS_MESSAGE_TYPE_DEFN_LOCAL(cdr_sync_message_type)
A message type used to synchronize with the CDR topic.
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.
static int process_config(int reload)
static int dialed_pending_state_process_parking_bridge_enter(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
static char * handle_cli_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct cdr_object * cdr_object_alloc(struct ast_channel_snapshot *chan, const struct timeval *event_time)
cdr_object constructor
int ast_cdr_modifier_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR modifier.
static void cdr_get_tv(struct timeval when, const char *fmt, char *buf, int bufsize)
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...
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.
static const char * ignore_categories[]
static void cdr_all_print_fn(void *v_obj, void *where, ao2_prnt_fn *prnt)
static long cdr_object_get_duration(struct cdr_object *cdr)
void ast_cdr_free(struct ast_cdr *cdr)
Free a CDR record.
struct cdr_object_fn_table dialed_pending_state_fn_table
The virtual table for the Dialed Pending state.
static void bridge_state_process_party_b(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
void ast_cdr_set_config(struct ast_cdr_config *config)
Set the current CDR configuration.
#define DEFAULT_BATCHMODE
static ast_cond_t cdr_pending_cond
struct stasis_message_router * ast_cdr_message_router(void)
Return the message router for the CDR engine.
static void single_state_init_function(struct cdr_object *cdr)
static int create_subscriptions(void)
Create the Stasis subcriptions for CDRs.
static void cdr_object_finalize(struct cdr_object *cdr)
Finalize a CDR.
static struct ast_sched_context * sched
Scheduler items.
static int base_process_bridge_leave(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
static int cdr_object_update_party_b(void *obj, void *arg, void *data, int flags)
#define DEFAULT_IGNORE_STATE_CHANGES
static ast_mutex_t cdr_batch_lock
Lock protecting modifications to the batch queue.
process_bridge_enter_results
Return types for process_bridge_enter functions.
@ BRIDGE_ENTER_ONLY_PARTY
@ BRIDGE_ENTER_NO_PARTY_B
@ BRIDGE_ENTER_OBTAINED_PARTY_B
int ast_cdr_modifier_unregister(const char *name)
Unregister a CDR modifier.
static int cdr_generic_register(struct be_list *generic_list, const char *name, const char *desc, ast_cdrbe be)
static void cdr_detach(struct ast_cdr *cdr)
static int cdr_object_finalize_party_b(void *obj, void *arg, void *data, int flags)
static struct cdr_batch * batch
static void bridge_candidate_process(struct cdr_object *cdr, struct cdr_object *base_cand_cdr)
Process a single bridge_candidate.
struct cdr_object_fn_table bridge_state_fn_table
The virtual table for the Bridged state.
static char * handle_cli_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void cli_show_channels(struct ast_cli_args *a)
static struct stasis_forward * bridge_subscription
Our subscription for bridges.
int ast_cdr_clear_property(const char *channel_name, enum ast_cdr_options option)
Clear a property on a CDR for a channel.
static int cdr_object_select_all_by_name_cb(void *obj, void *arg, int flags)
int ast_cdr_setvar(const char *channel_name, const char *name, const char *value)
Set a variable on a CDR.
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.
static const char * cdr_format_var_internal(struct ast_cdr *cdr, const char *name)
static int cdr_all_hash_fn(const void *obj, const int flags)
static int filter_channel_snapshot(struct ast_channel_snapshot *snapshot)
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 void cdr_object_dispatch(struct cdr_object *cdr)
Dispatch a CDR.
static struct stasis_forward * channel_subscription
Our subscription for channels.
#define DEFAULT_UNANSWERED
void ast_cdr_engine_term(void)
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 struct aco_file module_file_conf
The file definition.
static int base_process_parked_channel(struct cdr_object *cdr, struct ast_parked_call_payload *parking_info)
static char * handle_cli_submit(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct aco_type general_option
The type definition for general options.
static int cdr_master_cmp_fn(void *obj, void *arg, int flags)
struct ast_cdr * ast_cdr_alloc(void)
Allocate a CDR record.
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.
struct cdr_object_fn_table finalized_state_fn_table
The virtual table for the finalized state.
static void handle_bridge_leave_message(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Handler for when a channel leaves a bridge.
#define cdr_set_debug_mode(mod_cfg)
static AO2_GLOBAL_OBJ_STATIC(module_configs)
The container for the module configuration.
int ast_cdr_backend_unsuspend(const char *name)
Unsuspend a CDR backend.
static char * cli_complete_show(struct ast_cli_args *a)
Complete user input for 'cdr show'.
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.
static void module_config_destructor(void *obj)
Dispose of a module config object.
static struct stasis_message_router * stasis_router
Message router for stasis messages regarding channel state.
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.
static void handle_channel_snapshot_update_message(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Handler for channel snapshot update messages.
static int dial_status_end(const char *dialstatus)
static int ast_cdr_generic_unregister(struct be_list *generic_list, const char *name)
struct cdr_object_fn_table parked_state_fn_table
The virtual table for the Parked state.
static void single_state_process_party_b(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
static int cdr_toggle_runtime_options(void)
Checks if CDRs are enabled and enables/disables the necessary options.
static void handle_bridge_enter_message(void *data, struct stasis_subscription *sub, struct stasis_message *message)
static void handle_cdr_sync_message(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Handler for a synchronization message.
static int copy_variables(struct varshead *to_list, struct varshead *from_list)
Copy variables from one list to another.
static int reload_module(void)
static void finalize_batch_mode(void)
#define CDR_DEBUG(fmt,...)
int ast_cdr_fork(const char *channel_name, struct ast_flags *options)
Fork a CDR.
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 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 mu...
static void set_variable(struct varshead *headp, const char *name, const char *value)
static int filter_bridge_messages(struct ast_bridge_snapshot *bridge)
Filter bridge messages based on bridge technology.
static int init_batch(void)
static int submit_scheduled_batch(const void *data)
static struct aco_type * general_options[]
static void start_batch_mode(void)
static int base_process_party_a(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
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.
int ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
static void cdr_object_snapshot_copy(struct cdr_object_snapshot *dst, struct cdr_object_snapshot *src)
Copy a snapshot and its details.
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.
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.
static void dial_state_process_party_b(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
static void cdr_all_relink(struct cdr_object *cdr)
static int dial_state_process_dial_begin(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer)
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.
#define DEFAULT_INITIATED_SECONDS
static void cdr_master_print_fn(void *v_obj, void *where, ao2_prnt_fn *prnt)
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.
static int bridge_state_process_bridge_leave(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
static struct stasis_forward * parking_subscription
Our subscription for parking.
static void cdr_enable_batch_mode(struct ast_cdr_config *config)
static long cdr_object_get_billsec(struct cdr_object *cdr)
Compute the billsec for a cdr_object.
static struct ao2_container * active_cdrs_master
A container of the active master CDRs indexed by Party A channel uniqueid.
static int global_cdr_sequence
The global sequence counter used for CDRs.
#define DEFAULT_IGNORE_DIAL_CHANGES
static int cdr_all_cmp_fn(void *obj, void *arg, int flags)
static void * do_batch_backend_process(void *data)
const char * ast_cdr_disp2str(int disposition)
Disposition to a string.
static int is_cdr_flag_set(unsigned int cdr_flag)
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 dia...
static void cdr_object_set_disposition(struct cdr_object *cdr, int hangupcause)
Set the disposition on a cdr_object based on a hangupcause code.
static struct ao2_container * active_cdrs_all
A container of all active CDRs with a Party B indexed by Party B channel name.
static void bridge_candidate_add_to_cdr(struct cdr_object *cdr, struct cdr_object_snapshot *party_b)
static struct stasis_topic * cdr_topic
The parent topic for all topics we want to aggregate for CDRs.
static char * handle_cli_status(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR handling engine.
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 log...
#define DEFAULT_BATCH_SAFE_SHUTDOWN
static void handle_dial_message(void *data, struct stasis_subscription *sub, struct stasis_message *message)
Handler for Stasis-Core dial messages.
#define DEFAULT_BATCH_TIME
static int filter_channel_snapshot_message(struct ast_channel_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot)
static int load_module(void)
static void cli_show_channel(struct ast_cli_args *a)
static int cdr_object_get_by_name_cb(void *obj, void *arg, int flags)
static struct cdr_object * cdr_object_get_by_name(const char *name)
int ast_cdr_backend_suspend(const char *name)
Suspend a CDR backend temporarily.
static void cdr_engine_shutdown(void)
static ast_mutex_t cdr_pending_lock
These are used to wake up the CDR thread when there's work to do.
static void post_cdr(struct ast_cdr *cdr)
static int unload_module(void)
#define DEFAULT_BATCH_SCHEDULER_ONLY
static int single_state_process_parking_bridge_enter(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
struct ast_cdr_config * ast_cdr_get_config(void)
Obtain the current CDR configuration.
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)
#define DEFAULT_CHANNEL_ENABLED
static void * module_config_alloc(void)
Create a new module config object.
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.
static void cdr_object_update_cid(struct cdr_object_snapshot *old_snapshot, struct ast_channel_snapshot *new_snapshot)
Set Caller ID information on a CDR.
static void free_variables(struct varshead *headp)
Delete all variables from a variable list.
static int single_state_process_dial_begin(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer)
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.
static int cdr_master_hash_fn(const void *obj, const int flags)
static int parked_state_process_bridge_leave(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
static void destroy_subscriptions(void)
Destroy the active Stasis subscriptions.
static void cdr_submit_batch(int shutdown)
static void cdr_object_dtor(void *obj)
cdr_object Destructor
static void module_config_post_apply(void)
static int dialed_pending_state_process_party_a(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
#define DEFAULT_END_BEFORE_H_EXTEN
static ast_mutex_t cdr_sched_lock
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.
static int cdr_debug_enabled
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.
struct ast_cdr * ast_cdr_dup(struct ast_cdr *cdr)
Duplicate a public CDR.
static void * do_cdr(void *data)
CONFIG_INFO_CORE("cdr", cfg_info, module_configs, module_config_alloc,.files=ACO_FILES(&module_file_conf),.post_apply_config=module_config_post_apply,)
int ast_cdr_reset(const char *channel_name, int keep_variables)
Reset the detail record.
int ast_cdr_set_property(const char *channel_name, enum ast_cdr_options option)
Set a property on a CDR for a channel.
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 enum process_bridge_enter_results single_state_process_bridge_enter(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
@ CDR_IGNORE_STATE_CHANGES
@ CDR_CHANNEL_DEFAULT_ENABLED
@ CDR_IGNORE_DIAL_CHANGES
@ BATCH_MODE_SAFE_SHUTDOWN
@ BATCH_MODE_SCHEDULER_ONLY
ast_cdr_disposition
CDR Flags - Disposition.
int(* ast_cdrbe)(struct ast_cdr *cdr)
CDR backend callback.
ast_cdr_options
CDR manipulation options. Certain function calls will manipulate the state of a CDR object based on t...
@ AST_CDR_FLAG_DISABLE_ALL
@ AST_CDR_FLAG_SET_ANSWER
static const char cdr_config[]
static struct cdr_tds_config * settings
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
static const char config[]
General Asterisk PBX channel definitions.
@ AST_CHAN_TP_INTERNAL
Channels with this particular technology are an implementation detail of Asterisk and should generall...
#define AST_NUM_CHANNEL_BUCKETS
const char * ast_channel_amaflags2string(enum ama_flags flags)
Convert the enum representation of an AMA flag to a string representation.
@ AST_SOFTHANGUP_HANGUP_EXEC
@ AST_FLAG_SUBROUTINE_EXEC
#define AST_MAX_USER_FIELD
const char * ast_var_name(const struct ast_var_t *var)
#define ast_var_assign(name, value)
const char * ast_var_value(const struct ast_var_t *var)
void ast_var_delete(struct ast_var_t *var)
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
static void update(int code_size, int y, int wi, int fi, int dq, int sr, int dqsez, struct g726_state *state_ptr)
Configuration option-handling.
int aco_set_defaults(struct aco_type *type, const char *category, void *obj)
Set all default options of obj.
void aco_info_destroy(struct aco_info *info)
Destroy an initialized aco_info struct.
@ ACO_PROCESS_ERROR
Their was an error and no changes were applied.
int aco_info_init(struct aco_info *info)
Initialize an aco_info structure.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
#define aco_option_register(info, name, matchtype, types, default_val, opt_type, flags,...)
Register a config option.
@ OPT_UINT_T
Type for default option handler for unsigned integers.
@ OPT_BOOLFLAG_T
Type for default option handler for bools (ast_true/ast_false) that are stored in a flag.
enum aco_process_status aco_process_config(struct aco_info *info, int reload)
Process a config info via the options registered with an aco_info.
#define ACO_TYPES(...)
A helper macro to ensure that aco_info types always have a sentinel.
struct stasis_topic * ast_parking_topic(void)
accessor for the parking stasis topic
struct stasis_topic * ast_channel_topic_all(void)
A topic which publishes the events for all channels.
struct stasis_message_type * ast_parked_call_type(void)
accessor for the parked call stasis message type
struct ast_channel_snapshot * ast_multi_channel_blob_get_channel(struct ast_multi_channel_blob *obj, const char *role)
Retrieve a channel snapshot associated with a specific role from a ast_multi_channel_blob.
struct stasis_message_type * ast_channel_dial_type(void)
Message type for when a channel dials another channel.
struct stasis_message_type * ast_channel_snapshot_type(void)
Message type for ast_channel_snapshot_update.
struct ast_json * ast_multi_channel_blob_get_json(struct ast_multi_channel_blob *obj)
Retrieve the JSON blob from a ast_multi_channel_blob. Returned ast_json is still owned by obj.
Configuration File Parser.
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
Asterisk JSON abstraction layer.
const char * ast_json_string_get(const struct ast_json *string)
Get the value of a JSON string.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
A set of macros to manage forward-linked lists.
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_RWLIST_REMOVE
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_RWLIST_TRAVERSE
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_RWLIST_INSERT_HEAD
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
Asterisk locking-related definitions:
#define ast_cond_destroy(cond)
#define SCOPED_AO2LOCK(varname, obj)
scoped lock specialization for ao2 mutexes.
#define AST_PTHREADT_NULL
#define ast_cond_init(cond, attr)
#define ast_cond_timedwait(cond, mutex, time)
#define ast_mutex_unlock(a)
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
pthread_cond_t ast_cond_t
#define ast_mutex_lock(a)
#define AST_MUTEX_DEFINE_STATIC(mutex)
#define ast_cond_signal(cond)
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_FAILURE
Module could not be loaded properly.
@ AST_MODULE_LOAD_SUCCESS
struct stasis_forward * sub
Scheduler Routines (derived from cheops)
#define AST_SCHED_DEL(sched, id)
Remove a scheduler entry.
long ast_sched_when(struct ast_sched_context *con, int id)
Returns the number of seconds before an event takes place.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
int ast_sched_add_variable(struct ast_sched_context *con, int when, ast_sched_cb callback, const void *data, int variable) attribute_warn_unused_result
Adds a scheduled event with rescheduling support.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
Stasis Message Bus API. See Stasis Message Bus API for detailed documentation.
#define STASIS_MESSAGE_TYPE_CLEANUP(name)
Boiler-plate messaging macro for cleaning up message types.
struct stasis_forward * stasis_forward_cancel(struct stasis_forward *forward)
struct stasis_topic * stasis_topic_create(const char *name)
Create a new topic.
#define STASIS_MESSAGE_TYPE_INIT(name)
Boiler-plate messaging macro for initializing message types.
void * stasis_message_data(const struct stasis_message *msg)
Get the data contained in a message.
struct stasis_message * stasis_message_create(struct stasis_message_type *type, void *data)
Create a new message.
struct stasis_forward * stasis_forward_all(struct stasis_topic *from_topic, struct stasis_topic *to_topic)
Create a subscription which forwards all messages from one topic to another.
const struct timeval * stasis_message_timestamp(const struct stasis_message *msg)
Get the time when a message was created.
struct stasis_message_type * ast_channel_entered_bridge_type(void)
Message type for ast_channel enter bridge blob messages.
struct stasis_topic * ast_bridge_topic_all(void)
A topic which publishes the events for all bridges.
struct stasis_message_type * ast_channel_left_bridge_type(void)
Message type for ast_channel leave bridge blob messages.
int stasis_message_router_set_congestion_limits(struct stasis_message_router *router, long low_water, long high_water)
Set the high and low alert water marks of the stasis message router.
#define stasis_message_router_create(topic)
Create a new message router object.
int stasis_message_router_add(struct stasis_message_router *router, struct stasis_message_type *message_type, stasis_subscription_cb callback, void *data)
Add a route to a message router.
void stasis_message_router_unsubscribe_and_join(struct stasis_message_router *router)
Unsubscribe the router from the upstream topic, blocking until the final message has been processed.
void stasis_message_router_publish_sync(struct stasis_message_router *router, struct stasis_message *message)
Publish a message to a message router's subscription synchronously.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
The representation of a single configuration file to be processed.
Type information about a category-level configurable object.
enum aco_category_op category_match
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Blob of data associated with a bridge.
Structure that contains a snapshot of information about a bridge.
const ast_string_field uniqueid
const ast_string_field technology
struct ao2_container * channels
const ast_string_field subclass
struct ast_flags settings
The global options available for CDRs.
struct ast_flags settings
struct ast_cdr_config::batch_settings batch_settings
Responsible for call detail data.
char dstchannel[AST_MAX_EXTENSION]
char lastdata[AST_MAX_EXTENSION]
char linkedid[AST_MAX_UNIQUEID]
char userfield[AST_MAX_USER_FIELD]
char peertenantid[AST_MAX_TENANT_ID]
char channel[AST_MAX_EXTENSION]
char peeraccount[AST_MAX_ACCOUNT_CODE]
char src[AST_MAX_EXTENSION]
char dst[AST_MAX_EXTENSION]
char clid[AST_MAX_EXTENSION]
char uniqueid[AST_MAX_UNIQUEID]
char tenantid[AST_MAX_TENANT_ID]
char accountcode[AST_MAX_ACCOUNT_CODE]
char lastapp[AST_MAX_EXTENSION]
char dcontext[AST_MAX_EXTENSION]
struct timeval creationtime
const ast_string_field tenantid
const ast_string_field accountcode
const ast_string_field uniqueid
const ast_string_field name
const ast_string_field dialed_subaddr
const ast_string_field number
const ast_string_field name
const ast_string_field subaddr
const ast_string_field dnid
const ast_string_field data
const ast_string_field context
const ast_string_field exten
const ast_string_field appl
Structure representing a change of snapshot of channel state.
Structure representing a snapshot of channel state.
struct ast_channel_snapshot_dialplan * dialplan
struct ast_channel_snapshot_peer * peer
struct ast_channel_snapshot_bridge * bridge
struct ast_channel_snapshot_base * base
enum ast_channel_state state
struct ast_flags softhangup_flags
struct ast_channel_snapshot_caller * caller
struct ast_channel_snapshot_hangup * hangup
descriptor for a cli entry.
Structure used to handle boolean flags.
Abstract JSON element (object, array, string, int, ...).
A multi channel blob data structure for multi_channel_blob stasis messages.
A parked call message payload.
unsigned int parkingspace
const ast_string_field parkinglot
struct ast_channel_snapshot * parkee
enum ast_parked_call_event_type event_type
Support for dynamic strings.
struct ast_var_t::@211 entries
List of registered backends.
const struct timeval * lastevent
struct ast_bridge_snapshot * bridge
struct ast_channel_snapshot * channel
Queued CDR waiting to be batched.
struct cdr_batch_item * next
struct cdr_batch_item * head
struct cdr_batch_item * tail
Registration object for CDR backends.
A virtual table used for cdr_object.
int(*const process_party_a)(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
Process a Party A update for the cdr_object.
int(*const process_dial_end)(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer, const char *dial_status)
Process the end of a dial. At the end of a dial, a CDR can be transitioned into one of two states - D...
void(*const process_party_b)(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
Process a Party B update for the cdr_object.
enum process_bridge_enter_results(*const process_bridge_enter)(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
Process the entering of a bridge by this CDR. The purpose of this callback is to have the CDR prepare...
int(*const process_dial_begin)(struct cdr_object *cdr, struct ast_channel_snapshot *caller, struct ast_channel_snapshot *peer)
Process the beginning of a dial. A dial message implies one of two things: The cdr_object's Party A h...
int(*const process_bridge_leave)(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
Process the leaving of a bridge by this CDR.
const char * name
Name of the subclass.
int(*const process_parking_bridge_enter)(struct cdr_object *cdr, struct ast_bridge_snapshot *bridge, struct ast_channel_snapshot *channel)
Process entering into a parking bridge.
void(*const init_function)(struct cdr_object *cdr)
An initialization function. This will be called automatically when a cdr_object is switched to this t...
int(*const process_parked_channel)(struct cdr_object *cdr, struct ast_parked_call_payload *parking_info)
Process an update informing us that the channel got itself parked.
A wrapper object around a snapshot. Fields that are mutable by the CDR engine are replicated here.
char userfield[AST_MAX_USER_FIELD]
struct varshead variables
struct ast_channel_snapshot * snapshot
An in-memory representation of an active CDR.
struct cdr_object_fn_table * fn_table
const ast_string_field tenantid
enum ast_cdr_disposition disposition
const ast_string_field linkedid
const ast_string_field party_b_name
struct cdr_object_snapshot party_a
const ast_string_field uniqueid
const ast_string_field data
const ast_string_field context
const ast_string_field exten
const ast_string_field name
const ast_string_field bridge
const ast_string_field appl
struct cdr_object_snapshot party_b
List of registered modifiers.
The configuration settings for this module.
struct ast_cdr_config * general
const char * channel_name
An API for managing task processing threads that can be shared across modules.
#define AST_TASKPROCESSOR_HIGH_WATER_LEVEL
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate)
Returns a timeval corresponding to the duration of n samples at rate r. Useful to convert samples to ...
int ast_tvzero(const struct timeval t)
Returns true if the argument is 0,0.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_test_flag(p, flag)
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
#define ast_pthread_create_background(a, b, c, d)
#define ast_clear_flag(p, flag)
#define ast_pthread_create_detached_background(a, b, c, d)
#define ast_set_flag(p, flag)
#define ast_copy_flags(dest, src, flagz)