Asterisk func cdr

Synopsis:

CDR(<name>)

Description:

CDR(<name>[|options])

name may be one of the following:
  • accountcode: The channel's account code.
  • amaflags: DOCUMENTATION, BILL, IGNORE etc
  • answer: Time the call was answered.
  • billsec: Duration of the call once it was answered.
  • channel: Channel name
  • clid: Caller ID
  • dcontext: Destination context
  • disposition: ANSWERED, NO ANSWER, BUSY
  • dst: Destination
  • dstchannel: Destination channel
  • duration: Duration of the call.
  • end: Time the call ended.
  • lastapp: Last app executed
  • lastdata: Last app's arguments
  • src: Source
  • start: Time the call started.
  • uniqueid: The channel's unique id.
  • userfield: The channel's user specified field.
  • any custom value that you wish to store.

options may be:
  • r: Causes the function to search the entire stack of CDRs on the channel for the requested value.
  • u: Retrieves the raw, unprocessed value.

All of the pre-defined CDR variables are read-only with the exception of the following:
  • Asterisk 1.4
    • accountcode
    • amaflags
    • userfield
  • Asterisk 1.2
    • accountcode
    • userfield
As noted above, you can add your own custom values to the CDR record. See the Example below for details.

Notes

  • This function may be both read from and written to. However, most of the pre-defined values are read-only as described above.
  • *CLI> core show function CDR

Return value

Returns the resulting string.

Example

; Get the value of the duration CDR field and store it in a variable
exten => s,1,Set(foo=${CDR(duration)})

; Update our accountcode field and then save some random music facts too
exten => s,1,Set(CDR(accountcode)=8675309)
exten => s,2,Set(CDR(MyFavoriteBand)=Foo Fighters)
exten => s,3,Set(CDR(MyFavoriteSong)=Hero)

See also


Synopsis:

CDR(<name>)

Description:

CDR(<name>[|options])

name may be one of the following:
  • accountcode: The channel's account code.
  • amaflags: DOCUMENTATION, BILL, IGNORE etc
  • answer: Time the call was answered.
  • billsec: Duration of the call once it was answered.
  • channel: Channel name
  • clid: Caller ID
  • dcontext: Destination context
  • disposition: ANSWERED, NO ANSWER, BUSY
  • dst: Destination
  • dstchannel: Destination channel
  • duration: Duration of the call.
  • end: Time the call ended.
  • lastapp: Last app executed
  • lastdata: Last app's arguments
  • src: Source
  • start: Time the call started.
  • uniqueid: The channel's unique id.
  • userfield: The channel's user specified field.
  • any custom value that you wish to store.

options may be:
  • r: Causes the function to search the entire stack of CDRs on the channel for the requested value.
  • u: Retrieves the raw, unprocessed value.

All of the pre-defined CDR variables are read-only with the exception of the following:
  • Asterisk 1.4
    • accountcode
    • amaflags
    • userfield
  • Asterisk 1.2
    • accountcode
    • userfield
As noted above, you can add your own custom values to the CDR record. See the Example below for details.

Notes

  • This function may be both read from and written to. However, most of the pre-defined values are read-only as described above.
  • *CLI> core show function CDR

Return value

Returns the resulting string.

Example

; Get the value of the duration CDR field and store it in a variable
exten => s,1,Set(foo=${CDR(duration)})

; Update our accountcode field and then save some random music facts too
exten => s,1,Set(CDR(accountcode)=8675309)
exten => s,2,Set(CDR(MyFavoriteBand)=Foo Fighters)
exten => s,3,Set(CDR(MyFavoriteSong)=Hero)

See also


Created by: murf, Last modification: Fri 27 of Jul, 2007 (12:50 UTC) by baji
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+