Trim trailing whitespace, convert lists of defines to enums

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@249050 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.6
Russell Bryant 16 years ago
parent 1f2f5fadcc
commit 53bf191569

@ -16,8 +16,11 @@
* at the top of the source tree. * at the top of the source tree.
*/ */
/*! \file /*!
* \brief Call Detail Record API * \file
* \brief Call Detail Record API
*
* \author Mark Spencer <markster@digium.com>
*/ */
#ifndef _ASTERISK_CDR_H #ifndef _ASTERISK_CDR_H
@ -25,74 +28,82 @@
#include <sys/time.h> #include <sys/time.h>
/*! \name CDR Flags */ /*!
/*@{ */ * \brief CDR Flags
#define AST_CDR_FLAG_KEEP_VARS (1 << 0) */
#define AST_CDR_FLAG_POSTED (1 << 1) enum {
#define AST_CDR_FLAG_LOCKED (1 << 2) AST_CDR_FLAG_KEEP_VARS = (1 << 0),
#define AST_CDR_FLAG_CHILD (1 << 3) AST_CDR_FLAG_POSTED = (1 << 1),
#define AST_CDR_FLAG_POST_DISABLED (1 << 4) AST_CDR_FLAG_LOCKED = (1 << 2),
#define AST_CDR_FLAG_BRIDGED (1 << 5) AST_CDR_FLAG_CHILD = (1 << 3),
#define AST_CDR_FLAG_MAIN (1 << 6) AST_CDR_FLAG_POST_DISABLED = (1 << 4),
#define AST_CDR_FLAG_ENABLE (1 << 7) AST_CDR_FLAG_BRIDGED = (1 << 5),
#define AST_CDR_FLAG_ANSLOCKED (1 << 8) AST_CDR_FLAG_MAIN = (1 << 6),
#define AST_CDR_FLAG_DONT_TOUCH (1 << 9) AST_CDR_FLAG_ENABLE = (1 << 7),
#define AST_CDR_FLAG_POST_ENABLE (1 << 10) AST_CDR_FLAG_ANSLOCKED = (1 << 8),
#define AST_CDR_FLAG_DIALED (1 << 11) AST_CDR_FLAG_DONT_TOUCH = (1 << 9),
#define AST_CDR_FLAG_ORIGINATED (1 << 12) AST_CDR_FLAG_POST_ENABLE = (1 << 10),
/*@} */ AST_CDR_FLAG_DIALED = (1 << 11),
AST_CDR_FLAG_ORIGINATED = (1 << 12),
/*! \name CDR Flags - Disposition */ };
/*@{ */
#define AST_CDR_NOANSWER 0 /*!
#define AST_CDR_NULL (1 << 0) * \brief CDR Flags - Disposition
#define AST_CDR_FAILED (1 << 1) */
#define AST_CDR_BUSY (1 << 2) enum {
#define AST_CDR_ANSWERED (1 << 3) AST_CDR_NOANSWER = 0,
/*@} */ AST_CDR_NULL = (1 << 0),
AST_CDR_FAILED = (1 << 1),
/*! \name CDR AMA Flags */ AST_CDR_BUSY = (1 << 2),
/*@{ */ AST_CDR_ANSWERED = (1 << 3),
#define AST_CDR_OMIT (1) };
#define AST_CDR_BILLING (2)
#define AST_CDR_DOCUMENTATION (3) /*!
/*@} */ * \brief CDR AMA Flags
*/
#define AST_MAX_USER_FIELD 256 enum {
#define AST_MAX_ACCOUNT_CODE 20 AST_CDR_OMIT = 1,
AST_CDR_BILLING = 2,
AST_CDR_DOCUMENTATION = 3,
};
#define AST_MAX_USER_FIELD 256
#define AST_MAX_ACCOUNT_CODE 20
/* Include channel.h after relevant declarations it will need */ /* Include channel.h after relevant declarations it will need */
#include "asterisk/channel.h" #include "asterisk/channel.h"
#include "asterisk/utils.h" #include "asterisk/utils.h"
/*! \brief Responsible for call detail data */ /*!
* \brief Responsible for call detail data
*/
struct ast_cdr { struct ast_cdr {
/*! Caller*ID with text */ /*! Caller*ID with text */
char clid[AST_MAX_EXTENSION]; char clid[AST_MAX_EXTENSION];
/*! Caller*ID number */ /*! Caller*ID number */
char src[AST_MAX_EXTENSION]; char src[AST_MAX_EXTENSION];
/*! Destination extension */ /*! Destination extension */
char dst[AST_MAX_EXTENSION]; char dst[AST_MAX_EXTENSION];
/*! Destination context */ /*! Destination context */
char dcontext[AST_MAX_EXTENSION]; char dcontext[AST_MAX_EXTENSION];
char channel[AST_MAX_EXTENSION]; char channel[AST_MAX_EXTENSION];
/*! Destination channel if appropriate */ /*! Destination channel if appropriate */
char dstchannel[AST_MAX_EXTENSION]; char dstchannel[AST_MAX_EXTENSION];
/*! Last application if appropriate */ /*! Last application if appropriate */
char lastapp[AST_MAX_EXTENSION]; char lastapp[AST_MAX_EXTENSION];
/*! Last application data */ /*! Last application data */
char lastdata[AST_MAX_EXTENSION]; char lastdata[AST_MAX_EXTENSION];
struct timeval start; struct timeval start;
struct timeval answer; struct timeval answer;
struct timeval end; struct timeval end;
/*! Total time in system, in seconds */ /*! Total time in system, in seconds */
long int duration; long int duration;
/*! Total time call is up, in seconds */ /*! Total time call is up, in seconds */
long int billsec; long int billsec;
/*! What happened to the call */ /*! What happened to the call */
long int disposition; long int disposition;
/*! What flags to use */ /*! What flags to use */
@ -137,28 +148,28 @@ typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
/*! \brief Return TRUE if CDR subsystem is enabled */ /*! \brief Return TRUE if CDR subsystem is enabled */
int check_cdr_enabled(void); int check_cdr_enabled(void);
/*! /*!
* \brief Allocate a CDR record * \brief Allocate a CDR record
* \retval a malloc'd ast_cdr structure * \retval a malloc'd ast_cdr structure
* \retval NULL on error (malloc failure) * \retval NULL on error (malloc failure)
*/ */
struct ast_cdr *ast_cdr_alloc(void); struct ast_cdr *ast_cdr_alloc(void);
/*! /*!
* \brief Duplicate a record and increment the sequence number. * \brief Duplicate a record and increment the sequence number.
* \param cdr the record to duplicate * \param cdr the record to duplicate
* \retval a malloc'd ast_cdr structure, * \retval a malloc'd ast_cdr structure,
* \retval NULL on error (malloc failure) * \retval NULL on error (malloc failure)
* \see ast_cdr_dup() * \see ast_cdr_dup()
* \see ast_cdr_dup_unique_swap() * \see ast_cdr_dup_unique_swap()
*/ */
struct ast_cdr *ast_cdr_dup_unique(struct ast_cdr *cdr); struct ast_cdr *ast_cdr_dup_unique(struct ast_cdr *cdr);
/*! /*!
* \brief Duplicate a record and increment the sequence number of the old * \brief Duplicate a record and increment the sequence number of the old
* record. * record.
* \param cdr the record to duplicate * \param cdr the record to duplicate
* \retval a malloc'd ast_cdr structure, * \retval a malloc'd ast_cdr structure,
* \retval NULL on error (malloc failure) * \retval NULL on error (malloc failure)
* \note This version increments the original CDR's sequence number rather than * \note This version increments the original CDR's sequence number rather than
* the duplicate's sequence number. The effect is as if the original CDR's * the duplicate's sequence number. The effect is as if the original CDR's
@ -169,31 +180,31 @@ struct ast_cdr *ast_cdr_dup_unique(struct ast_cdr *cdr);
*/ */
struct ast_cdr *ast_cdr_dup_unique_swap(struct ast_cdr *cdr); struct ast_cdr *ast_cdr_dup_unique_swap(struct ast_cdr *cdr);
/*! /*!
* \brief Duplicate a record * \brief Duplicate a record
* \param cdr the record to duplicate * \param cdr the record to duplicate
* \retval a malloc'd ast_cdr structure, * \retval a malloc'd ast_cdr structure,
* \retval NULL on error (malloc failure) * \retval NULL on error (malloc failure)
* \see ast_cdr_dup_unique() * \see ast_cdr_dup_unique()
* \see ast_cdr_dup_unique_swap() * \see ast_cdr_dup_unique_swap()
*/ */
struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr); struct ast_cdr *ast_cdr_dup(struct ast_cdr *cdr);
/*! /*!
* \brief Free a CDR record * \brief Free a CDR record
* \param cdr ast_cdr structure to free * \param cdr ast_cdr structure to free
* Returns nothing * Returns nothing
*/ */
void ast_cdr_free(struct ast_cdr *cdr); void ast_cdr_free(struct ast_cdr *cdr);
/*! /*!
* \brief Discard and free a CDR record * \brief Discard and free a CDR record
* \param cdr ast_cdr structure to free * \param cdr ast_cdr structure to free
* Returns nothing -- same as free, but no checks or complaints * Returns nothing -- same as free, but no checks or complaints
*/ */
void ast_cdr_discard(struct ast_cdr *cdr); void ast_cdr_discard(struct ast_cdr *cdr);
/*! /*!
* \brief Initialize based on a channel * \brief Initialize based on a channel
* \param cdr Call Detail Record to use for channel * \param cdr Call Detail Record to use for channel
* \param chan Channel to bind CDR with * \param chan Channel to bind CDR with
@ -202,8 +213,8 @@ void ast_cdr_discard(struct ast_cdr *cdr);
*/ */
int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan); int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
/*! /*!
* \brief Initialize based on a channel * \brief Initialize based on a channel
* \param cdr Call Detail Record to use for channel * \param cdr Call Detail Record to use for channel
* \param chan Channel to bind CDR with * \param chan Channel to bind CDR with
* Initializes a CDR and associates it with a particular channel * Initializes a CDR and associates it with a particular channel
@ -211,8 +222,8 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *chan);
*/ */
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan); int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
/*! /*!
* \brief Register a CDR handling engine * \brief Register a CDR handling engine
* \param name name associated with the particular CDR handler * \param name name associated with the particular CDR handler
* \param desc description of the CDR handler * \param desc description of the CDR handler
* \param be function pointer to a CDR handler * \param be function pointer to a CDR handler
@ -222,30 +233,30 @@ int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *chan);
*/ */
int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be); int ast_cdr_register(const char *name, const char *desc, ast_cdrbe be);
/*! /*!
* \brief Unregister a CDR handling engine * \brief Unregister a CDR handling engine
* \param name name of CDR handler to unregister * \param name name of CDR handler to unregister
* Unregisters a CDR by it's name * Unregisters a CDR by it's name
*/ */
void ast_cdr_unregister(const char *name); void ast_cdr_unregister(const char *name);
/*! /*!
* \brief Start a call * \brief Start a call
* \param cdr the cdr you wish to associate with the call * \param cdr the cdr you wish to associate with the call
* Starts all CDR stuff necessary for monitoring a call * Starts all CDR stuff necessary for monitoring a call
* Returns nothing * Returns nothing
*/ */
void ast_cdr_start(struct ast_cdr *cdr); void ast_cdr_start(struct ast_cdr *cdr);
/*! \brief Answer a call /*! \brief Answer a call
* \param cdr the cdr you wish to associate with the call * \param cdr the cdr you wish to associate with the call
* Starts all CDR stuff necessary for doing CDR when answering a call * Starts all CDR stuff necessary for doing CDR when answering a call
* \note NULL argument is just fine. * \note NULL argument is just fine.
*/ */
void ast_cdr_answer(struct ast_cdr *cdr); void ast_cdr_answer(struct ast_cdr *cdr);
/*! /*!
* \brief A call wasn't answered * \brief A call wasn't answered
* \param cdr the cdr you wish to associate with the call * \param cdr the cdr you wish to associate with the call
* Marks the channel disposition as "NO ANSWER" * Marks the channel disposition as "NO ANSWER"
* Will skip CDR's in chain with ANS_LOCK bit set. (see * Will skip CDR's in chain with ANS_LOCK bit set. (see
@ -253,8 +264,8 @@ void ast_cdr_answer(struct ast_cdr *cdr);
*/ */
extern void ast_cdr_noanswer(struct ast_cdr *cdr); extern void ast_cdr_noanswer(struct ast_cdr *cdr);
/*! /*!
* \brief Busy a call * \brief Busy a call
* \param cdr the cdr you wish to associate with the call * \param cdr the cdr you wish to associate with the call
* Marks the channel disposition as "BUSY" * Marks the channel disposition as "BUSY"
* Will skip CDR's in chain with ANS_LOCK bit set. (see * Will skip CDR's in chain with ANS_LOCK bit set. (see
@ -263,8 +274,8 @@ extern void ast_cdr_noanswer(struct ast_cdr *cdr);
*/ */
void ast_cdr_busy(struct ast_cdr *cdr); void ast_cdr_busy(struct ast_cdr *cdr);
/*! /*!
* \brief Fail a call * \brief Fail a call
* \param cdr the cdr you wish to associate with the call * \param cdr the cdr you wish to associate with the call
* Marks the channel disposition as "FAILED" * Marks the channel disposition as "FAILED"
* Will skip CDR's in chain with ANS_LOCK bit set. (see * Will skip CDR's in chain with ANS_LOCK bit set. (see
@ -273,15 +284,15 @@ void ast_cdr_busy(struct ast_cdr *cdr);
*/ */
void ast_cdr_failed(struct ast_cdr *cdr); void ast_cdr_failed(struct ast_cdr *cdr);
/*! /*!
* \brief Save the result of the call based on the AST_CAUSE_* * \brief Save the result of the call based on the AST_CAUSE_*
* \param cdr the cdr you wish to associate with the call * \param cdr the cdr you wish to associate with the call
* \param cause the AST_CAUSE_* * \param cause the AST_CAUSE_*
* Returns nothing * Returns nothing
*/ */
int ast_cdr_disposition(struct ast_cdr *cdr, int cause); int ast_cdr_disposition(struct ast_cdr *cdr, int cause);
/*! /*!
* \brief End a call * \brief End a call
* \param cdr the cdr you have associated the call with * \param cdr the cdr you have associated the call with
* Registers the end of call time in the cdr structure. * Registers the end of call time in the cdr structure.
@ -289,7 +300,7 @@ int ast_cdr_disposition(struct ast_cdr *cdr, int cause);
*/ */
void ast_cdr_end(struct ast_cdr *cdr); void ast_cdr_end(struct ast_cdr *cdr);
/*! /*!
* \brief Detaches the detail record for posting (and freeing) either now or at a * \brief Detaches the detail record for posting (and freeing) either now or at a
* later time in bulk with other records during batch mode operation. * later time in bulk with other records during batch mode operation.
* \param cdr Which CDR to detach from the channel thread * \param cdr Which CDR to detach from the channel thread
@ -298,16 +309,16 @@ void ast_cdr_end(struct ast_cdr *cdr);
*/ */
void ast_cdr_detach(struct ast_cdr *cdr); void ast_cdr_detach(struct ast_cdr *cdr);
/*! /*!
* \brief Spawns (possibly) a new thread to submit a batch of CDRs to the backend engines * \brief Spawns (possibly) a new thread to submit a batch of CDRs to the backend engines
* \param shutdown Whether or not we are shutting down * \param shutdown Whether or not we are shutting down
* Blocks the asterisk shutdown procedures until the CDR data is submitted. * Blocks the asterisk shutdown procedures until the CDR data is submitted.
* Returns nothing * Returns nothing
*/ */
void ast_cdr_submit_batch(int shutdown); void ast_cdr_submit_batch(int shutdown);
/*! /*!
* \brief Set the destination channel, if there was one * \brief Set the destination channel, if there was one
* \param cdr Which cdr it's applied to * \param cdr Which cdr it's applied to
* \param chan Channel to which dest will be * \param chan Channel to which dest will be
* Sets the destination channel the CDR is applied to * Sets the destination channel the CDR is applied to
@ -315,8 +326,8 @@ void ast_cdr_submit_batch(int shutdown);
*/ */
void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chan); void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chan);
/*! /*!
* \brief Set the last executed application * \brief Set the last executed application
* \param cdr which cdr to act upon * \param cdr which cdr to act upon
* \param app the name of the app you wish to change it to * \param app the name of the app you wish to change it to
* \param data the data you want in the data field of app you set it to * \param data the data you want in the data field of app you set it to
@ -343,24 +354,24 @@ void ast_cdr_setanswer(struct ast_cdr *cdr, struct timeval t);
*/ */
void ast_cdr_setdisposition(struct ast_cdr *cdr, long int disposition); void ast_cdr_setdisposition(struct ast_cdr *cdr, long int disposition);
/*! /*!
* \brief Convert a string to a detail record AMA flag * \brief Convert a string to a detail record AMA flag
* \param flag string form of flag * \param flag string form of flag
* Converts the string form of the flag to the binary form. * Converts the string form of the flag to the binary form.
* \return the binary form of the flag * \return the binary form of the flag
*/ */
int ast_cdr_amaflags2int(const char *flag); int ast_cdr_amaflags2int(const char *flag);
/*! /*!
* \brief Disposition to a string * \brief Disposition to a string
* \param disposition input binary form * \param disposition input binary form
* Converts the binary form of a disposition to string form. * Converts the binary form of a disposition to string form.
* \return a pointer to the string form * \return a pointer to the string form
*/ */
char *ast_cdr_disp2str(int disposition); char *ast_cdr_disp2str(int disposition);
/*! /*!
* \brief Reset the detail record, optionally posting it first * \brief Reset the detail record, optionally posting it first
* \param cdr which cdr to act upon * \param cdr which cdr to act upon
* \param flags |AST_CDR_FLAG_POSTED whether or not to post the cdr first before resetting it * \param flags |AST_CDR_FLAG_POSTED whether or not to post the cdr first before resetting it
* |AST_CDR_FLAG_LOCKED whether or not to reset locked CDR's * |AST_CDR_FLAG_LOCKED whether or not to reset locked CDR's
@ -383,7 +394,7 @@ void ast_cdr_specialized_reset(struct ast_cdr *cdr, struct ast_flags *flags);
*/ */
char *ast_cdr_flags2str(int flags); char *ast_cdr_flags2str(int flags);
/*! /*!
* \brief Move the non-null data from the "from" cdr to the "to" cdr * \brief Move the non-null data from the "from" cdr to the "to" cdr
* \param to the cdr to get the goodies * \param to the cdr to get the goodies
* \param from the cdr to give the goodies * \param from the cdr to give the goodies

Loading…
Cancel
Save