System information
Option Value/
Example
Notes
batch no Queue up CDRs to be logged in batches instead of logging synchronously at the end
of every call. This prevents CDR logging from blocking the completion of the call
teardown process within Asterisk. The default value is no, but we recommend turning
it on.
a
size 100 Set the number of CDRs to queue up before they are logged during batch mode. The
default value is 100.
time 300 Set the maximum number of seconds that CDRs will wait in the batch queue before
being logged. The CDR batch logging process will run at the end of this time period,
even if size has not been reached. The default value is 300 seconds.
scheduleronly no Set whether CDR batch processing should be done by spawning a new thread, or
within the context of the CDR batch scheduler. The default value is no, and we
recommend not changing it.
safeshutdown yes Block Asterisk shutdown to ensure that all queued CDR records are logged. The default
is yes, and we recommend leaving it that way, as this option prevents important
data loss.
a
The disadvantage of enabling this option is that if Asterisk were to crash or die for some reason, the CDR records would be lost, as they are
only stored in memory while the Asterisk process exists. See safeshutdown for more information.
Backends
Asterisk CDR backend modules provide a way to log CDRs. Most CDR backends re-
quire specific configuration to get them going.
cdr_adaptive_odbc
As the name suggests, the cdr_adaptive_odbc module allows CDRs to be stored in a
database through ODBC. The “adaptive” part of the name refers to the fact that it works
to adapt to the table structure: there is no static table structure that must be used with
this module. When the module is loaded (or reloaded), it reads the table structure.
When logging CDRs, it looks for a CDR variable that matches each column name. This
applies to both the built-in CDR variables and custom variables. If you want to log the
built-in channel CDR variable, just create a column called channel.
Adding custom CDR content is as simple as setting it in the dialplan. For example, if
we wanted to log the User-Agent that is provided by a SIP device, we could add that as
a custom CDR variable:
exten => 105,n,Set(CDR(useragent)=${CHANNEL(useragent)})
To have this custom CDR variable inserted into the database by cdr_adaptive_odbc, all
we have to do is create a column called useragent.
Multiple tables may be configured in the cdr_adaptive_odbc configuration file. Each
goes into its own configuration section. The name of the section can be anything; the
module does not use it. Here is an example of a simple table configuration:
530 | Chapter 24: System Monitoring and Logging