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