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

• Multiple readhandles and writehandles can be listed, in order of preference, to
                     perform failover when the primary handle cannot be contacted (limit of 5)
                   • prefix will remain unchanged
                  The current syntax in Asterisk 1.4 will continue to work in the backport, but will display
                  a deprecation warning in the version to follow. Support will eventually be removed.


               ODBC Voicemail


               Asterisk contains the ability to store voicemail inside the database using the ODBC
               connector. This is useful in a clustered environment where you want to abstract the
               voicemail data from the local system so that multiple Asterisk boxes have access to the
               same data. Of course, you have to take into consideration that you are centralizing a
               part of Asterisk, and you need to take actions to protect that data, such as regular
               backups, and possibly clustering the database backend using replication. If you are
               using PostgreSQL, there are some good projects for doing this: PGcluster (http://pgfoun
               dry.org/projects/pgcluster/) and Slony-I (http://gborg.postgresql.org/project/slony1/proj
               display.php).
               Asterisk stores the voicemail inside a Binary Large Object (BLOB). When retrieving the
               data, it pulls the information out of the BLOB and temporarily stores it on the hard
               drive while it is being played back to the user. Asterisk then removes the BLOB and
               records from the database when the user deletes the voicemail. Many databases, such
               as MySQL, contain native support for BLOBs, but PostgreSQL has a couple of extra
               steps required to utilize this functionality that we’ll explore in this section. When you’re
               done, you’ll be able to record, play back, and delete voicemail data from the database
               just as if it were stored on the local hard drive.


                           This section builds upon previous configuration sections in this chapter.
                           If  you  have  not  already  done  so,  be  sure  to  follow  the  steps  in  the
                           “Installing the Database” and “Installing and Configuring ODBC” sec-
                           tions  before  continuing.  In  the  “Installing  and  Configuring  ODBC”
                           section, be sure you have enabled ODBC_STORAGE in the menuselect system
                           under Voicemail Options.


               Creating the Large Object Type
               We have to tell PostgreSQL how to handle the large objects. This includes creating a
               trigger to clean up the data when we delete a record from the database that references
               a large object.

               Connect to the database as the asterisk user from the console:
                   # psql -h localhost -U asterisk asterisk
                   Password:


               286 | Chapter 12: Relational Database Integration
   309   310   311   312   313   314   315   316   317   318   319