FreeSWITCH High Availability Configuration Part 1 PostgreSQL in the core - luanrFreitas/freeswitch GitHub Wiki

install postgres & lib

apt-get install postgresql libpq-dev 

create core db user

/usr/sbin/useradd -d /home/freeswitchuser -m freeswitchuser

su to postgres

su - postgres

create user & db

$ createuser freeswitchuser
$ createdb -O freeswitchuser freeswitchcore

alter postgresql username and password for freeswitch user

psql freeswitchcore
alter user freeswitchuser with password 'mysecurepass';

check

su - freeswitchuser

exit postgersql db

\q
exit

Use postgrersql as FreeSWITCH coredb

vim /etc/freeswitch/autoload_configs/switch.conf.xml
<param name="core-db-dsn" value="pgsql://hostaddr=127.0.0.1 dbname=freeswitchcore user=freeswitchuser password='mysecurepass' options='-c client_min_messages=NOTICE' application_name='freeswitch'" />

restart freeswitch

fs_cli
fs_cli> fsctl shutdown restart now

check if database is created

su - freeswitchuser
psql freeswitchcore
freeswitchcore=> \dt