1 Asterisk billing support - Call Detail Records
2 ----------------------------------------------
3 Asterisk generates Call Detail Records in a database or in a comma
6 * cdr_csv supports comma separated text file storage, this is the
8 * cdr_manager supports CDR information via the AMI, The Asterisk Manager
10 * cdr_odbc supports UnixODBC databases, see http://www.unixodbc.org
11 for an updated list of supported databases, from MySQL to MsSQL
13 * cdr_tds supports FreeTDS databases (Among them MS SQL)
14 NOTE: Please read doc/freetds.txt for information on possible
15 problems with the FreeTDS driver
16 * cdr_sqlite supports SQlite
17 * cdr_pgsql supports PostgreSQL
19 In the asterisk-addons subversion repository, there's a cdr_mysql driver for
25 * SetAccount Set account code for billing
26 * SetAMAFlags Sets AMA flags
27 * NoCDR Make sure no CDR is saved for a specific call
29 * ForkCDR Save current CDR and start a new CDR for this call
30 * Authenticate Authenticates and sets the account code
31 * SetCDRUserField Set CDR user field
32 * AppendCDRUserField Append data to CDR User field
34 For more information, use the "show application" command.
35 You can set default account codes and AMA flags for devices in
36 channel configuration files, like sip.conf, iax.conf etc.
39 Fields of the CDR in Asterisk
40 -----------------------------
42 1. accountcode: What account number to use, (string, 20 characters)
43 2. src: Caller*ID number (string, 80 characters)
44 3. dst: Destination extension (string, 80 characters)
45 4. dcontext: Destination context (string, 80 characters)
46 5. clid: Caller*ID with text (80 characters)
47 6. channel: Channel used (80 characters)
48 7. dstchannel: Destination channel if appropriate (80 characters)
49 8. lastapp: Last application if appropriate (80 characters)
50 9. lastdata: Last application data (arguments) (80 characters)
51 10. start: Start of call (date/time)
52 11. answer: Answer of call (date/time)
53 12. end: End of call (date/time)
54 13. duration: Total time in system, in seconds (integer), from dial to hangup
55 14. billsec: Total time call is up, in seconds (integer), from answer to hangup
56 15. disposition: What happened to the call: ANSWERED, NO ANSWER, BUSY
57 16. amaflags: What flags to use: DOCUMENTATION, BILL, IGNORE etc,
58 specified on a per channel basis like accountcode.
59 17. user field: A user-defined field, maximum 255 characters
61 In some cases, uniqueid is appended:
63 * uniqueid: Unique Channel Identifier (32 characters)
64 This needs to be enabled in the source code at compile time
67 ONE IMPORTANT NOTE: If you are trying to collect records on IAX to IAX calls
68 you need to be aware that by default, IAX will attempt to transfer calls
69 in this situation (if DTMF is not required). When the transfer is completed
70 the call is dumped from the middle machine and thus the call detail records
71 will report a short call time. If you want detailed records you must
72 turn off IAX transfer, but unless your servers are very close together, you
73 will definitely get a latency hit from doing so.
75 ____________________________________
77 ------------------------------------
79 If the channel has a cdr, that cdr record has its own set of variables which
80 can be accessed just like channel variables. The following builtin variables
83 ${CDR(clid)} Caller ID
85 ${CDR(dst)} Destination
86 ${CDR(dcontext)} Destination context
87 ${CDR(channel)} Channel name
88 ${CDR(dstchannel)} Destination channel
89 ${CDR(lastapp)} Last app executed
90 ${CDR(lastdata)} Last app's arguments
91 ${CDR(start)} Time the call started.
92 ${CDR(answer)} Time the call was answered.
93 ${CDR(end)} Time the call ended.
94 ${CDR(duration)} Duration of the call.
95 ${CDR(billsec)} Duration of the call once it was answered.
96 ${CDR(disposition)} ANSWERED, NO ANSWER, BUSY
97 ${CDR(amaflags)} DOCUMENTATION, BILL, IGNORE etc
98 ${CDR(accountcode)} The channel's account code.
99 ${CDR(uniqueid)} The channel's unique id.
100 ${CDR(userfield)} The channels uses specified field.
102 In addition, you can set your own extra variables by using Set(CDR(name)=value).
104 ______________________________
106 ------------------------------
108 This module is an experimental new cdr module to demonstrate the cdr vars.
111 *) Create a file called cdr.conf and place it in your /etc/asterisk (or wherever your config files are) in the [cdr_csv2] section.
112 *) Add an entry called format to indicate any format you want for the output.
114 The following format string will emulate the regular cdr file format:
117 format => "${CDR(clid)}","${CDR(src)}","${CDR(dst)}","${CDR(dcontext)}","${CDR(channel)}","${CDR(dstchannel)}","${CDR(lastapp)}","${CDR(lastdata)}","${CDR(start)}","${CDR(answer)}","${CDR(end)}","${CDR(duration)}","${CDR(billsec)}","${CDR(disposition)}","${CDR(amaflags)}","${CDR(accountcode)}","${CDR(uniqueid)}","${CDR(userfield)}"
119 You can put anything you want as the value of format incuding new cdr vars you make up or any global variables.