Skip to end of metadata
Go to start of metadata



Gets or sets a CDR variable.


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.



For setting CDR values, the l flag does not apply to setting the accountcode, userfield, or amaflags.

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.

Raw values for disposition:

  • 0 - NO ANSWER
  • 1 - NO ANSWER (NULL record)
  • 2 - FAILED
  • 4 - BUSY
  • 8 - ANSWERED
    Raw values for amaflags:
  • 1 - OMIT
  • 2 - BILLING
    Example: exten => 1,1,Set(CDR(userfield)=test)


  • name - CDR field name:
    • clid - Caller ID.
    • lastdata - Last application arguments.
    • disposition - ANSWERED, NO ANSWER, BUSY, FAILED.
    • src - Source.
    • start - Time the call started.
    • amaflags - DOCUMENTATION, BILL, IGNORE, etc.
    • dst - Destination.
    • answer - Time the call was answered.
    • accountcode - The channel's account code.
    • dcontext - Destination context.
    • 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.
  • options
    • f - Returns billsec or duration fields as floating point values.
    • l - Uses the most recent CDR on a channel with multiple records
    • r - Searches the entire stack of CDRs on the channel.
    • s - Skips any CDR's that are marked 'LOCKED' due to forkCDR() calls. (on setting/writing CDR vars only)
    • u - Retrieves the raw, unprocessed value.
      For example, 'start', 'answer', and 'end' will be retrieved as epoch values, when the u option is passed, but formatted as YYYY-MM-DD HH:MM:SS otherwise. Similarly, disposition and amaflags will return their raw integral values.

Import Version

This documentation was imported from Asterisk Version SVN-branch-10-r378689

  • No labels