ubuntu16.04.3配置freeswitch1.6使用PostgreSQL

来源:互联网 发布:待业在家知乎 编辑:程序博客网 时间:2024/05/16 19:34

安装 PostgreSQL

sudo apt-get -y install postgresql

创建存放表空间目录

sudo mkdir -p /usr/local/freeswitch/db/psdbsudo chown postgres:postgres /usr/local/freeswitch/db/psdb

修改监听IP

sudo vim /etc/postgresql/9.5/main/postgresql.conf

做如下修改

listen_addresses = '*'

对所有网段全开放:

sudo vim /etc/postgresql/9.5/main/pg_hba.conf#IPV4host    all             all             0.0.0.0/0                 md5#IPV6host    all             all             ::/0                    md5

重启ps

sudo /etc/init.d/postgresql restart

修改PostgreSQL密码

sudo su - postgres postgres@ubuntu:~$ psqlpostgres@ubuntu:~$ psqlpsql (9.5.8)Type "help" for help.postgres=# \passwordEnter new password: Enter it again: 

建数据库

创建角色postgres=# create role freeswitch createdb createrole login   password '123456';创建表空间postgres=# create tablespace freeswitch_space owner freeswitch location '/usr/local/freeswitch/db/psdb';CREATE TABLESPACE切换角色并创建数据库postgres=# set session authorization freeswitch;SETpostgres=> create database freeswitch_core tablespace freeswitch_space ;CREATE DATABASEpostgres=> create database sofia_reg_internal tablespace freeswitch_space ;CREATE DATABASEpostgres=> create database sofia_reg_external tablespace freeswitch_space ;CREATE DATABASEpostgres=> create database sofia_reg_internal6 tablespace freeswitch_space ;CREATE DATABASEpostgres=> create database sofia_reg_external6 tablespace freeswitch_space ;CREATE DATABASEpostgres=> create database call_limit tablespace freeswitch_space ;CREATE DATABASEpostgres=> create database fifo tablespace freeswitch_space ;CREATE DATABASE建立新用户、角色postgres=> create user freeswitch_core password '123456' createdb;CREATE ROLEpostgres=> 使用新用户登入freeswitch_core数据库postgres=> \qpostgres@ubuntu:~$ psql -U freeswitch_core -h localhost -d freeswitch_core

修改fs配置后重启

sudo vim /usr/local/freeswitch/conf/autoload_configs/switch.conf.xml<param name="core-db-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='freeswitch_core' user='freeswitch_core' password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" /> sudo vim /usr/local/freeswitch/conf/sip_profiles/internal.xml <param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_internal' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />sudo vim /usr/local/freeswitch/conf/sip_profiles/internal-ipv6.xml <param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_internal6' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />sudo vim /usr/local/freeswitch/conf/sip_profiles/external.xml <param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_external' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />sudo vim /usr/local/freeswitch/conf/sip_profiles/external-ipv6.xml <param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='sofia_reg_external6' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />sudo vim /usr/local/freeswitch/conf/autoload_configs/db.conf.xml<param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='call_limit' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />sudo vim /usr/local/freeswitch/conf/autoload_configs/fifo.conf.xml<settings><param name="odbc-dsn" value="pgsql://hostaddr='127.0.0.1' dbname='fifo' user=freeswitch password='123456' options='-c client_min_messages=NOTICE' application_name='freeswitch'" /></settings>
原创粉丝点击