[asterisk-users] MySQL Voicemail Storage Questions\Errors

Mike Hammett asterisk-users at ics-il.net
Fri Feb 22 18:28:56 CST 2008


I am running CentOS 5 with Asterisk 1.4.14.  I am trying to setup storage of voicemail messages into MySQL.  It is my understanding that I can only do this via ODBC.  I installed per http://www.voip-info.org/wiki/view/CentOS+5+and+Asterisk+1.4.x+installation  unixODBC unixODBC-devel libtool-ltdl libtool-ltdl-devel and mysql-connector-odbc. I reconfigured and built Asterisk, using menuconfig to turn on ODBC voicemail storage.  Here is the output of some config files:

[root at Aiur asterisk]# cat /etc/odbcinst.ini
# Example driver definitinions
#
#

# Included in the unixODBC package
#[PostgreSQL]
#Description    = ODBC for PostgreSQL
#Driver         = /usr/lib/libodbcpsql.so
#Setup          = /usr/lib/libodbcpsqlS.so
#FileUsage      = 1


# Driver from the MyODBC package
# Setup from the unixODBC package
[MySQL]
Description     = ODBC for MySQL
Driver          = /usr/lib64/libmyodbc3.so
Setup           = /usr/lib64/libodbcmyS.so
FileUsage       = 1
You have new mail in /var/spool/mail/root
[root at Aiur asterisk]# cat /etc/odbc.ini
[astrealtime]
Description     = Asterisk realtime FUNC_ODBC access
Driver          = MySQL
Socket          = /var/lib/mysql/mysql.sock
Server          = localhost
User            = astrealtime
Pass            = XXXX
Database        = asterisk
Option          = 3
[root at Aiur asterisk]# cat  /etc/asterisk/res_odbc.conf
;;; odbc setup file

; ENV is a global set of environmental variables that will get set.
; Note that all environmental variables can be seen by all connections,
; so you can't have different values for different connections.
[ENV]
INFORMIXSERVER => my_special_database
INFORMIXDIR => /opt/informix

; All other sections are arbitrary names for database connections.

[asterisk]
enabled => no
dsn => asterisk
;username => myuser
;password => mypass
pre-connect => yes


[mysql]
enabled => yes
dsn => MySQL-asterisk
username => astrealtime
password => XXXX
pre-connect => yes

; Certain servers, such as MS SQL Server and Sybase use the TDS protocol, which
; limits the number of active queries per connection to 1.  By setting up pools
; of connections, Asterisk can be made to work with these servers.
[sqlserver]
enabled => no
dsn => mickeysoft
pooling => yes
limit => 5
username => oscar
password => thegrouch
pre-connect => yes



[root at Aiur asterisk]# cat /etc/asterisk/voicemail.conf
odbcstorage=mysql
odbctable=voicemail_messages

[root at Aiur asterisk]# asterisk -vvv | grep odbc
  == Parsing '/etc/asterisk/res_odbc.conf': Found
