System information

context varchar(80),
macrocontext varchar(80),
callerid varchar(40),
origtime varchar(40),
duration varchar(20),
mailboxuser varchar(80),
mailboxcontext varchar(80),
recording lo,
label varchar(30),
"read" bool DEFAULT false,
flag varchar(10)
);
And now we need to associate a trigger with our newly created table in order to perform
cleanup whenever we change or delete a record in the voicemessages table:
CREATE TRIGGER vm_cleanup AFTER DELETE OR UPDATE ON voicemessages FOR EACH ROW
EXECUTE PROCEDURE vm_lo_cleanup();
ODBC Voicemail Storage Table Layout
We’ll be utilizing the voicemessages table for storing our voicemail information in an
ODBC-connected database. Table 16-6 describes the table configuration for ODBC
voicemail storage. If you’re using a PostgreSQL database, the table definition and large
object support were configured in the preceding section.
Table 16-6. ODBC voicemail storage table layout
Column name Column type
uniqueid Serial, primary key
dir Varchar 80
msgnum Integer
recording BLOB (Binary Large OBject)
context Varchar 80
macrocontext Varchar 80
callerid Varchar 40
origtime Varchar 40
duration Varchar 20
mailboxuser Varchar 80
mailboxcontext Varchar 80
label Varchar 30
read Boolean, default false
a
flag Varchar 10
a
read is a reserved word in both MySQL and PostgreSQL (and likely other databases), which means you need to escape the column name
when you create it. In MySQL this is done with backticks (`) around the word read when you create the table, and in PostgreSQL with
double quotes ("). In MS SQL you would use square brackets, e.g., [read].
ODBC Voicemail | 381