系统环境
CentOS 7.9 — Freeswitch 1.10.5 另一篇文章我是安装的1.8.5,依赖包可以借鉴安装,1.10.5安装包可在点击此处下载,提取码:7y12
Windows 2012 — PostgresSQL 13 可参考此文章
配置步骤如下:
1、安装postgres数据库,此处省略
2、在安装了freeswitch的服务器上,安装postgresql-devel
3、找到freeswitch的安装包,在modules.conf中取消对event_handlers/mod_cdr_pg_csv的注释
4、在freeswitch源码路径下执行
./configure --enable-core-pgsql-support
make mod_cdr_pg_csv-install
5、freeswitch连接postgres需要依赖libpq,如果不安装,在通话结束后,cdr无法写入到数据库,会有如下提示
SCRAM authentication requires libpq version 10 or above
安装libpq
安装包可在此处下载
6、修改freeswitch安装路径下的cdr_pg_csv.conf.xml
<param name="db-info" value="host=数据库IP地址 user=数据库用户名 password=数据库密码 dbname=数据库名称 connect_timeout=10" />
<param name="db-table" value="xml_cdr"/>
7、手动创建数据库cdr表,语句如下:
create table cdr (
id serial primary key,
local_ip_v4 inet not null,
caller_id_name varchar,
caller_id_number varchar,
destination_number varchar not null,
context varchar not null,
start_stamp timestamp with time zone not null,
answer_stamp timestamp with time zone,
end_stamp timestamp with time zone not null,
duration int not null,
billsec int not null,
hangup_cause varchar not null,
uuid uuid not null,
bleg_uuid uuid,
accountcode varchar,
read_codec varchar,
write_codec varchar,
sip_hangup_disposition varchar,
ani varchar
);
ALTER TABLE "freeswitch"."cdr" OWNER TO "freeswitch";
8、如上步骤操作完成以后,需要重新加载cdr模块
reload mod_cdr_pg_csv
其他
freeswitch默认每个程序都有一个数据库。根据自己需要,将不通程序对于的配置文件修改即可。
大概有以下文件需要修改
switch.conf.xml //核心表
db.conf.xml //核心表
voicemail.conf.xml //留言相关的表
internal.xml //
external.xml //
cdr_pg_csv.conf.xml //通话记录
fifo.conf.xml //fifo相关的表
callcenter.conf.xml //callcenter程序相关的表。
除了cdr_pg_csv.conf.xml 文件外,其他文件修改文件中的odbc-dsn配置即可。
<param name="odbc-dsn" value="pgsql://hostaddr=0.0.0.0 dbname=fs_db user=fs_dba password='123456'"/>