ubuntu16.04.3配置freeswitch1.6使用PostgreSQL

安裝 PostgreSQL

sudo apt-get -y install postgresql

創建存放表空間目錄

sudo mkdir -p /usr/local/freeswitch/db/psdb
sudo 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
#IPV4
host    all             all             0.0.0.0/0                 md5
#IPV6
host    all             all             ::/0                    md5

重啓ps

sudo /etc/init.d/postgresql restart

修改PostgreSQL密碼

sudo su - postgres
 postgres@ubuntu:~$ psql

postgres@ubuntu:~$ psql
psql (9.5.8)
Type "help" for help.

postgres=# \password
Enter 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;
SET
postgres=> create database freeswitch_core tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_internal tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_external tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_internal6 tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database sofia_reg_external6 tablespace freeswitch_space ;
CREATE DATABASE

postgres=> create database call_limit tablespace freeswitch_space ;
CREATE DATABASE
postgres=> create database fifo tablespace freeswitch_space ;
CREATE DATABASE

建立新用戶、角色
postgres=> create user freeswitch_core password '123456' createdb;
CREATE ROLE
postgres=> 

使用新用戶登入freeswitch_core數據庫
postgres=> \q
postgres@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>

您的支持,是我持續創作的動力!!!!
在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章