forked from cdr-stats/cdr-stats
-
Notifications
You must be signed in to change notification settings - Fork 1
/
MYSQL
37 lines (26 loc) · 1.24 KB
/
MYSQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
IMPORT MYSQL CDR DATABASE
---------------------------
If you are willing to edit the CDR from the admin panel, you will need to alter the original cdr table used by asterisk and add a Primary Key.
The Following SQL instructions might help.
CREATE TABLE cdr_new (
id integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
src varchar(80) NOT NULL,
dst varchar(80) NOT NULL,
calldate datetime NOT NULL,
clid 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 integer unsigned NOT NULL,
billsec integer unsigned NOT NULL,
disposition integer unsigned NOT NULL,
amaflags integer unsigned NOT NULL,
accountcode integer unsigned NOT NULL,
uniqueid varchar(32) NOT NULL,
userfield varchar(80) NOT NULL
);
INSERT INTO cdr_new (src,dst,calldate,clid,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield) SELECT src,dst,calldate,clid,dcontext,channel,dstchannel,lastapp,lastdata,duration,billsec,disposition,amaflags,accountcode,uniqueid,userfield FROM cdr;
RENAME TABLE cdr TO cdr_backup;
RENAME TABLE cdr_new TO cdr;