text
stringlengths
0
152
size
time
scheduler
only
no
no
no
100
300
no
Enable CDR logging. The default is yes.
Log unanswered calls. Normally, only answered calls result in a CDR. Logging all call
attempts can result in a large number of extra call records that most people do not
care about. The default value is no.
Close out CDRs before running the h extension in the Asterisk dialplan. Normally,
CDRs are not closed until the dialplan is completely finished running. The default
value is no.
When calculating the billsec field, always round up. For example, if the
difference between when the call was answered and when the call ended is 1 second
and 1 microsecond, billsec will be set to 2 seconds. This helps ensure that
Asterisk’s CDRs match the behavior used by telcos. The default value is 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. Using batch mode can be incredibly useful when
working with a database that may be slow to process requests. The default value is
no, but we recommend turning it on.a
Set the number of CDRs to queue up before they are logged during batch mode. The
default value is 100.
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.
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.
358
|
Chapter 21: System Monitoring and Logging
Option
safe shutdown
Value/example Notes
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
require 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:
[mytable]
connection = asterisk
table = asterisk_cdr
A more detailed example of setting up a database for logging CDRs can be found in
“Storing Call Detail Records” on page 281.
Table 21-4 lists the options that can be specified in a table configuration section in the