[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:229 load_odbc_config: Adding ENV var: INFORMIXSERVER=my_special_database
[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:229 load_odbc_config: Adding ENV var: INFORMIXDIR=/opt/informix
[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
[Feb 22 18:21:46] WARNING[21214]: res_odbc.c:519 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[Feb 22 18:21:46] WARNING[21214]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:302 load_odbc_config: Registered ODBC class 'mysql' dsn->[MySQL-asterisk]
[Feb 22 18:21:46] NOTICE[21214]: res_odbc.c:684 load_module: res_odbc loaded.
res_odbc.so => (ODBC Resource)
[Feb 22 18:21:46] NOTICE[21214]: config.c:1250 ast_config_engine_register: Registered Config Engine odbc
res_config_odbc loaded.
res_config_odbc.so => (ODBC Configuration)
  == Parsing '/etc/asterisk/func_odbc.conf': Found
func_odbc.so => (ODBC lookups)
  == Parsing '/etc/asterisk/cdr_odbc.conf': Found
cdr_odbc.so => (ODBC CDR Backend)



[root at Aiur asterisk]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22 to server version: 5.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use asterisk;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> describe voicemail_messages;
+----------------+-------------+------+-----+---------+----------------+
| Field          | Type        | Null | Key | Default | Extra          |
+----------------+-------------+------+-----+---------+----------------+
| id             | int(11)     | NO   | PRI | NULL    | auto_increment |
| msgnum         | int(11)     | NO   |     | 0       |                |
| dir            | varchar(80) | YES  | MUL | NULL    |                |
| context        | varchar(80) | YES  |     | NULL    |                |
| macrocontext   | varchar(80) | YES  |     | NULL    |                |
| callerid       | varchar(40) | YES  |     | NULL    |                |
| origtime       | varchar(40) | YES  |     | NULL    |                |
| duration       | varchar(20) | YES  |     | NULL    |                |
| mailboxuser    | varchar(80) | YES  |     | NULL    |                |
| mailboxcontext | varchar(80) | YES  |     | NULL    |                |
| recording      | longblob    | YES  |     | NULL    |                |
+----------------+-------------+------+-----+---------+----------------+
11 rows in set (0.00 sec)

mysql> exit;
Bye







Here is an example of the errors I'm getting (ignore No route to destination, those phones just aren't on):



    -- Executing Goto("SIP/2441-ac047f90", "rwest|815XXXXXXX|1")
    -- Goto (rwest,815XXXXXXX,1)
    -- Executing NoOp("SIP/2441-ac047f90", "CallerID is "WIRELESS CALLER" <XXXXXXX>")
    -- Executing Dial("SIP/2441-ac047f90", "SIP/rwest200&SIP/rwest201&SIP/rwest202&SIP/rwest203|15")
[Feb 22 18:14:42] WARNING[21068]: app_voicemail.c:2233 inboxcount: Failed to obtain database object for 'asterisk'!
    -- Called rwest200
[Feb 22 18:14:42] WARNING[21149]: app_dial.c:1111 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination)
[Feb 22 18:14:42] WARNING[21149]: app_dial.c:1111 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination)
[Feb 22 18:14:42] WARNING[21149]: app_dial.c:1111 dial_exec_full: Unable to create channel of type 'SIP' (cause 3 - No route to destination)
[Feb 22 18:14:42] NOTICE[21068]: chan_sip.c:12414 handle_response_peerpoke: Peer 'rwest200' is now Reachable. (37ms / 2000ms)
    -- SIP/rwest200-19612180 is ringing
[Feb 22 18:14:53] WARNING[21068]: app_voicemail.c:2233 inboxcount: Failed to obtain database object for 'asterisk'!
    -- Nobody picked up in 15000 ms
[Feb 22 18:14:57] NOTICE[21149]: cdr.c:434 ast_cdr_free: CDR on channel 'SIP/rwest200-19612180' not posted
    -- Executing BackGround("SIP/2441-ac047f90", "/var/lib/asterisk/sounds/rwestgreeting")
    -- <SIP/2441-ac047f90> Playing '/var/lib/asterisk/sounds/rwestgreeting' (language 'en')
[Feb 22 18:15:04] WARNING[21068]: app_voicemail.c:2233 inboxcount: Failed to obtain database object for 'asterisk'!
  == CDR updated on SIP/2441-ac047f90
    -- Executing Voicemail("SIP/2441-ac047f90", "200 at rwest|u")
[Feb 22 18:15:09] WARNING[21149]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:09] WARNING[21149]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:09] WARNING[21149]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'asterisk'!
    -- <SIP/2441-ac047f90> Playing 'vm-theperson' (language 'en')
    -- <SIP/2441-ac047f90> Playing 'digits/2' (language 'en')
    -- <SIP/2441-ac047f90> Playing 'digits/0' (language 'en')
    -- <SIP/2441-ac047f90> Playing 'digits/0' (language 'en')
    -- <SIP/2441-ac047f90> Playing 'vm-isunavail' (language 'en')
    -- <SIP/2441-ac047f90> Playing 'vm-intro' (language 'en')
[Feb 22 18:15:15] WARNING[21068]: app_voicemail.c:2233 inboxcount: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:20] WARNING[21149]: app_voicemail.c:1187 last_message_index: Failed to obtain database object for 'asterisk'!
    -- <SIP/2441-ac047f90> Playing 'beep' (language 'en')
    -- Recording the message
    -- x=0, open writing:  /var/spool/asterisk/voicemail/rwest/200/tmp/me15Bl format: wav, 0x19652c30
[Feb 22 18:15:26] WARNING[21068]: app_voicemail.c:2233 inboxcount: Failed to obtain database object for 'asterisk'!
    -- User hung up
[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:1233 message_exists: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:1263 delete_file: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:1400 store_file: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:2277 messagecount: Failed to obtain database object for 'asterisk'!
[Feb 22 18:15:26] WARNING[21149]: app_voicemail.c:2277 messagecount: Failed to obtain database object for 'asterisk'!
  == Spawn extension (rwest, 300, 1) exited non-zero on 'SIP/2441-ac047f90'



----------
Mike Hammett
Intelligent Computing Solutions
http://www.ics-il.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080222/52243907/attachment-0001.htm 


More information about the asterisk-users mailing list