Asterisk cdr yada

Current version 005, released on 11/2806. Fixed possible seg fault on x86_64 systems.

Allows Asterisk to store CDR information into any database yada supports (currently MySQL, Oracle,PostgreSQL, SQLite3).

  • If the database is not available, it can queue records to both memory and disc for later playback without worry of losing records.
  • Supports userfield parsing to custom columns. Using this feature you can add custom columns to the database schema and populate them via column=value pairs passed to SetCDRUserField.

For more information see the README http://oss.devit.com/voip/asterisk/cdr_yada/README or yada docs http://oss.devit.com/yada/manual/yada.html.

Installation


get and install yada http://oss.devit.com/yada/
get cdr_yada src http://oss.devit.com/voip/asterisk/cdr_yada/ and untar into your asterisk source directory. cd into the cdr_yada
directory, review any variables in the Makefile, and type 'make'.

Copy cdr_yada.so to your asterisk module directory (default /usr/lib/asterisk/modules). Copy cdr_yada.conf.sample as cdr_yada.conf into your asterisk config directory (default /etc/asterisk) and edit it.

Config example


;
; cdr_yada.conf
;

[global]

; yada db string to connect to
dbstr=mysql:localhost::cdr
; username for db (if required)
user=cdr
; password for db (if required)
pass=cdrpass

; maximum number of records to hold in memory
; once this is reached, records are either written to disc or dropped
max_queue_cache=500
queue_file=/var/asterisk/cdr_yada.queue

; this option sets whether or not to playback records from the queue_file
; if set to no, it will not play them back and you will need to do it manually
; this is primarily used if doing so would cause load issues
;queue_playback=yes

; table name
table=cdr_record

; query to use to insert records
note
table directive is ignored if query directive is used
;query=


Example standard schema

Here is an example table in mysql create syntax, to be used with config directive:
table=cdr_yada

create table cdr_yada (
id int not null,
calldate datetime not null default '0000-00-00 00:00:00',
accountcode varchar(20) not null default '',
src varchar(80) not null default '',
dst varchar(80) not null default '',
dcontext varchar(80) not null default '',
clid 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 int(11) not null default '0',
billsec int(11) not null default '0',
disposition varchar(45) not null default '',
amaflags int(11) not null default '0',
uniqueid varchar(32) not null default '',
userfield varchar(255) not null default ''
);


Example custom schema

Here is an example table in mysql create syntax, to be used with config directive:
query=insert into cdr_yada_cust (calldate, clid, src, dst, dcontext, channel, dstchannel, lastapp, lastdata, duration, billsec, disposition, amaflags) values ('?s', ?v, ?v, ?v, ?v, ?v, ?v, ?v, ?v, ?d, ?d, ?v, ?d)

create table cdr_yada_cust (
id int not null,
calldate datetime not null default '0000-00-00 00:00:00',
accountcode varchar(20) not null default '',
src varchar(80) not null default '',
dst varchar(80) not null default '',
dcontext varchar(80) not null default '',
clid 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 int(11) not null default '0',
billsec int(11) not null default '0',
disposition varchar(45) not null default '',
amaflags int(11) not null default '0'
);


Example userfield parsing

Here is an example table with custom columns in mysql create syntax:

create table cdr_yada_ufp (
id int not null,
calldate datetime not null default '0000-00-00 00:00:00',
accountcode varchar(20) not null default '',
src varchar(80) not null default '',
dst varchar(80) not null default '',
dcontext varchar(80) not null default '',
clid 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 int(11) not null default '0',
billsec int(11) not null default '0',
disposition varchar(45) not null default '',
amaflags int(11) not null default '0',
uniqueid varchar(32) not null default '',
msg varchar(255),
area varchar(255),
cid varchar(255)
);

These cdr_yada config directives would enable it.

table=cdr_yada_ufp

[userfield_parse]
enabled=yes

[ufc0]
name=msg

[ufc1]
name=area

[ufc2]
name=cid

Set in the dialplan with: SetCDRUserField(msg=test message, area=555, cid=${CALLERID})

Asterisk cli commands


cdr yada connect : connect to database

cdr yada disconnect : sync any queued logs and disconnect from database

cdr yada status : display current status
Current version 005, released on 11/2806. Fixed possible seg fault on x86_64 systems.

