freeswitch连接postgres数据库

1.安装postgres数据库,并启动。省略安装过程。
2。在freeswitch所在服务器安装postgresql-devel.
3.配置修改和编译。
在modules.conf中开启pg_cdr vim modules.conf

event_handlers/mod_cdr_pg_csv

在fs源码目录下面 运行

./configure --enable-core-pgsql-support

如果一切正常,重新编译安装。

make mod_cdr_pg_csv-install

安装完成之后,去usr/local/freeswitch/config下面修改配置。
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'"/>

cdr_pg_csv.conf.xml 文件 修改如下:

<param name="db-info" value="host=0.0.0.0   user=fs_dba password=*dbname=fs_db connect_timeout=10" />

并且要手动创建表cdr,这个有点奇怪,不知道为什么fs不能自动创建这个表
建表语句:

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
);

猜你喜欢

转载自blog.csdn.net/xfks55/article/details/53204200