August 2007
Intermediate to advanced
608 pages
20h 33m
English
Content preview from Asterisk: The Future of Telephony, 2nd EditionBecome an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
Start your free trial



Storing Call Detail Records
Call Detail Records (CDR) contain information about calls that have passed through your Asterisk system. They are discussed further in Chapter 13. This is a popular use of databases in Asterisk because CDR can be easier to manage if you store the records in a database (for example, you could keep track of many Asterisk systems in a single table).
Let’s create a table in our database to store CDR. Log in to the PostgreSQL server with the psql application:
# psql -U asterisk -h localhost asterisk
Password:And create the asterisk_cdr table:
asterisk=> CREATE TABLE asterisk_cdr ( id bigserial NOT NULL, calldate timestamptz, clid varchar(80), src varchar(80), dst varchar(80), dcontext varchar(80), channel varchar(80), dstchannel varchar(80), lastapp varchar(80), lastdata varchar(80), duration int8, billsec int8, disposition varchar(45), ...