1. Installing the Database yum install -y postgresql-server
service postgresql start ----------------> to start the database
2. Create the user to connect to and manage the database
su - postgres
createuser -P
Enter name of user to add: asterisk
Enter password for new user:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
3. Let postgresql listen on the TCP/IP connection
vim /var/lib/pgsql/data/postgresql.conf
4. Allow the asterisk user to connect to the postgresql over TCP/IP connection
vim /var/lib/pgsql/data/pg_hba.conf
5. Create the Database
createdb --owner=asterisk asterisk
$ exit
# service postgresql restart
6. verify our connection to the PostgreSQL server via TCP/IP
# psql -h 127.0.0.1 -U asterisk Password
二,Installing and Configuring ODBC
# yum install -y unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel
vim /etc/odbcinst.ini
# odbcinst -q -d
vim /etc/odbc.ini
[asterisk-connector]
Description = PostgreSQL connection to 'asterisk' database
Driver = PostgreSQL
Database = asterisk
Servername = localhost
UserName = asterisk
Password = welcome
Port = 5432
Protocol = 7.4
ReadOnly = No
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
ConnSettings =
2 . verify that we can connect to our database using the isql application.
useradd asterisk
# su - asterisk
$ echo "select 1" | isql -v asterisk-connector
3.recompile Asterisk so that the ODBC modules are created and installed
# cd /usr/src/asterisk-1.4
# make distclean
# ./configure
# make menuselect
# make install
cdr_odbc, func_odbc, func_realtime,
pbx_realtime, res_config_odbc, res_odbc.
4. Configuring res_odbc for Access to Our Database
vim res_odbc.conf
[asterisk]
enabled => yes
dsn => asterisk-connector
username => asterisk
password => welcome
pooling => no
limit => 0
pre-connect => yes
*CLI> odbc show
Name: asterisk
DSN: asterisk-connector
5. Using Realtime
Dynamic Realtime
vim /etc/asterisk/extconfig.conf
; extconfig.conf
sippeers => driver,database[,table]
sippeers => odbc,asterisk,ast_sipfriends
sipusers => odbc,asterisk,ast_sipfriends
参考:the future of telephony
阅读(1526) | 评论(0) | 转发(0) |