Asterisk - The Open Source Telephony Project GIT-master-77d630f
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 CDR_CANCEL_DISPOSITION_ENABLED = 1 << 10, /*!< Whether to enable CANCEL disposition in CDR */
231};
232
233/*! \brief CDR Batch Mode settings */
235 BATCH_MODE_SCHEDULER_ONLY = 1 << 0, /*!< Don't spawn a thread to handle the batches - do it on the scheduler */
236 BATCH_MODE_SAFE_SHUTDOWN = 1 << 1, /*!< During safe shutdown, submit the batched CDRs */
237};
238
239/*!
240 * \brief CDR manipulation options. Certain function calls will manipulate the
241 * state of a CDR object based on these flags.
242 */
244 AST_CDR_FLAG_KEEP_VARS = (1 << 0), /*!< Copy variables during the operation */
245 AST_CDR_FLAG_DISABLE = (1 << 1), /*!< Disable the current CDR */
246 AST_CDR_FLAG_DISABLE_ALL = (3 << 1), /*!< Disable the CDR and all future CDRs */
247 AST_CDR_FLAG_PARTY_A = (1 << 3), /*!< Set the channel as party A */
248 AST_CDR_FLAG_FINALIZE = (1 << 4), /*!< Finalize the current CDRs */
249 AST_CDR_FLAG_SET_ANSWER = (1 << 5), /*!< If the channel is answered, set the answer time to now */
250 AST_CDR_FLAG_RESET = (1 << 6), /*!< If set, set the start and answer time to now */
251 AST_CDR_LOCK_APP = (1 << 7), /*!< Prevent any further changes to the application field/data field for this CDR */
252};
253
254/*!
255 * \brief CDR Flags - Disposition
256 */
259 AST_CDR_NULL = (1 << 0),
260 AST_CDR_FAILED = (1 << 1),
261 AST_CDR_BUSY = (1 << 2),
264 AST_CDR_CANCEL = (1 << 5),
265};
266
267
268/*! \brief The global options available for CDRs */
270 struct ast_flags settings; /*!< CDR settings */
272 unsigned int time; /*!< Time between batches */
273 unsigned int size; /*!< Size to trigger a batch */
274 struct ast_flags settings; /*!< Settings for batches */
276};
277
278/*!
279 * \brief Responsible for call detail data
280 */
281struct ast_cdr {
282 /*! Caller*ID with text */
284 /*! Caller*ID number */
286 /*! Destination extension */
288 /*! Destination context */
290
292 /*! Destination channel if appropriate */
294 /*! Last application if appropriate */
296 /*! Last application data */
298
299 struct timeval start;
300
301 struct timeval answer;
302
303 struct timeval end;
304 /*! Total time in system, in seconds */
305 long int duration;
306 /*! Total time call is up, in seconds */
307 long int billsec;
308 /*! What happened to the call */
309 long int disposition;
310 /*! What flags to use */
311 long int amaflags;
312 /*! What account number to use */
314 /*! Account number of the last person we talked to */
316 /*! flags */
317 unsigned int flags;
318 /*! Unique Channel Identifier */
320 /*! Linked group Identifier */
322 /*! Channel tenant Identifier */
324 /*! Channel tenant Identifier of the last person we talked to */
326 /*! User field */
328 /*! Sequence field */
330
331 /*! A linked list for variables */
333
334 struct ast_cdr *next;
335};
336
337/*!
338 * \since 12
339 * \brief Obtain the current CDR configuration
340 *
341 * The configuration is a ref counted object. The caller of this function must
342 * decrement the ref count when finished with the configuration.
343 *
344 * \retval NULL on error
345 * \return The current CDR configuration
346 */
348
349/*!
350 * \since 12
351 * \brief Set the current CDR configuration
352 *
353 * \param config The new CDR configuration
354 */
356
357/*!
358 * \since 12
359 * \brief Format a CDR variable from an already posted CDR
360 *
361 * \param cdr The dispatched CDR to process
362 * \param name The name of the variable
363 * \param ret Pointer to the formatted buffer
364 * \param workspace A pointer to the buffer to use to format the variable
365 * \param workspacelen The size of \p workspace
366 * \param raw If non-zero and a date/time is extracted, provide epoch seconds. Otherwise format as a date/time stamp
367 */
368void ast_cdr_format_var(struct ast_cdr *cdr, const char *name, char **ret, char *workspace, int workspacelen, int raw);
369
370/*!
371 * \since 12
372 * \brief Retrieve a CDR variable from a channel's current CDR
373 *
374 * \param channel_name The name of the party A channel that the CDR is associated with
375 * \param name The name of the variable to retrieve
376 * \param value Buffer to hold the value
377 * \param length The size of the buffer
378 *
379 * \retval 0 on success
380 * \retval non-zero on failure
381 */
382int ast_cdr_getvar(const char *channel_name, const char *name, char *value, size_t length);
383
384/*!
385 * \since 12
386 * \brief Set a variable on a CDR
387 *
388 * \param channel_name The channel to set the variable on
389 * \param name The name of the variable to set
390 * \param value The value of the variable to set
391 *
392 * \retval 0 on success
393 * \retval non-zero on failure
394 */
395int ast_cdr_setvar(const char *channel_name, const char *name, const char *value);
396
397/*!
398 * \since 12
399 * \brief Fork a CDR
400 *
401 * \param channel_name The name of the channel whose CDR should be forked
402 * \param options Options to control how the fork occurs.
403 *
404 * \retval 0 on success
405 * \retval -1 on failure
406 */
407int ast_cdr_fork(const char *channel_name, struct ast_flags *options);
408
409/*!
410 * \since 12
411 * \brief Set a property on a CDR for a channel
412 *
413 * This function sets specific administrative properties on a CDR for a channel.
414 * This includes properties like preventing a CDR from being dispatched, to
415 * setting the channel as the preferred Party A in future CDRs. See
416 * \ref ast_cdr_options for more information.
417 *
418 * \param channel_name The CDR's channel
419 * \param option Option to apply to the CDR
420 *
421 * \retval 0 on success
422 * \retval 1 on error
423 */
424int ast_cdr_set_property(const char *channel_name, enum ast_cdr_options option);
425
426/*!
427 * \since 12
428 * \brief Clear a property on a CDR for a channel
429 *
430 * Clears a flag previously set by \ref ast_cdr_set_property
431 *
432 * \param channel_name The CDR's channel
433 * \param option Option to clear from the CDR
434 *
435 * \retval 0 on success
436 * \retval 1 on error
437 */
438int ast_cdr_clear_property(const char *channel_name, enum ast_cdr_options option);
439
440/*!
441 * \brief Reset the detail record
442 * \param channel_name The channel that the CDR is associated with
443 * \param keep_variables Keep the variables during the reset. If zero,
444 * variables are discarded during the reset.
445 *
446 * \retval 0 on success
447 * \retval -1 on failure
448 */
449int ast_cdr_reset(const char *channel_name, int keep_variables);
450
451/*!
452 * \brief Serializes all the data and variables for a current CDR record
453 * \param channel_name The channel to get the CDR for
454 * \param buf A buffer to use for formatting the data
455 * \param delim A delimeter to use to separate variable keys/values
456 * \param sep A separator to use between nestings
457 * \return the total number of serialized variables
458 */
459int ast_cdr_serialize_variables(const char *channel_name, struct ast_str **buf, char delim, char sep);
460
461/*!
462 * \brief CDR backend callback
463 * \warning CDR backends should NOT attempt to access the channel associated
464 * with a CDR record. This channel is not guaranteed to exist when the CDR
465 * backend is invoked.
466 */
467typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
468
469/*! \brief Return TRUE if CDR subsystem is enabled */
470int ast_cdr_is_enabled(void);
471
472/*!
473 * \brief Allocate a CDR record
474 * \return a malloc'd ast_cdr structure
475 * \retval NULL on error (malloc failure)
476 */
477struct ast_cdr *ast_cdr_alloc(void);
478
480
481/*!
482 * \brief Return the message router for the CDR engine
483 *
484 * This returns the \ref stasis_message_router that the CDR engine
485 * uses for dispatching \ref stasis messages. The reference on the
486 * message router is bumped and must be released by the caller of
487 * this function.
488 *
489 * \retval NULL if the CDR engine is disabled or unavailable
490 * \return the \ref stasis_message_router otherwise
491 */
493
494/*!
495 * \brief Duplicate a public CDR
496 * \param cdr the record to duplicate
497 *
498 * \return a malloc'd ast_cdr structure,
499 * \retval NULL on error (malloc failure)
500 */
501struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr);
502
503/*!
504 * \brief Free a CDR record
505 * \param cdr ast_cdr structure to free
506 */
507void ast_cdr_free(struct ast_cdr *cdr);
508
509/*!
510 * \brief Register a CDR handling engine
511 * \param name name associated with the particular CDR handler
512 * \param desc description of the CDR handler
513 * \param be function pointer to a CDR handler
514 * Used to register a Call Detail Record handler.
515 * \retval 0 on success.
516 * \retval -1 on error
517 */
518int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be);
519
520/*!
521 * \brief Unregister a CDR handling engine
522 * \param name name of CDR handler to unregister
523 * Unregisters a CDR by it's name
524 *
525 * \retval 0 The backend unregistered successfully
526 * \retval -1 The backend could not be unregistered at this time
527 */
528int ast_cdr_unregister(const char *name);
529
530/*!
531 * \brief Suspend a CDR backend temporarily
532 *
533 * \retval 0 The backend is suspended
534 * \retval -1 The backend could not be suspended
535 */
536int ast_cdr_backend_suspend(const char *name);
537
538/*!
539 * \brief Unsuspend a CDR backend
540 *
541 * \retval 0 The backend was unsuspended
542 * \retval -1 The back could not be unsuspended
543 */
544int ast_cdr_backend_unsuspend(const char *name);
545
546/*!
547 * \brief Register a CDR modifier
548 * \param name name associated with the particular CDR modifier
549 * \param desc description of the CDR modifier
550 * \param be function pointer to a CDR modifier
551 *
552 * Used to register a Call Detail Record modifier.
553 *
554 * This gives modules a chance to modify CDR fields before they are dispatched
555 * to registered backends (odbc, syslog, etc).
556 *
557 * \note The *modified* CDR will be passed to **all** registered backends for
558 * logging. For instance, if cdr_manager changes the CDR data, cdr_adaptive_odbc
559 * will also get the modified CDR.
560 *
561 * \retval 0 on success.
562 * \retval -1 on error
563 */
564int ast_cdr_modifier_register(const char *name, const char *desc, ast_cdrbe be);
565
566/*!
567 * \brief Unregister a CDR modifier
568 * \param name name of CDR modifier to unregister
569 * Unregisters a CDR modifier by its name
570 *
571 * \retval 0 The modifier unregistered successfully
572 * \retval -1 The modifier could not be unregistered at this time
573 */
574int ast_cdr_modifier_unregister(const char *name);
575
576/*!
577 * \brief Disposition to a string
578 * \param disposition input binary form
579 * Converts the binary form of a disposition to string form.
580 * \return a pointer to the string form
581 */
582const char *ast_cdr_disp2str(int disposition);
583
584/*!
585 * \brief Set CDR user field for channel (stored in CDR)
586 *
587 * \param channel_name The name of the channel that owns the CDR
588 * \param userfield The user field to set
589 */
590void ast_cdr_setuserfield(const char *channel_name, const char *userfield);
591
592/*! Submit any remaining CDRs and prepare for shutdown */
593void ast_cdr_engine_term(void);
594
595#endif /* _ASTERISK_CDR_H */
int ast_cdr_is_enabled(void)
Return TRUE if CDR subsystem is enabled.
Definition: cdr.c:2994
void ast_cdr_setuserfield(const char *channel_name, const char *userfield)
Set CDR user field for channel (stored in CDR)
Definition: cdr.c:3625
int ast_cdr_modifier_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR modifier.
Definition: cdr.c:3081
void ast_cdr_free(struct ast_cdr *cdr)
Free a CDR record.
Definition: cdr.c:3557
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_CANCEL_DISPOSITION_ENABLED
Definition: cdr.h:230
@ 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:2973
ast_cdr_batch_mode_settings
CDR Batch Mode settings.
Definition: cdr.h:234
@ BATCH_MODE_SAFE_SHUTDOWN
Definition: cdr.h:236
@ BATCH_MODE_SCHEDULER_ONLY
Definition: cdr.h:235
struct stasis_message_router * ast_cdr_message_router(void)
Return the message router for the CDR engine.
Definition: cdr.c:4443
int ast_cdr_modifier_unregister(const char *name)
Unregister a CDR modifier.
Definition: cdr.c:3126
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:3723
int ast_cdr_setvar(const char *channel_name, const char *name, const char *value)
Set a variable on a CDR.
Definition: cdr.c:3316
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:3183
ast_cdr_disposition
CDR Flags - Disposition.
Definition: cdr.h:257
@ AST_CDR_CONGESTION
Definition: cdr.h:263
@ AST_CDR_NULL
Definition: cdr.h:259
@ AST_CDR_NOANSWER
Definition: cdr.h:258
@ AST_CDR_ANSWERED
Definition: cdr.h:262
@ AST_CDR_CANCEL
Definition: cdr.h:264
@ AST_CDR_BUSY
Definition: cdr.h:261
@ AST_CDR_FAILED
Definition: cdr.h:260
void ast_cdr_engine_term(void)
Definition: cdr.c:4753
struct ast_cdr * ast_cdr_alloc(void)
Allocate a CDR record.
Definition: cdr.c:3568
int(* ast_cdrbe)(struct ast_cdr *cdr)
CDR backend callback.
Definition: cdr.h:467
int ast_cdr_backend_unsuspend(const char *name)
Unsuspend a CDR backend.
Definition: cdr.c:3017
ast_cdr_options
CDR manipulation options. Certain function calls will manipulate the state of a CDR object based on t...
Definition: cdr.h:243
@ AST_CDR_FLAG_DISABLE_ALL
Definition: cdr.h:246
@ AST_CDR_LOCK_APP
Definition: cdr.h:251
@ AST_CDR_FLAG_FINALIZE
Definition: cdr.h:248
@ AST_CDR_FLAG_DISABLE
Definition: cdr.h:245
@ AST_CDR_FLAG_PARTY_A
Definition: cdr.h:247
@ AST_CDR_FLAG_KEEP_VARS
Definition: cdr.h:244
@ AST_CDR_FLAG_RESET
Definition: cdr.h:250
@ AST_CDR_FLAG_SET_ANSWER
Definition: cdr.h:249
int ast_cdr_fork(const char *channel_name, struct ast_flags *options)
Fork a CDR.
Definition: cdr.c:3785
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:3470
int ast_cdr_unregister(const char *name)
Unregister a CDR handling engine.
Definition: cdr.c:3121
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:3499
const char * ast_cdr_disp2str(int disposition)
Disposition to a string.
Definition: cdr.c:3576
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be)
Register a CDR handling engine.
Definition: cdr.c:3076
int ast_cdr_backend_suspend(const char *name)
Suspend a CDR backend temporarily.
Definition: cdr.c:2999
struct ast_cdr_config * ast_cdr_get_config(void)
Obtain the current CDR configuration.
Definition: cdr.c:2959
struct ast_cdr * ast_cdr_dup(struct ast_cdr *cdr)
Duplicate a public CDR.
Definition: cdr.c:3131
int ast_cdr_reset(const char *channel_name, int keep_variables)
Reset the detail record.
Definition: cdr.c:3746
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:3696
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:172
#define AST_MAX_TENANT_ID
Definition: channel.h:149
#define AST_MAX_UNIQUEID
Definition: channel.h:170
#define AST_MAX_USER_FIELD
Definition: channel.h:176
#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:274
The global options available for CDRs.
Definition: cdr.h:269
struct ast_flags settings
Definition: cdr.h:270
struct ast_cdr_config::batch_settings batch_settings
Responsible for call detail data.
Definition: cdr.h:281
char dstchannel[AST_MAX_EXTENSION]
Definition: cdr.h:293
long int disposition
Definition: cdr.h:309
char lastdata[AST_MAX_EXTENSION]
Definition: cdr.h:297
char linkedid[AST_MAX_UNIQUEID]
Definition: cdr.h:321
char userfield[AST_MAX_USER_FIELD]
Definition: cdr.h:327
char peertenantid[AST_MAX_TENANT_ID]
Definition: cdr.h:325
long int billsec
Definition: cdr.h:307
struct timeval answer
Definition: cdr.h:301
char channel[AST_MAX_EXTENSION]
Definition: cdr.h:291
char peeraccount[AST_MAX_ACCOUNT_CODE]
Definition: cdr.h:315
struct ast_cdr * next
Definition: cdr.h:334
long int duration
Definition: cdr.h:305
long int amaflags
Definition: cdr.h:311
char src[AST_MAX_EXTENSION]
Definition: cdr.h:285
char dst[AST_MAX_EXTENSION]
Definition: cdr.h:287
char clid[AST_MAX_EXTENSION]
Definition: cdr.h:283
char uniqueid[AST_MAX_UNIQUEID]
Definition: cdr.h:319
unsigned int flags
Definition: cdr.h:317
char tenantid[AST_MAX_TENANT_ID]
Definition: cdr.h:323
int sequence
Definition: cdr.h:329
struct timeval start
Definition: cdr.h:299
char accountcode[AST_MAX_ACCOUNT_CODE]
Definition: cdr.h:313
char lastapp[AST_MAX_EXTENSION]
Definition: cdr.h:295
char dcontext[AST_MAX_EXTENSION]
Definition: cdr.h:289
struct timeval end
Definition: cdr.h:303
Structure used to handle boolean flags.
Definition: utils.h:217
Support for dynamic strings.
Definition: strings.h:623
int value
Definition: syslog.c:37
static struct test_options options