Page 295 - Asterisk™: The Future of Telephony
P. 295
Asterisk sources directory and run the ./configure script so it knows you have installed
unixODBC.
# cd /usr/src/asterisk-1.4
# make distclean
# ./configure
# make menuselect
# make install
Almost everything in this chapter is turned on by default. You will want
to run make menuselect to verify that the ODBC related modules are
enabled. These include cdr_odbc, func_odbc, func_realtime,
pbx_realtime, res_config_odbc, res_odbc. For voicemail stored in an
ODBC database, be sure to select ODBC_STORAGE from the Voicemail
Build Options menu. You can verify the modules exist in the /usr/lib/
asterisk/modules/ directory.
Configuring res_odbc for Access to Our Database
ODBC connections are configured in the res_odbc.conf file located in /etc/asterisk. The
res_odbc.conf file sets the parameters that the various Asterisk modules will use to
connect to the database. ‡
Modify the res_odbc.conf file:
[asterisk]
enabled => yes
dsn => asterisk-connector
username => asterisk
password => welcome
pooling => no
limit => 0
pre-connect => yes
The dsn option points at the database connection we configured in /etc/odbc.ini, and
the pre-connect option tells Asterisk to open up and maintain a connection to the
database when loading the res_odbc.so module. This lowers some of the overhead that
would come from repeatedly setting up and tearing down the connection to the
database.
Once you’ve configured res_odbc.conf, start Asterisk and verify the database connec-
tion with the odbc show CLI command:
*CLI> odbc show
Name: asterisk
DSN: asterisk-connector
‡ The pooling and limit options are quite useful for MS SQL Server and Sybase databases. These permit you
to establish multiple connections (up to limit connections) to a database while ensuring that each connection
has only one statement executing at once (this is due to a limitation in the protocol used by these database
servers).
Installing and Configuring ODBC | 267