CDR(name[,options])
All of the CDR field names are read-only, except for accountcode, userfield, and amaflags. You may, however, supply a name not on the above list, and create your own variable, whose value can be changed with this function, and this variable will be stored on the CDR.
Note
CDRs can only be modified before the bridge between two channels is torn down. For example, CDRs may not be modified after the Dial application has returned.
exten => 1,1,Set(CDR(userfield)=test)
-
namerequired - CDR field name:clid- Caller IDThe calling party number (and optionally name) presented on an outbound call, set from the endpoint or manipulated in the dialplan..lastdata- Last application arguments.disposition- The final state of the CDR.0-NO ANSWER1-NO ANSWER(NULL record)2-FAILED4-BUSY8-ANSWERED16-CONGESTION
src- Source.start- Time the call started.-
amaflags- R/W the Automatic Message Accounting (AMA) flags on the channelA single call leg passing through Asterisk. Channels represent connections to endpoints and are what dialplan applications act on.. When read from a channel, the integer value will always be returned. When written to a channel, both the string format or integer value is accepted.1-OMIT2-BILLING3-DOCUMENTATION
Warning
Accessing this setting is deprecated in CDR. Please use the CHANNEL function instead.
-
dst- Destination. answer- Time the call was answered.-
accountcode- The channel's account code.Warning
Accessing this setting is deprecated in CDR. Please use the CHANNEL function instead.
-
dcontext- Destination contextA named section of the dialplan that groups extensions. Calls enter a specific context and can only reach extensions visible from it, making contexts the basic unit of call routing and security.. end- Time the call ended.uniqueid- The channel's unique id.dstchannel- Destination channel.duration- Duration of the call.userfield- The channel's user specified field.lastapp- Last application.billsec- Duration of the call once it was answered.channel- Channel name.sequence- CDR sequence number.optionsf- Returns billsec or duration fields as floating point values.u- Retrieves the raw, unprocessed value. For example, 'start', 'answer', and 'end' will be retrieved as epoch values, when theuoption is passed, but formatted as YYYY-MM-DD HH:MM:SS otherwise. Similarly, disposition and amaflags will return their raw integral values.
User Notes
Know a tip or gotcha for this topic? Share it below and help others.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.