[asterisk-dev] The New CDR system
murf at digium.com
Thu Mar 29 11:48:27 MST 2007
I've been collecting all the CDR related bugs. I have a branch,
team/murf/bug8221-1.4, where I've been testing out fixes to problems
I'm about to clean it up and commit it to 1.4 and trunk.
If there's one thing I've concluded, it's that there are some problems
with the CDR system, and something different is in order.
And, after yesterdays "Oldest 15" phone conference, with the CDR
discussion afterwards, just what exactly the "new CDR" system should be,
is beginning to gel.
First of all, why a **new** CDR system? Well, to put it plainly, the old
days of "one call", and it's corresponding "one CDR", are over. It might
have been fine for Ma Bell to bill from when all that happened was, you
dial a number, and two
people talk, then you both hang up. But things aren't that simple any
There's parking lots, 3 way conferences, conference rooms, transfers,
blind and attended, call forwarding, findmefollowme, masquerading,
queues, etc. etc., and the billing requirements can get quite tricky!
1. There will be a configuration file choice, as whether to use the
system (the current one we all know and love), and the "NEW" config
the one I'm about to describe. By default, in trunk, it will be
in 1.8, it will default to "NEW", and in 1.10, OLD will disappear,
2. The record format will change. Currently, each CDR has room for 3
start (usually channel creation), answer (from a dial operation), and
(usually when the CDR is to be closed and posted, usually a hangup,
The new CDR record will record only 1 event, and be immediately
For the sake of the database backends, these fields are currently
calldate (date/time) (odbc, pgsql, mysql)
start (date/time) (tds, radius, sqlite
answer (date/time) (tds, radius, sqlite
end (date/time) (tds, radius,
clid (odbc, tds, pgsql, mysql)
src (odbc, tds, pgsql, mysql)
dst (odbc, tds, pgsql, mysql)
dcontext (odbc, tds, pgsql, mysql)
channel (odbc, tds, pgsql, mysql)
dstchannel (odbc, tds, pgsql, mysql)
lastapp (odbc, tds, pgsql, mysql)
lastdata (odbc, tds, pgsql, mysql)
duration (int) (odbc, tds, pgsql, mysql)
billsec (int) (odbc, tds, pgsql, mysql)
disposition (odbc, tds, pgsql, mysql)
amaflags (int) (odbc, tds, pgsql, mysql)
accountcode (odbc, tds, pgsql, mysql)
uniqueid (odbc, tds, pgsql, mysql, sqlite(option), )
userfield (odbc, pgsql, mysql, sqlite(option), )
The calldate timestamp vs. start, answer, end timestamps was a bit of
to me, so I checked it out... in mysql,pgsql,odbc, it's the start
guess is that billsec/duration fields are the important ones, and the
maybe just serves to help sort the records.
The new CDR output format will drop the start/answer/end/calldate
instead have a single "eventdate" field instead. It will add an
field that contains a standardized event name, "START", "HANGUP",
"APP", "BRIDGE", for now, with possibilities like "PARK", "TRANSFER",
"CONF_START", "CONF_END", and others, that we should nail down
Some of the other fields don't make sense any more in this sytem.
not be known until after a dial, say. "lastapp" and "lastdata" would
likely turn into just "App" and "AppData", and only be meaningful if
type is "APP"; "duration" and "billsec" would disappear, as the users
have to the calc themselves, based on their own criteria; disposition
probably only be meaningful with certain eventtypes; amaflags,
userfield would probably be output with every event-type. The
generate billing data would probably get a little more complex, but
able to generate the proper numbers from much more accurate and clear
3. CDR's would follow the life and activity of a channel in Asterisk.
channel is assigned its uniqueid, and BRIDGE and CONF_START events,
similar, will record both channels so channel activity can be linked.
uniqueid field in the cdr records can be used to link all the events
happened on a channel for a particular call. When two channels are
the necessary uniqueid's will be available to link things up. A
be necessary to tie calls into conference rooms together.
4. Either we can assign events a level number, and allow the user to
the config file, at what level they wish to log, or we can allow the
specify in the config file exactly what events they wish to track,
restrict which apps they wish to track as well, if not all of them.
events specified in the config file would be logged, hopefully
storage requirements and clutter. For those interested in Deep
Debugging, requesting info on ALL apps, would provide a complete
record of all
dialplan functions executed on a channel-- right down to NoOps and
if such are desired...
5. Some (but not all) apps currently provided by asterisk for CDR
like ForkCDR, for instance, should be unnecessary, and would not
apply to the
"new" system any more.
Hate it? Love it? Have suggestions?
More information about the asterisk-dev