是否有任何可用于将xml cdr从log dir加载到mysql db的脚本?我在/ contrib中找到了一些脚本,但是他们没有在db中加载它。如果有人可以分享他们的剧本,我将非常感激。
答案 0 :(得分:0)
您可以在the mod_cdr wiki page上找到FS的CDR sql架构。
create database freeswitchdb;
use freeswitchdb;
create table freeswitchcdr (
callid bigint unsigned default 0 primary key, /* This will need to be handled specially for auto increment, as that might not be standard */
callstartdate datetime NOT NULL,
callanswerdate datetime NOT NULL,
calltransferdate datetime NOT NULL,
callenddate datetime NOT NULL,
originated tinyint default 0,
clid varchar(80) default "Freeswitch - Unknown",
src varchar(80) NOT NULL,
dst varchar(80) NOT NULL,
ani varchar(80) default "",
aniii varchar(80) default "",
dialplan varchar(80) default "",
myuuid char(36) NOT NULL,
destuuid char(36) NOT NULL,
srcchannel varchar(80) NOT NULL,
dstchannel varchar(80) NOT NULL, /* Need to decide - this might be redundant as you can link the records via uuid */
network_addr varchar(40) default "",
lastapp varchar(80) default "",
lastdata varchar(255) default "",
billusec bigint default 0,
disposition tinyint default 0, /* 0 = Busy or Unanswered, 1 = Answered */
hangupcause int default 0,
amaflags tinyint default 0
);
create index myuuid_index on freeswitchcdr (myuuid);
create index destuuid_index on freeswitchcdr (destuuid);
create table chanvars (
callid bigint unsigned default 0,
varname varchar(80) NOT NULL,
varvalue varchar(255) default ""
);
create index callid_index on chanvars(callid,varname);
ALTER TABLE freeswitchcdr modify callid bigint unsigned auto_increment;
ALTER TABLE freeswitchcdr Engine=InnoDB;
ALTER TABLE chanvars Engine=InnoDB;
关于如何使用PHP解析XML,有一个答案:Parsing XML data using php to put into mysql database。