Name

CDR — Gets or sets CDR information for this call (which will be written to the CDR log)

Synopsis

CDR(fieldname[,options])

Here is a list of all the available CDR field names:

clid

Read-only. Use the CALLERID(all) function to set this value.

lastapp

Read-only. Denotes the last application run.

lastdata

Read-only. Denotes the arguments to the last application run.

src

Read-only. Use the CALLERID(ani) function to set this value.

dst

Read-only. Corresponds to the final extension in the dialplan.

dcontext

Read-only. Corresponds to the final context in the dialplan.

channel

Read-only. The name of the channel on which the call originated.

dstchannel

Read-only. The name of the channel on which the call terminated.

disposition

Read-only. Maximum reached state of the channel. If the u option is specified, this value will be returned as an integer, instead of a string: 1 = NO ANSWER, 2 = BUSY, 3 = FAILED, 4 = ANSWERED.

amaflags

Read/write. Billing flags. If the u option is specified, this value will be returned as an integer, instead of a string: 1 = OMIT, 2 = BILLING, 3 = DOCUMENTATION.

accountcode

Read/write. Billing account (19 char maximum).

userfield

Read/write. User-defined field.

start

Read-only. Time when the call started. If the u option is specified, this value will be returned as an integer (seconds since the epoch) instead of a formatted date/time string.

answer

Read-only. Time when the call was answered (may be blank if the call is not yet answered). If the u option is specified, this value will be returned as an integer (seconds since the epoch) instead of a formatted date/time string.

end

Read-only. Time when the call was completed (may be blank if the call is not yet complete). If the u option is specified, this value will be returned as an integer (seconds since the epoch) instead of a formatted date/time string.

duration

Read-only. The difference between start and end, in seconds. May be 0, if the call is not yet complete.

billsec

Read-only. The difference between answer and end, in seconds. May be 0, if the call is not yet complete.

uniqueid

Read-only. A string that will be unique per-call within this Asterisk instance.

The following options may be specified:

l

All results will be retrieved from the last Call Detail Record for the call, in the case of using multiple CDRs via ForkCDR().

r

Custom CDR variables will be retrieved from the last Call Detail Record, but the standard fields will be retrieved from the first.

u

The unparsed value will be returned. See the fieldname list above for entries that are affected by this flag.

You may also supply a fieldname not on the above list, and create your own variable, whose value can be changed with this function, and this variable will be stored in the CDR.

See Also

CHANNEL()