Page 293 - Asterisk™: The Future of Telephony
P. 293

\? for help on internal slash commands
                          \g or terminate with semicolon to execute query
                          \q to quit

                   asterisk=>
               Double-check your configuration as discussed earlier if you get the following error,
               which means connections via the TCP/IP socket are not allowed:
                   psql: could not connect to server: Connection refused
                   Is the server running on host "127.0.0.1" and accepting
                   TCP/IP connections on port 5432?

               Installing and Configuring ODBC

               The ODBC connector is a database abstraction layer that makes it possible for Asterisk
               to communicate with a wide range of databases without requiring the developers to
               create a separate database connector for every database Asterisk wants to support. This
               saves a lot of development effort and code maintenance. There is a slight performance
               cost to this because we are adding another application layer between Asterisk and the
               database. However, this can be mitigated with proper design and is well worth it when
               you need powerful, flexible database capabilities in your Asterisk system.
               Before we install the connector in Asterisk, we have to install ODBC into Linux itself.
               To install the ODBC drivers, simply run the command:
                   # yum install -y unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel


                           See Chapter 3 for the matrix of packages you should have installed.





               We need to install the unixODBC-devel package because it is used by Asterisk to create
               the ODBC modules we will be using throughout this chapter.
               Verify that you have the PostgreSQL ODBC driver configured in the /etc/odbcinst.ini
               file. It should look something like this:
                   [PostgreSQL]
                   Description     = ODBC for PostgreSQL
                   Driver          = /usr/lib/libodbcpsql.so
                   Setup           = /usr/lib/libodbcpsqlS.so
                   FileUsage       = 1
               Verify the system is able to see the driver by running the following command. It should
               return the label name PostgreSQL if all is well.

                   # odbcinst -q -d
                   [PostgreSQL]



                                                               Installing and Configuring ODBC | 265
   288   289   290   291   292   293   294   295   296   297   298