Allows Asterisk to store CDR information into any database yada supports (currently MySQL, Oracle,PostgreSQL, SQLite3).

  • If the database is not available, it can queue records to both memory and disc for later playback without worry of losing records.
  • Supports userfield parsing to custom columns. Using this feature you can add custom columns to the database schema and populate them via column=value pairs passed to SetCDRUserField.

For more information see the README http://oss.devit.com/voip/asterisk/cdr_yada/README or yada docs http://oss.devit.com/yada/manual/yada.html.

Installation


get and install yada http://oss.devit.com/yada/
get cdr_yada src http://oss.devit.com/voip/asterisk/cdr_yada/ and untar into your asterisk source directory. cd into the cdr_yada
directory, review any variables in the Makefile, and type 'make'.

Copy cdr_yada.so to your asterisk module directory (default /usr/lib/asterisk/modules). Copy cdr_yada.conf.sample as cdr_yada.conf into your asterisk config directory (default /etc/asterisk) and edit it.

Config example


;
; cdr_yada.conf
;

[global]

; yada db string to connect to
dbstr=mysql:localhost::cdr
; username for db (if required)
user=cdr
; password for db (if required)
pass=cdrpass

; maximum number of records to hold in memory
; once this is reached, records are either written to disc or dropped
max_queue_cache=500
queue_file=/var/asterisk/cdr_yada.queue

; this option sets whether or not to playback records from the queue_file
; if set to no, it will not play them back and you will need to do it manually
; this is primarily used if doing so would cause load issues
;queue_playback=yes

; table name
table=cdr_record

; query to use to insert records
note
table directive is ignored if query directive is used
;query=


Example standard schema

Here is an example table in mysql create syntax, to be used with config directive:
table=cdr_yada

create table cdr_yada (
id int not null,
calldate datetime not null default '0000-00-00 00:00:00',
accountcode varchar(20) not null default '',
src varchar(80) not null default '',
dst varchar(80) not null default '',
dcontext varchar(80) not null default '',
clid 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 int(11) not null default '0',
billsec int(11) not null default '0',
disposition varchar(45) not null default '',
amaflags int(11) not null default '0',
uniqueid varchar(32) not null default '',
userfield varchar(255) not null default ''
);


Example custom schema

Here is an example table in mysql create syntax, to be used with config directive:
query=insert into cdr_yada_cust (calldate, clid, src, dst, dcontext, channel, dstchannel, lastapp, lastdata, duration, billsec, disposition, amaflags) values ('?s', ?v, ?v, ?v, ?v, ?v, ?v, ?v, ?v, ?d, ?d, ?v, ?d)

create table cdr_yada_cust (
id int not null,
calldate datetime not null default '0000-00-00 00:00:00',
accountcode varchar(20) not null default '',
src varchar(80) not null default '',
dst varchar(80) not null default '',
dcontext varchar(80) not null default '',
clid 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 int(11) not null default '0',
billsec int(11) not null default '0',
disposition varchar(45) not null default '',
amaflags int(11) not null default '0'
);


Example userfield parsing

Here is an example table with custom columns in mysql create syntax:

create table cdr_yada_ufp (
id int not null,
calldate datetime not null default '0000-00-00 00:00:00',
accountcode varchar(20) not null default '',
src varchar(80) not null default '',
dst varchar(80) not null default '',
dcontext varchar(80) not null default '',
clid 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 int(11) not null default '0',
billsec int(11) not null default '0',
disposition varchar(45) not null default '',
amaflags int(11) not null default '0',
uniqueid varchar(32) not null default '',
msg varchar(255),
area varchar(255),
cid varchar(255)
);

These cdr_yada config directives would enable it.

table=cdr_yada_ufp

[userfield_parse]
enabled=yes

[ufc0]
name=msg

[ufc1]
name=area

[ufc2]
name=cid

Set in the dialplan with: SetCDRUserField(msg=test message, area=555, cid=${CALLERID})

Asterisk cli commands


cdr yada connect : connect to database

cdr yada disconnect : sync any queued logs and disconnect from database

cdr yada status : display current status
Created by: devit, Last modification: Tue 28 of Nov, 2006 (19:05 UTC) by grizz
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+