[Asterisk-Users] cdr Logging - Postgresql

Richard Lyman pchammer at dynx.net
Thu Oct 14 10:34:16 MST 2004


Joseph wrote:

> I am seting up to log cdr records via the postgresql module
> and have suggestion:
> 
> Would it not be nice to have an option in the config file that
> lets you specify the table name?
> 
> Also, here is the table creation that I used to make the table in 
> postgresql in case it would help anyone else:
> Or perhaps someone else can improve on it.
> 
> CREATE TABLE cdr (
>     calldate      text              NOT NULL ,
>     clid          varchar(80)          NOT NULL ,
>     src           varchar(80)          NOT NULL ,
>     dst           varchar(80)          NOT NULL ,
>     dcontext      varchar(80)          NOT NULL ,
>     channel       varchar(80)          NOT NULL ,
>     dstchannel    varchar(80)          NOT NULL ,
>     lastapp       varchar(80)          NOT NULL ,
>     lastdata      varchar(80)          NOT NULL ,
>     duration      int                   NOT NULL ,
>     billsec       int                   NOT NULL ,
>     disposition   varchar(45)          NOT NULL ,
>     amaflags      int                   NOT NULL ,
>     accountcode   varchar(20)          NOT NULL ,
>     uniqueid      varchar(32)          NOT NULL ,
>     userfield     varchar(255)         NOT NULL
> )
> 
CREATE TABLE cdr (
         acctid          BIGSERIAL PRIMARY KEY,
         calldate        TIMESTAMP with time zone NOT NULL 
DEFAULT now(),
         clid            VARCHAR(80) NOT NULL default '',
         src             VARCHAR(80) NOT NULL default '',
         dst             VARCHAR(80) NOT NULL default '',
         dcontext        VARCHAR(80) NOT NULL default '',
         channel         VARCHAR(80) NOT NULL default '',
         dstchannel      VARCHAR(80) NOT NULL default '',
         lastapp         VARCHAR(80) NOT NULL default '',
         lastdata        VARCHAR(80) NOT NULL default '',
         duration        INTEGER NOT NULL default '0',
         billsec         INTEGER NOT NULL default '0',
         disposition     VARCHAR(45) NOT NULL default '',
         amaflags        INTEGER NOT NULL default '0',
         accountcode     VARCHAR(20) NOT NULL default '',
         uniqueid        VARCHAR(32) NOT NULL default '',
         userfield       VARCHAR(255) NOT NULL default ''
);

is what i'm using.




More information about the asterisk-users mailing list