[asterisk-users] MySQL Voicemail Storage Questions\Errors

Mike Hammett asterisk-users at ics-il.net
Thu Mar 13 08:51:21 CDT 2008


Thanks for the help.  I still had a misconfiguration in my res_odbc.conf, but I figured it out and it appears my voicemail storage is working.  I haven't had a chance to get to the phone on the extension I'm using for it.


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


  ----- Original Message ----- 
  From: Mike Hammett 
  To: Asterisk Users Mailing List - Non-Commercial Discussion 
  Sent: Tuesday, March 11, 2008 10:10 PM
  Subject: Re: [asterisk-users] MySQL Voicemail Storage Questions\Errors


  [root at Aiur asterisk]# cat /etc/odbc.ini
  [astrealtime]
  Description             = MySQL ODBC For Asterisk
  Trace           = Yes
  TraceFile               = /tmp/odbc.log
  Driver          = MySQL
  Server          = localhost
  User            = astrealtime
  Password                = XXXX
  Database                = asterisk
  Socket          = /var/lib/mysql/mysql.sock

  [root at Aiur asterisk]# cat /etc/odbcinst.ini
  [MySQL]
  Description             = ODBC for MySQL
  Driver          = /usr/lib/libmyodbc.so
  Setup           = /usr/lib/libodbcmyS.so
  UsageCount              = 4

  [MySQL ODBC 3.51 Driver]
  Description             = ODBC 3.51 for MySQL
  DRIVER          = /usr/lib/libmyodbc3.so
  SETUP           = /usr/lib/libmyodbc3S.so
  UsageCount              = 4

  [root at Aiur asterisk]# isql astrealtime astrealtime XXXX
  [ISQL]ERROR: Could not SQLConnect
  [root at Aiur asterisk]# locate libmyodbc
  /usr/lib64/libmyodbc3-3.51.12.so
  /usr/lib64/libmyodbc3.so
  /usr/lib64/libmyodbc3_r-3.51.12.so
  /usr/lib64/libmyodbc3_r.so
  [root at Aiur asterisk]# locate libodbcmyS
  /usr/lib/libodbcmyS.a
  /usr/lib/libodbcmyS.so
  /usr/lib/libodbcmyS.so.1
  /usr/lib/libodbcmyS.so.1.0.0
  /usr/lib64/libodbcmyS.a
  /usr/lib64/libodbcmyS.so
  /usr/lib64/libodbcmyS.so.1
  /usr/lib64/libodbcmyS.so.1.0.0
  [root at Aiur asterisk]# rpm -qa | grep odbc
  mysql-connector-odbc-3.51.12-2.2
  [root at Aiur asterisk]# rpm -qa | grep ODBC
  unixODBC-2.2.11-7.1
  unixODBC-2.2.11-7.1
  unixODBC-devel-2.2.11-7.1
  unixODBC-devel-2.2.11-7.1
  [root at Aiur asterisk]# mysql -u astrealtime -p
  Enter password:
  Welcome to the MySQL monitor.  Commands end with ; or \g.
  Your MySQL connection id is 484 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> show tables;
  +--------------------+
  | Tables_in_asterisk |
  +--------------------+
  | cdr                |
  | extensions_table   |
  | iax                |
  | queue_members      |
  | queues             |
  | sip                |
  | voicemail_messages |
  | voicemail_users    |
  +--------------------+
  8 rows in set (0.00 sec)


      -- Executing [s-NOANSWER at macro-stdexten:1] VoiceMail("SIP/9826-ac087500", "200 at ics|u") in new stack
  [Mar 11 21:29:36] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:29:36] WARNING[26144]: 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
  [Mar 11 21:29:36] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:29:36] WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'mysql'!
  [Mar 11 21:29:36] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:29:36] WARNING[26144]: 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
  [Mar 11 21:29:36] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:29:36] WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'mysql'!
  [Mar 11 21:29:36] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:29:36] WARNING[26144]: 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
  [Mar 11 21:29:36] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:29:36] WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'mysql'!
      -- <SIP/9826-ac087500> Playing 'vm-theperson' (language 'en')
      -- <SIP/9826-ac087500> Playing 'digits/2' (language 'en')
      -- <SIP/9826-ac087500> Playing 'digits/0' (language 'en')
      -- <SIP/9826-ac087500> Playing 'digits/0' (language 'en')
      -- <SIP/9826-ac087500> Playing 'vm-isunavail' (language 'en')
      -- <SIP/9826-ac087500> Playing 'vm-intro' (language 'en')
  [Mar 11 21:29:46] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:29:46] WARNING[26144]: 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
  [Mar 11 21:29:46] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:29:46] WARNING[26144]: app_voicemail.c:1187 last_message_index: Failed to obtain database object for 'mysql'!
      -- <SIP/9826-ac087500> Playing 'beep' (language 'en')
      -- Recording the message
      -- x=0, open writing:  /var/spool/asterisk/voicemail/ics/200/tmp/oDVLVZ format: wav49, 0x1230a0a0
      -- x=1, open writing:  /var/spool/asterisk/voicemail/ics/200/tmp/oDVLVZ format: gsm, 0x122ea400
      -- x=2, open writing:  /var/spool/asterisk/voicemail/ics/200/tmp/oDVLVZ format: wav, 0x122f3740
      -- User hung up
  [Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:30:25] WARNING[26144]: 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
  [Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:30:25] WARNING[26144]: app_voicemail.c:1233 message_exists: Failed to obtain database object for 'mysql'!
  [Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:30:25] WARNING[26144]: 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
  [Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:30:25] WARNING[26144]: app_voicemail.c:1263 delete_file: Failed to obtain database object for 'mysql'!
  [Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:30:25] WARNING[26144]: 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
  [Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:30:25] WARNING[26144]: app_voicemail.c:1400 store_file: Failed to obtain database object for 'mysql'!
  [Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:30:25] WARNING[26144]: 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
  [Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:30:25] WARNING[26144]: app_voicemail.c:1122 retrieve_file: Failed to obtain database object for 'mysql'!
  [Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:30:25] WARNING[26144]: 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
  [Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:30:25] WARNING[26144]: app_voicemail.c:2277 messagecount: Failed to obtain database object for 'mysql'!
  [Mar 11 21:30:25] NOTICE[26144]: res_odbc.c:508 odbc_obj_connect: Connecting mysql
  [Mar 11 21:30:25] WARNING[26144]: 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
  [Mar 11 21:30:25] WARNING[26144]: res_odbc.c:444 ast_odbc_request_obj: Failed to connect to mysql
  [Mar 11 21:30:25] WARNING[26144]: app_voicemail.c:2277 messagecount: Failed to obtain database object for 'mysql'!
    == Spawn extension (macro-stdexten, s-NOANSWER, 1) exited non-zero on 'SIP/9826-ac087500' in macro 'stdexten'
    == Spawn extension (macro-stdexten, s-NOANSWER, 1) exited non-zero on 'SIP/9826-ac087500'



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


    ----- Original Message ----- 
    From: Mike Hammett 
    To: Asterisk Users Mailing List - Non-Commercial Discussion 
    Sent: Friday, February 22, 2008 7:28 PM
    Subject: [asterisk-users] MySQL Voicemail Storage Questions\Errors


    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


------------------------------------------------------------------------------


  _______________________________________________
  -- Bandwidth and Colocation Provided by http://www.api-digital.com --

  asterisk-users mailing list
  To UNSUBSCRIBE or update options visit:
     http://lists.digium.com/mailman/listinfo/asterisk-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080313/df43d998/attachment.htm 


More information about the asterisk-users mailing list