CDR()
Назначение: Получить или установить значения поля для CDR записи.
Описание: CDR(<name>[|options])
Поле «name» может иметь следующие значения:
- clid: Caller*ID
- src : Источник вызова.
- dst : Пункт назначения вызова.
- dcontext : Контекст назначения.
- channel : Имя канала.
- dstchannel : Канал назначения вызова.
- astapp: Последняя выполненная функция.
- lastdata: Аргументы последней выполненной команды.
- start: Время начала вызова.
- answer: Время ответа на вызов.
- end: Время окончания вызова.
- duration: Продолжительность вызова.
- billsec: Продолжительность вызова с момента ответа на него.
- disposition : ANSWERED, NO ANSWER, BUSY
- amaflags: DOCUMENTATION, BILL, OMIT.
- accountcode: Код аккаунта канала.
- uniqueid: Уникальный идентификатор канала.
- userfield: Пользовательские данные установленные для канала.
Замечания
- Данная функция может использоваться как для получения значения, так и для его установки.
- *CLI> show function CDR
Возвращаемые значения: Возвращает строку с результатом.
примеры
exten => s,1,Set(foo=${CDR(duration)})
exten => s,1,Set(CDR(clid)=Foo Fighters)
-= Info about function 'CDR' =-
[Synopsis] Gets or sets a CDR variable.
[Description] All of the CDR field names are read-only, except for 'accountcode', 'user field', 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. Example: exten ⇒ 1,1,Set(CDR(userfield)=test)
[Syntax] CDR(name[,options])
[Arguments] name
CDR field name:
clid - Caller ID.
lastdata - Last application arguments.
disposition - The final state of the CDR.
0 - 'NO ANSWER'
1 - 'NO ANSWER' (NULL record)
2 - 'FAILED'
4 - 'BUSY'
8 - 'ANSWERED'
16 - 'CONGESTION'
src - Source.
start - Time the call started.
amaflags - R/W the Automatic Message Accounting (AMA) flags on the
channel. 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 - 'OMIT'
2 - 'BILLING'
3 - '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 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.
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.