Page 318 - Asterisk™: The Future of Telephony
P. 318
*CLI> sip show users like odbc_test_user
Username Secret Accountcode Def.Context ACL NAT
odbc_test_user supersecret odbc_vm_test No RFC3581
Then configure your phone or client with the username odbc_test_user and password
supersecret, and then place a call to extension 100 to leave a voicemail. If successful,
you should see something like:
-- Executing VoiceMail("SIP/odbc_test_user-10228cac", "1000@default") in new stack
-- Playing 'vm-intro' (language 'en')
-- Playing 'beep' (language 'en')
-- Recording the message
-- x=0, open writing: /var/spool/asterisk/voicemail/default/1000/tmp/dlZunm format:
wav49, 0x101f6534
-- User ended message by pressing #
-- Playing 'auth-thankyou' (language 'en')
== Parsing '/var/spool/asterisk/voicemail/default/1000/INBOX/msg0000.txt': Found
We can now make use of the psql application again to make sure the recording really
did make it into the database:
# psql -h localhost -U asterisk asterisk
Password:
Then run a SELECT statement to verify that you have some data in the voicemessages
table:
localhost=# SELECT id,dir,callerid,mailboxcontext,recording FROM voicemessages;
id | dir | callerid | mailboxcontext | recording
---+------------------------------------------+--------------+---------------+-------
1 | /var/spool/asterisk/voicemail/default/1000/INBOX | +18005551212 | default | 47395
(1 row)
If the recording was placed in the database, we should get a row back. You’ll notice
that the recording column contains a number (which will most certainly be different
from that listed here), which is really the object ID of the large object stored in a system
table. Let’s verify that the large object exists in this system table with the lo_list
command:
localhost=# \lo_list
Large objects
ID | Description
-------+-------------
47395 |
(1 row)
What we’re verifying is that the object ID in the voicemessages table matches that listed
in the large object system table. We can also pull the data out of the database and store
it to the hard drive so we can play the file back to make sure our message was saved
correctly:
localhost=# \lo_export 47395 /tmp/voicemail-47395.wav
lo_export
290 | Chapter 12: Relational Database Integration