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 NOTE: If you use IAX2 channels for your calls, and allow 'full' transfers
68 (not media-only transfers), then when the calls is transferred the server
69 in the middle will no longer be involved in the signaling path, and thus
70 will not generate accurate CDRs for that call. If you can, use media-only
71 transfers with IAX2 to avoid this problem, or turn off transfers completely
72 (although this can result in a media latency increase since the media packets
73 have to traverse the middle server(s) in the call).
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).
103 These variables can be output into a text-format CDR by using the cdr_custom
104 CDR driver; see the cdr_custom.conf.sample file in the configs directory for
105 an example of how to do this.