=========================================== COMANDOS PARA ACTIVAR CDR ASTERISK EN MYSQL =========================================== ***************************************** Creación de base de datos y tablas MySQL

***************************************** mysql -u root -p mysql> CREATE DATABASE asteriskcdrdb; mysql> GRANT INSERT ON asteriskcdrdb.* TO asterisk@localhost IDENTIFIED BY 'v4ly d3l.t3l3st4r'; mysql> USE asteriskcdrdb; mysql> CREATE TABLE cdr ( calldate datetime NOT NULL default '0000-00-00 00:00:00', 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 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, accountcode varchar(20) NOT NULL default '', userfield varchar(255) NOT NULL default '' ); mysql> mysql> mysql> mysql> ALTER ALTER ALTER ALTER TABLE TABLE TABLE TABLE cdr cdr cdr cdr ADD ADD ADD ADD uniqueid VARCHAR(32) NOT NULL default ''; INDEX ( calldate ); INDEX ( dst ); INDEX ( accountcode );

************************************************* Activacion de tabla de paso para importacion del CDR desde sistema de gestion (si no se necesita, no implementar) ************************************************* -- Creacion de tabla clon para importar la data mysql> CREATE TABLE cdr ( id BIGINT NOT NULL default 0, calldate datetime NOT NULL default '0000-00-00 00:00:00', 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 int(11) NOT NULL default 0, billsec int(11) NOT NULL default 0, disposition varchar(45) NOT NULL default '',

calldate. accountcode varchar(20) NOT NULL default ''.disposition. new.cdr FOR EACH ROW INSERT INTO cdr_clone VALUES (new. new.sock .userfield=1 nano /etc/asterisk/modules.lastdata.conf -------------------------------[general] enabled=yes -------------------------------nano /etc/asterisk/cdr_mysql.accountcode.billsec.amaflags. new.clid. new.conf -------------------------------[global] hostname=localhost dbname=asteriskcdrdb table=cdr password=v4lyd3l. PRIMARY KEY (id) ). -. new. new.trigger_cdr_clone AFTER INSERT ON asteriskcdrdb.amaflags int(11) NOT NULL default 0. ******************************** Configurar Asterisk CDR Mysql ******************************** nano /etc/asterisk/cdr. new. new.trigger_cdr_clone @@ CREATE TRIGGER asteriskcdrdb.sock=/tmp/mysql.lastapp. new.userfield) @@ DELIMITER . new.dstchannel. new.dst. new.durati on.Creacion de trigger que duplica la data hacia la tabla clon DELIMITER @@ DROP TRIGGER asteriskcdrdb.src.channel. new.conf ----------------------------load => cdr_addon_mysql.t3l3st4r user=asterisk port=3306 .id. userfield varchar(255) NOT NULL default ''. new. new.so ----------------------------********************************** Reiniciando Asterisk ********************************** asterisk -r .dcontext.

CLI> restart when convenient CLI > asterisk -r CLI > cdr mysql status ======================================= FIN! ======================================= .

Sign up to vote on this title
UsefulNot useful