Asterisk - The Open Source Telephony Project GIT-master-67613d1
cdr.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 1999 - 2005, Digium, Inc.
5 *
6 * Mark Spencer <markster@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*!
20 * \file
21 * \brief Call Detail Record API
22 *
23 * \author Mark Spencer <markster@digium.com>
24 */
25
26#ifndef _ASTERISK_CDR_H
27#define _ASTERISK_CDR_H
28
29#include "asterisk/channel.h"
30
31/*! \file
32 *
33 * \since 12
34 *
35 * \brief Call Detail Record Engine.
36 *
37 * \page CDR Call Detail Record Engine
38 *
39 * \par Intro
40 *
41 * The Call Detail Record (CDR) engine uses the \ref stasis Stasis Message Bus
42 * to build records for the channels in Asterisk. As the state of a channel and
43 * the bridges it participates in changes, notifications are sent over the
44 * Stasis Message Bus. The CDR engine consumes these notifications and builds
45 * records that reflect that state. Over the lifetime of a channel, many CDRs
46 * may be generated for that channel or that involve that channel.
47 *
48 * CDRs have a lifecycle that is a subset of the channel that they reflect. A
49 * single CDR for a channel represents a path of communication between the
50 * endpoint behind a channel and Asterisk, or between two endpoints. When a
51 * channel establishes a new path of communication, a new CDR is created for the
52 * channel. Likewise, when a path of communication is terminated, a CDR is
53 * finalized. Finally, when a channel is no longer present in Asterisk, all CDRs
54 * for that channel are dispatched for recording.
55 *
56 * Dispatching of CDRs occurs to registered CDR backends. CDR backends register
57 * through \ref ast_cdr_register and are responsible for taking the produced
58 * CDRs and storing them in permanent storage.
59 *
60 * \par CDR attributes
61 *
62 * While a CDR can have many attributes, all CDRs have two parties: a Party A
63 * and a Party B. The Party A is \em always the channel that owns the CDR. A CDR
64 * may or may not have a Party B, depending on its state.
65 *
66 * For the most part, attributes on a CDR are reflective of those same
67 * attributes on the channel at the time when the CDR was finalized. Specific
68 * CDR attributes include:
69 * \li \c start The time when the CDR was created
70 * \li \c answer The time when the Party A was answered, or when the path of
71 * communication between Party A and Party B was established
72 * \li \c end The time when the CDR was finalized
73 * \li \c duration \c end - \c start. If \c end is not known, the current time
74 * is used
75 * \li \c billsec \c end - \c answer. If \c end is not known, the current time
76 * is used
77 * \li \c userfield User set data on some party in the CDR
78 *
79 * Note that \c accountcode and \c amaflags are actually properties of a
80 * channel, not the CDR.
81 *
82 * \par CDR States
83 *
84 * CDRs go through various states during their lifetime. State transitions occur
85 * due to messages received over the \ref stasis Stasis Message Bus. The
86 * following describes the possible states a CDR can be in, and how it
87 * transitions through the states.
88 *
89 * \par Single
90 *
91 * When a CDR is created, it is put into the Single state. The Single state
92 * represents a CDR for a channel that has no Party B. CDRs can be unanswered
93 * or answered while in the Single state.
94 *
95 * The following transitions can occur while in the Single state:
96 * \li If a \ref ast_channel_dial_type indicating a Dial Begin is received, the
97 * state transitions to Dial
98 * \li If a \ref ast_channel_snapshot is received indicating that the channel
99 * has hung up, the state transitions to Finalized
100 * \li If a \ref ast_bridge_blob is received indicating a Bridge Enter, the
101 * state transitions to Bridge
102 * \li If a \ref ast_bridge_blob message indicating an entrance to a
103 * holding bridge with a subclass type of "parking" is received, the CDR is
104 * transitioned to the Parked state.
105 *
106 * \par Dial
107 *
108 * This state represents a dial that is occurring within Asterisk. The Party A
109 * can either be the caller for a two party dial, or it can be the dialed party
110 * if the calling party is Asterisk (that is, an Originated channel). In the
111 * first case, the Party B is \em always the dialed channel; in the second case,
112 * the channel is not considered to be a "dialed" channel as it is alone in the
113 * dialed operation.
114 *
115 * While in the Dial state, multiple CDRs can be created for the Party A if a
116 * parallel dial occurs. Each dialed party receives its own CDR with Party A.
117 *
118 * The following transitions can occur while in the Dial state:
119 * \li If a \ref ast_channel_dial_type indicating a Dial End is received where
120 * the \c dial_status is not ANSWER, the state transitions to Finalized
121 * \li If a \ref ast_channel_snapshot is received indicating that the channel
122 * has hung up, the state transitions to Finalized
123 * \li If a \ref ast_channel_dial_type indicating a Dial End is received where
124 * the \c dial_status is ANSWER, the state transitions to DialedPending
125 * \li If a \ref ast_bridge_blob is received indicating a Bridge Enter, the
126 * state transitions to Bridge
127 *
128 * \par DialedPending
129 *
130 * Technically, after being dialed, a CDR does not have to transition to the
131 * Bridge state. If the channel being dialed was originated, the channel may
132 * being executing dialplan. Strangely enough, it is also valid to have both
133 * Party A and Party B - after a dial - to not be bridged and instead execute
134 * dialplan. DialedPending handles the state where we figure out if the CDR
135 * showing the dial needs to move to the Bridge state; if the CDR should show
136 * that we started executing dialplan; of if we need a new CDR.
137 *
138 * The following transition can occur while in the DialedPending state:
139 * \li If a \ref ast_channel_snapshot is received that indicates that the
140 * channel has begun executing dialplan, we transition to the Finalized state
141 * if we have a Party B. Otherwise, we transition to the Single state.
142 * \li If a \ref ast_bridge_blob is received indicating a Bridge Enter, the
143 * state transitions to Bridge (through the Dial state)
144 * \li If a \ref ast_bridge_blob message indicating an entrance to a
145 * holding bridge with a subclass type of "parking" is received, the CDR is
146 * transitioned to the Parked state.
147 *
148 * \par Bridge
149 *
150 * The Bridge state represents a path of communication between Party A and one
151 * or more other parties. When a CDR enters into the Bridge state, the following
152 * occurs:
153 * \li The CDR attempts to find a Party B. If the CDR has a Party B, it looks
154 * for that channel in the bridge and updates itself accordingly. If the CDR
155 * does not yet have a Party B, it attempts to find a channel that can be its
156 * Party B. If it finds one, it updates itself; otherwise, the CDR is
157 * temporarily finalized.
158 * \li Once the CDR has a Party B or it is determined that it cannot have a
159 * Party B, new CDRs are created for each pairing of channels with the CDR's
160 * Party A.
161 *
162 * As an example, consider the following:
163 * \li A Dials B - both answer
164 * \li B joins a bridge. Since no one is in the bridge and it was a dialed
165 * channel, it cannot have a Party B.
166 * \li A joins the bridge. Since A's Party B is B, A updates itself with B.
167 * \li Now say an Originated channel, C, joins the bridge. The bridge becomes
168 * a multi-party bridge.
169 * \li C attempts to get a Party B. A cannot be C's Party B, as it was created
170 * before it. B is a dialed channel and can thus be C's Party B, so C's CDR
171 * updates its Party B to B.
172 * \li New CDRs are now generated. A gets a new CDR for A -> C. B is dialed, and
173 * hence cannot get any CDR.
174 * \li Now say another Originated channel, D, joins the bridge. Say D has the
175 * \ref AST_CDR_FLAG_PARTY_A flag set on it, such that it is always the
176 * preferred Party A. As such, it takes A as its Party B.
177 * \li New CDRs are generated. D gets new CDRs for D -> B and D -> C.
178 *
179 * The following transitions can occur while in the Bridge state:
180 * \li If a \ref ast_bridge_blob message indicating a leave is received,
181 * the state transitions to the Finalized state.
182 *
183 * \par Parked
184 *
185 * Parking is technically just another bridge in the Asterisk bridging
186 * framework. Unlike other bridges, however there are several key distinctions:
187 * \li With normal bridges, you want to show paths of communication between
188 * the participants. In parking, however, each participant is independent.
189 * From the perspective of a CDR, a call in parking should look like a dialplan
190 * application just executed.
191 * \li Holding bridges are typically items using in more complex applications,
192 * and so we usually don't want to show them. However, with Park, there is no
193 * application execution - often, a channel will be put directly into the
194 * holding bridge, bypassing the dialplan. This occurs when a call is blind
195 * transferred to a parking extension.
196 *
197 * As such, if a channel enters a bridge and that happens to be a holding bridge
198 * with a subclass type of "parking", we transition the CDR into the Parked
199 * state. The parking Stasis message updates the application name and data to
200 * reflect that the channel is in parking. When this occurs, a special flag is
201 * set on the CDR that prevents the application name from being updates by
202 * subsequent channel snapshot updates.
203 *
204 * The following transitions can occur while in the Parked state:
205 * \li If a \ref ast_bridge_blob message indicating a leave is received,
206 * the state transitions to the Finalized state
207 *
208 * \par Finalized
209 *
210 * Once a CDR enters the finalized state, it is finished. No further updates
211 * can be made to the party information, and the CDR cannot be changed.
212 *
213 * One exception to this occurs during linkedid propagation, in which the CDRs
214 * linkedids are updated based on who the channel is bridged with. In general,
215 * however, a finalized CDR is waiting for dispatch to the CDR backends.
216 */
217
218/*! \brief CDR engine settings */
220 CDR_ENABLED = 1 << 0, /*!< Enable CDRs */
221 CDR_BATCHMODE = 1 << 1, /*!< Whether or not we should dispatch CDRs in batches */
222 CDR_UNANSWERED = 1 << 2, /*!< Log unanswered CDRs */
223 CDR_CONGESTION = 1 << 3, /*!< Treat congestion as if it were a failed call */
224 CDR_END_BEFORE_H_EXTEN = 1 << 4, /*!< End the CDR before the 'h' extension runs */
225 CDR_INITIATED_SECONDS = 1 << 5, /*!< Include microseconds into the billing time */
226 CDR_DEBUG = 1 << 6, /*!< Enables extra debug statements */
227 CDR_CHANNEL_DEFAULT_ENABLED = 1 << 7, /*!< Whether CDR is enabled for each channel by default */
228 CDR_IGNORE_STATE_CHANGES = 1 << 8, /*!< Whether to ignore bridge and other call state change events */
229 CDR_IGNORE_DIAL_CHANGES = 1 << 9, /*!< Whether to ignore dial state changes */
230};
231
232/*! \brief CDR Batch Mode settings */
234 BATCH_MODE_SCHEDULER_ONLY = 1 << 0, /*!< Don't spawn a thread to handle the batches - do it on the scheduler */
235 BATCH_MODE_SAFE_SHUTDOWN = 1 << 1, /*!< During safe shutdown, submit the batched CDRs */
236};
237
238/*!
239 * \brief CDR manipulation options. Certain function calls will manipulate the
240 * state of a CDR object based on these flags.
241 */
243 AST_CDR_FLAG_KEEP_VARS = (1 << 0), /*!< Copy variables during the operation */
244 AST_CDR_FLAG_DISABLE = (1 << 1), /*!< Disable the current CDR */
245 AST_CDR_FLAG_DISABLE_ALL = (3 << 1), /*!< Disable the CDR and all future CDRs */
246 AST_CDR_FLAG_PARTY_A = (1 << 3), /*!< Set the channel as party A */
247 AST_CDR_FLAG_FINALIZE = (1 << 4), /*!< Finalize the current CDRs */
248 AST_CDR_FLAG_SET_ANSWER = (1 << 5), /*!< If the channel is answered, set the answer time to now */
249 AST_CDR_FLAG_RESET = (1 << 6), /*!< If set, set the start and answer time to now */
250 AST_CDR_LOCK_APP = (1 << 7), /*!< Prevent any further changes to the application field/data field for this CDR */
251};
252
253/*!
254 * \brief CDR Flags - Disposition
255 */
258 AST_CDR_NULL = (1 << 0),
259 AST_CDR_FAILED = (1 << 1),
260 AST_CDR_BUSY = (1 << 2),
263};
264
265
266/*! \brief The global options available for CDRs */
268 struct ast_flags settings; /*!< CDR settings */
270 unsigned int time; /*!< Time between batches */
271 unsigned int size; /*!< Size to trigger a batch */
272 struct ast_flags settings; /*!< Settings for batches */
274};
275
276/*!
277 * \brief Responsible for call detail data
278 */
279struct ast_cdr {
280 /*! Caller*ID with text */
282 /*! Caller*ID number */
284 /*! Destination extension */
286 /*! Destination context */
288
290 /*! Destination channel if appropriate */
292 /*! Last application if appropriate */
294 /*! Last application data */
296
297 struct timeval start;
298
299 struct timeval answer;
300
301 struct timeval end;
302 /*! Total time in system, in seconds */
303 long int duration;
304 /*! Total time call is up, in seconds */
305 long int billsec;
306 /*! What happened to the call */
307 long int disposition;
308 /*! What flags to use */
309 long int amaflags;
310 /*! What account number to use */
312 /*! Account number of the last person we talked to */
314 /*! flags */
315 unsigned int flags;
316 /*! Unique Channel Identifier */
318 /*! Linked group Identifier */
320 /*! User field */
322 /*! Sequence field */
324
325 /*! A linked list for variables */
327
328 struct ast_cdr *next;
329};
330
331/*!
332 * \since 12
333 * \brief Obtain the current CDR configuration
334 *
335 * The configuration is a ref counted object. The caller of this function must
336 * decrement the ref count when finished with the configuration.
337 *
338 * \retval NULL on error
339 * \return The current CDR configuration
340 */
342
343/*!
344 * \since 12
345 * \brief Set the current CDR configuration
346 *
347 * \param config The new CDR configuration
348 */
350
351/*!
352 * \since 12
353 * \brief Format a CDR variable from an already posted CDR
354 *
355 * \param cdr The dispatched CDR to process
356 * \param name The name of the variable
357 * \param ret Pointer to the formatted buffer
358 * \param workspace A pointer to the buffer to use to format the variable
359 * \param workspacelen The size of \p workspace
360 * \param raw If non-zero and a date/time is extracted, provide epoch seconds. Otherwise format as a date/time stamp
361 */
362void ast_cdr_format_var(struct ast_cdr *cdr, const char *name, char **ret, char *workspace, int workspacelen, int raw);
363
364/*!
365 * \since 12
366 * \brief Retrieve a CDR variable from a channel's current CDR
367 *
368 * \param channel_name The name of the party A channel that the CDR is associated with
369 * \param name The name of the variable to retrieve
370 * \param value Buffer to hold the value
371 * \param length The size of the buffer
372 *
373 * \retval 0 on success
374 * \retval non-zero on failure
375 */
376int ast_cdr_getvar(const char *channel_name, const char *name, char *value, size_t length);
377
378/*!
379 * \since 12
380 * \brief Set a variable on a CDR
381 *
382 * \param channel_name The channel to set the variable on
383 * \param name The name of the variable to set
384 * \param value The value of the variable to set
385 *
386 * \retval 0 on success
387 * \retval non-zero on failure
388 */
389int ast_cdr_setvar(const char *channel_name, const char *name, const char *value);
390
391/*!
392 * \since 12
393 * \brief Fork a CDR
394 *
395 * \param channel_name The name of the channel whose CDR should be forked
396 * \param options Options to control how the fork occurs.
397 *
398 * \retval 0 on success
399 * \retval -1 on failure
400 */
401int ast_cdr_fork(const char *channel_name, struct ast_flags *options);
402
403/*!
404 * \since 12
405 * \brief Set a property on a CDR for a channel
406 *
407 * This function sets specific administrative properties on a CDR for a channel.
408 * This includes properties like preventing a CDR from being dispatched, to
409 * setting the channel as the preferred Party A in future CDRs. See
410 * \ref ast_cdr_options for more information.
411 *
412 * \param channel_name The CDR's channel
413 * \param option Option to apply to the CDR
414 *
415 * \retval 0 on success
416 * \retval 1 on error
417 */
418int ast_cdr_set_property(const char *channel_name, enum ast_cdr_options option);
419
420/*!
421 * \since 12
422 * \brief Clear a property on a CDR for a channel
423 *
424 * Clears a flag previously set by \ref ast_cdr_set_property
425 *
426 * \param channel_name The CDR's channel
427 * \param option Option to clear from the CDR
428 *
429 * \retval 0 on success
430 * \retval 1 on error
431 */
432int ast_cdr_clear_property(const char *channel_name, enum ast_cdr_options option);
433
434/*!
435 * \brief Reset the detail record
436 * \param channel_name The channel that the CDR is associated with
437 * \param keep_variables Keep the variables during the reset. If zero,
438 * variables are discarded during the reset.
439 *
440 * \retval 0 on success
441 * \retval -1 on failure
442 */
443int ast_cdr_reset(const char *channel_name, int keep_variables);
444
445/*!
446 * \brief Serializes all the data and variables for a current CDR record
447 * \param channel_name The channel to get the CDR for
448 * \param buf A buffer to use for formatting the data
449 * \param delim A delimeter to use to separate variable keys/values
450 * \param sep A separator to use between nestings
451 * \return the total number of serialized variables
452 */
453int ast_cdr_serialize_variables(const char *channel_name, struct ast_str **buf, char delim, char sep);
454
455/*!
456 * \brief CDR backend callback
457 * \warning CDR backends should NOT attempt to access the channel associated
458 * with a CDR record. This channel is not guaranteed to exist when the CDR
459 * backend is invoked.
460 */
461typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
462
463/*! \brief Return TRUE if CDR subsystem is enabled */
464int ast_cdr_is_enabled(void);
465
466/*!
467 * \brief Allocate a CDR record
468 * \return a malloc'd ast_cdr structure
469 * \retval NULL on error (malloc failure)
470 */
471struct ast_cdr *ast_cdr_alloc(void);
472
474
475/*!
476 * \brief Return the message router for the CDR engine
477 *
478 * This returns the \ref stasis_message_router that the CDR engine
479 * uses for dispatching \ref stasis messages. The reference on the
480 * message router is bumped and must be released by the caller of
481 * this function.
482 *
483 * \retval NULL if the CDR engine is disabled or unavailable
484 * \return the \ref stasis_message_router otherwise
485 */
487
488/*!
489 * \brief Duplicate a public CDR
490 * \param cdr the record to duplicate
491 *
492 * \return a malloc'd ast_cdr structure,
493 * \retval NULL on error (malloc failure)
494 */
495struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr);
496
497/*!
498 * \brief Free a CDR record
499 * \param cdr ast_cdr structure to free
500 */
501void ast_cdr_free(struct ast_cdr *cdr);
502
503/*!
504 * \brief Register a CDR handling engine
505 * \param name name associated with the particular CDR handler
506 * \param desc description of the CDR handler
507 * \param be function pointer to a CDR handler
508 * Used to register a Call Detail Record handler.
509 * \retval 0 on success.
510 * \retval -1 on error
511 */
512int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be);
513
514/*!
515 * \brief Unregister a CDR handling engine
516 * \param name name of CDR handler to unregister
517 * Unregisters a CDR by it's name
518 *
519 * \retval 0 The backend unregistered successfully
520 * \retval -1 The backend could not be unregistered at this time
521 */
522int ast_cdr_unregister(const char *name);
523
524/*!
525 * \brief Suspend a CDR backend temporarily
526 *
527 * \retval 0 The backend is suspended
528 * \retval -1 The backend could not be suspended
529 */
530int ast_cdr_backend_suspend(const char *name);
531
532/*!
533 * \brief Unsuspend a CDR backend
534 *
535 * \retval 0 The backend was unsuspended
536 * \retval -1 The back could not be unsuspended
537 */
538int ast_cdr_backend_unsuspend(const char *name);
539
540/*!
541 * \brief Register a CDR modifier
542 * \param name name associated with the particular CDR modifier
543 * \param desc description of the CDR modifier
544 * \param be function pointer to a CDR modifier
545 *
546 * Used to register a Call Detail Record modifier.
547 *
548 * This gives modules a chance to modify CDR fields before they are dispatched
549 * to registered backends (odbc, syslog, etc).
550 *
551 * \note The *modified* CDR will be passed to **all** registered backends for
552 * logging. For instance, if cdr_manager changes the CDR data, cdr_adaptive_odbc
553 * will also get the modified CDR.
554 *
555 * \retval 0 on success.
556 * \retval -1 on error
557 */
558int ast_cdr_modifier_register(const char *name, const char *desc, ast_cdrbe be);
559
560/*!
561 * \brief Unregister a CDR modifier
562 * \param name name of CDR modifier to unregister
563 * Unregisters a CDR modifier by its name
564 *
565 * \retval 0 The modifier unregistered successfully
566 * \retval -1 The modifier could not be unregistered at this time
567 */
568int ast_cdr_modifier_unregister(const char *name);
569
570/*!
571 * \brief Disposition to a string
572 * \param disposition input binary form
573 * Converts the binary form of a disposition to string form.
574 * \return a pointer to the string form
575 */
576const char *ast_cdr_disp2str(int disposition);
577
578/*!
579 * \brief Set CDR user field for channel (stored in CDR)
580 *
581 * \param channel_name The name of the channel that owns the CDR
582 * \param userfield The user field to set
583 */
584void ast_cdr_setuserfield(const char *channel_name, const char *userfield);
585
586/*! Submit any remaining CDRs and prepare for shutdown */
587void ast_cdr_engine_term(void);
588
589#endif /* _ASTERISK_CDR_H */
int ast_cdr_is_enabled(void)
Return TRUE if CDR subsystem is enabled.
Definition: cdr.c:2923
void ast_cdr_setuserfield(const char *channel_name, const char *userfield)
Set CDR user field for channel (stored in CDR)
Definition: cdr.c:3539
int ast_cdr_modifier_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR modifier.
Definition: cdr.c:3010
void ast_cdr_free(struct ast_cdr *cdr)
Free a CDR record.
Definition: cdr.c:3473
ast_cdr_settings
CDR engine settings.
Definition: cdr.h:219
@ CDR_UNANSWERED
Definition: cdr.h:222
@ CDR_IGNORE_STATE_CHANGES
Definition: cdr.h:228
@ CDR_INITIATED_SECONDS
Definition: cdr.h:225
@ CDR_ENABLED
Definition: cdr.h:220
@ CDR_CHANNEL_DEFAULT_ENABLED
Definition: cdr.h:227
@ CDR_END_BEFORE_H_EXTEN
Definition: cdr.h:224
@ CDR_IGNORE_DIAL_CHANGES
Definition: cdr.h:229
@ CDR_BATCHMODE
Definition: cdr.h:221
@ CDR_CONGESTION
Definition: cdr.h:223
@ CDR_DEBUG
Definition: cdr.h:226
void ast_cdr_set_config(struct ast_cdr_config *config)
Set the current CDR configuration.
Definition: cdr.c:2902
ast_cdr_batch_mode_settings
CDR Batch Mode settings.
Definition: cdr.h:233
@ BATCH_MODE_SAFE_SHUTDOWN
Definition: cdr.h:235
@ BATCH_MODE_SCHEDULER_ONLY
Definition: cdr.h:234
struct stasis_message_router * ast_cdr_message_router(void)
Return the message router for the CDR engine.
Definition: cdr.c:4356
int ast_cdr_modifier_unregister(const char *name)
Unregister a CDR modifier.
Definition: cdr.c:3055
int ast_cdr_clear_property(const char *channel_name, enum ast_cdr_options option)
Clear a property on a CDR for a channel.
Definition: cdr.c:3637
int ast_cdr_setvar(const char *channel_name, const char *name, const char *value)
Set a variable on a CDR.
Definition: cdr.c:3240
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.
Definition: cdr.c:3112
ast_cdr_disposition
CDR Flags - Disposition.
Definition: cdr.h:256
@ AST_CDR_CONGESTION
Definition: cdr.h:262
@ AST_CDR_NULL
Definition: cdr.h:258
@ AST_CDR_NOANSWER
Definition: cdr.h:257
@ AST_CDR_ANSWERED
Definition: cdr.h:261
@ AST_CDR_BUSY
Definition: cdr.h:260
@ AST_CDR_FAILED
Definition: cdr.h:259
void ast_cdr_engine_term(void)
Definition: cdr.c:4665
struct ast_cdr * ast_cdr_alloc(void)
Allocate a CDR record.
Definition: cdr.c:3484
int(* ast_cdrbe)(struct ast_cdr *cdr)
CDR backend callback.
Definition: cdr.h:461
int ast_cdr_backend_unsuspend(const char *name)
Unsuspend a CDR backend.
Definition: cdr.c:2946
ast_cdr_options
CDR manipulation options. Certain function calls will manipulate the state of a CDR object based on t...
Definition: cdr.h:242
@ AST_CDR_FLAG_DISABLE_ALL
Definition: cdr.h:245
@ AST_CDR_LOCK_APP
Definition: cdr.h:250
@ AST_CDR_FLAG_FINALIZE
Definition: cdr.h:247
@ AST_CDR_FLAG_DISABLE
Definition: cdr.h:244
@ AST_CDR_FLAG_PARTY_A
Definition: cdr.h:246
@ AST_CDR_FLAG_KEEP_VARS
Definition: cdr.h:243
@ AST_CDR_FLAG_RESET
Definition: cdr.h:249
@ AST_CDR_FLAG_SET_ANSWER
Definition: cdr.h:248
int ast_cdr_fork(const char *channel_name, struct ast_flags *options)
Fork a CDR.
Definition: cdr.c:3699
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.
Definition: cdr.c:3386
int ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
Definition: cdr.c:3050
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.
Definition: cdr.c:3415
const char * ast_cdr_disp2str(int disposition)
Disposition to a string.
Definition: cdr.c:3492
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR handling engine.
Definition: cdr.c:3005
int ast_cdr_backend_suspend(const char *name)
Suspend a CDR backend temporarily.
Definition: cdr.c:2928
struct ast_cdr_config * ast_cdr_get_config(void)
Obtain the current CDR configuration.
Definition: cdr.c:2888
struct ast_cdr * ast_cdr_dup(struct ast_cdr *cdr)
Duplicate a public CDR.
Definition: cdr.c:3060
int ast_cdr_reset(const char *channel_name, int keep_variables)
Reset the detail record.
Definition: cdr.c:3660
int ast_cdr_set_property(const char *channel_name, enum ast_cdr_options option)
Set a property on a CDR for a channel.
Definition: cdr.c:3610
static const char desc[]
Definition: cdr_radius.c:84
static const char config[]
Definition: chan_ooh323.c:111
General Asterisk PBX channel definitions.
#define AST_MAX_ACCOUNT_CODE
Definition: channel.h:170
#define AST_MAX_UNIQUEID
Definition: channel.h:168
#define AST_MAX_USER_FIELD
Definition: channel.h:174
#define AST_MAX_EXTENSION
Definition: channel.h:134
char * be
Definition: eagi_proxy.c:73
char buf[BUFSIZE]
Definition: eagi_proxy.c:66
static const char name[]
Definition: format_mp3.c:68
struct ast_flags settings
Definition: cdr.h:272
The global options available for CDRs.
Definition: cdr.h:267
struct ast_flags settings
Definition: cdr.h:268
struct ast_cdr_config::batch_settings batch_settings
Responsible for call detail data.
Definition: cdr.h:279
char dstchannel[AST_MAX_EXTENSION]
Definition: cdr.h:291
long int disposition
Definition: cdr.h:307
char lastdata[AST_MAX_EXTENSION]
Definition: cdr.h:295
char linkedid[AST_MAX_UNIQUEID]
Definition: cdr.h:319
char userfield[AST_MAX_USER_FIELD]
Definition: cdr.h:321
long int billsec
Definition: cdr.h:305
struct timeval answer
Definition: cdr.h:299
char channel[AST_MAX_EXTENSION]
Definition: cdr.h:289
char peeraccount[AST_MAX_ACCOUNT_CODE]
Definition: cdr.h:313
struct ast_cdr * next
Definition: cdr.h:328
long int duration
Definition: cdr.h:303
long int amaflags
Definition: cdr.h:309
char src[AST_MAX_EXTENSION]
Definition: cdr.h:283
char dst[AST_MAX_EXTENSION]
Definition: cdr.h:285
char clid[AST_MAX_EXTENSION]
Definition: cdr.h:281
char uniqueid[AST_MAX_UNIQUEID]
Definition: cdr.h:317
unsigned int flags
Definition: cdr.h:315
int sequence
Definition: cdr.h:323
struct timeval start
Definition: cdr.h:297
char accountcode[AST_MAX_ACCOUNT_CODE]
Definition: cdr.h:311
char lastapp[AST_MAX_EXTENSION]
Definition: cdr.h:293
char dcontext[AST_MAX_EXTENSION]
Definition: cdr.h:287
struct timeval end
Definition: cdr.h:301
Structure used to handle boolean flags.
Definition: utils.h:199
Support for dynamic strings.
Definition: strings.h:623
int value
Definition: syslog.c:37
static struct test_options options