aboutsummaryrefslogtreecommitdiffstats
path: root/doc/README.cdr
blob: 2f6891ed6c0c5133700c369f39bdad4524f91b3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
Asterisk billing support - Call Detail Records
----------------------------------------------
Asterisk generates Call Detail Records in a database or in a comma
separated text file. 

   * cdr_csv supports comma separated text file storage, this is the
     default driver
   * cdr_manager supports CDR information via the AMI, The Asterisk Manager
     interface
   * cdr_odbc supports UnixODBC databases, see http://www.unixodbc.org
     for an updated list of supported databases, from MySQL to MsSQL
     and text files.
   * cdr_tds supports FreeTDS databases (Among them MS SQL)
	NOTE: Please read README.tds for information on possible
	problems with the FreeTDS driver
   * cdr_sqlite supports SQlite
   * cdr_pgsql supports PostgreSQL

In the asterisk-addons cvs archive, there's a cdr_mysql driver for
MySQL.



Applications
------------

    * SetAccount  		Set account code for billing
    * SetAMAFlags 		Sets AMA flags
    * NoCDR  			Make sure no CDR is saved for a specific call
    * ResetCDR  		Reset CDR
    * ForkCDR 			Save current CDR and start a new CDR for this call
    * Authenticate 		Authenticates and sets the account code
    * SetCDRUserField   	Set CDR user field
    * AppendCDRUserField   	Append data to CDR User field 

For more information, use the "show application" command.
You can set default account codes and AMA flags for devices in 
channel configuration files, like sip.conf, iax.conf etc.


Fields of the CDR in Asterisk
-----------------------------

   1. accountcode:	What account number to use, (string, 20 characters)
   2. src:		Caller*ID number (string, 80 characters)
   3. dst:		Destination extension (string, 80 characters)
   4. dcontext:		Destination context (string, 80 characters)
   5. clid:		Caller*ID with text (80 characters)
   6. channel:		Channel used (80 characters)
   7. dstchannel:	Destination channel if appropriate (80 characters)
   8. lastapp:		Last application if appropriate (80 characters)
   9. lastdata:		Last application data (arguments) (80 characters)
  10. start:		Start of call (date/time)
  11. answer:		Answer of call (date/time)
  12. end:		End of call (date/time)
  13. duration:		Total time in system, in seconds (integer), from dial to hangup
  14. billsec:		Total time call is up, in seconds (integer), from answer to hangup
  15. disposition:	What happened to the call: ANSWERED, NO ANSWER, BUSY
  16. amaflags:		What flags to use: DOCUMENTATION, BILL, IGNORE etc, 
      			specified on a per channel basis like accountcode.
  17. user field:	A user-defined field, maximum 255 characters 

In some cases, uniqueid is appended:

    * uniqueid:		Unique Channel Identifier (32 characters) 
      This needs to be enabled in the source code at compile time


ONE IMPORTANT NOTE: If you are trying to collect records on IAX to IAX calls
you need to be aware that by default, IAX will attempt to transfer calls
in this situation (if DTMF is not required).  When the transfer is completed
the call is dumped from the middle machine and thus the call detail records
will report a short call time.  If you want detailed records you must
turn off IAX transfer, but unless your servers are very close together, you
will definitely get a latency hit from doing so.

____________________________________
CDR Variables
------------------------------------

If the channel has a cdr, that cdr record has its own set of variables which 
can be accessed just like channel variables. The following builtin variables
are available.

${CDR(clid)}			Caller ID
${CDR(src)}			Source 
${CDR(dst)}			Destination
${CDR(dcontext)}		Destination context
${CDR(channel)}			Channel name
${CDR(dstchannel)}		Destination channel
${CDR(lastapp)}			Last app executed
${CDR(lastdata)}		Last app's arguments
${CDR(start)}			Time the call started.
${CDR(answer)}			Time the call was answered.
${CDR(end)}			Time the call ended.
${CDR(duration)}		Duration of the call.
${CDR(billsec)}			Duration of the call once it was answered.
${CDR(disposition)}		ANSWERED, NO ANSWER, BUSY
${CDR(amaflags)}		DOCUMENTATION, BILL, IGNORE etc
${CDR(accountcode)}		The channel's account code.
${CDR(uniqueid)}		The channel's unique id.
${CDR(userfield)}		The channels uses specified field.

In addition, you can set your own extra variables by using Set(CDR(name)=value).
These variables can be output into a text-format CDR by using the cdr_custom
CDR driver; see the cdr_custom.conf.sample file in the configs directory for
an example of how to do this.