Asterisk mysql problem


#1

Hi All,

well as im sure most people do they get asterisk to work from flat files, yeah you can call phones and some times thats all good.

but ive started looking in to realtime and have come a little un stuck

ive created all the relevant mysql tables

cdr
extensions_table
sip_buddies
voicemail_users

and have created the user name and password for the database connect statement. so everything is fine there, i can see the databases in mysql and i know the username and password is good for connection and i use this connection for other apps on my server.

Database changed
mysql> show tables
-> ;
±-------------------+
| Tables_in_asterisk |
±-------------------+
| cdr |
| extensions_table |
| sip_buddies |
| voicemail_users |
±-------------------+
4 rows in set (0.00 sec)

so that side is fine, but i still cant get the snom 190’s i have to register, i then look in asterisk log in var/log/asterisk then message and i get this.

Feb 24 16:43:11 ERROR[17189] res_config_mysql.c: MySQL RealTime: Failed to connect database server asterisk on 62.24.228.231. Check debug for more info.
Feb 24 16:48:11 ERROR[17189] res_config_mysql.c: MySQL RealTime: Failed to connect database server asterisk on 62.24.228.231. Check debug for more info.
Feb 24 16:53:11 ERROR[17189] res_config_mysql.c: MySQL RealTime: Failed to connect database server asterisk on 62.24.228.231. Check debug for more info.

i understand mysql cant connect to the server, but what i cant understand is how to debug this problem. i know i have set everything else up corectly but i need to find this problem out.

also could some one comment whether i would be best dropping asterisk 1.2 and moving to using asterisk@home

cheers

Alan


#2

if you want to use realtime, A@H isn’t going to help you.

have you modified logger.conf so that debug info is written to/var/log/asterisk/full ? do you get any more info there ? you haven’t posted your connection details, so it’s hard to compare them to known working examples :smiley:


#3

Baconbuttie,

thanks for your reply, the follwoing configs are apparant in my realtime workings.

res_mysql.conf

; ; Sample configuration for res_config_mysql.c ; ; The value of dbhost may be either a hostname or an IP address. ; If dbhost is commented out or the string "localhost", a connection ; to the local host is assumed and dbsock is used instead of TCP/IP ; to connect to the server. ; [general] dbhost=localhost dbname=asterisk dbuser=admin dbpass=****** dbport=3306 dbsock=/var/run/mysqld/mysqld.sock

cdr_mysql.conf

; ; Note - if the database server is hosted on the same machine as the ; asterisk server, you can achieve a local Unix socket connection by ; setting hostname=localhost ; ; port and sock are both optional parameters. If hostname is specified ; and is not "localhost", then cdr_mysql will attempt to connect to the ; port specified or use the default port. If hostname is not specified ; or if hostname is "localhost", then cdr_mysql will attempt to connect ; to the socket file specified by sock or otherwise use the default socket ; file. ; [global] hostname=localhost dbname=asterisk table=cdr password=******* user=admin port=3306 dbsock=/var/run/mysqld/mysqld.sock userfield=1

i imagine all the other configs i have are relative to the realtime application i am trying to use, as in extensions and voicemail etc etc.

if any one has any spare time to show me the basics of getting this realtime running it would be much appreciated. i enjoy this sort of challenge but its been 2 days now and i still cant find my answer.

one more thing, all my other apps connection via localhost etc and they have no probs, have i missed a config in asterisk to enable localhost for communication, there must be something i missed.

many thanks in advance

Alan


#4

ok,

here is the debuf log, says user is invalid to connect to mysql server, which i realy cant under stand, i setup a user a asterisk and a password. i can then connect to the mysql console using that user and pass but i come to use it in asterisk i get this…

Feb 25 00:13:53 DEBUG[24070] res_musiconhold.c: killing 24103! Feb 25 00:13:53 DEBUG[24070] res_musiconhold.c: mpg123 pid 24103 and child died after 0 bytes read Feb 25 00:13:54 DEBUG[24197] cdr_addon_mysql.c: cdr_mysql: got hostname of 62.24.228.231 Feb 25 00:13:54 DEBUG[24197] cdr_addon_mysql.c: cdr_mysql: got port of 3306 Feb 25 00:13:54 DEBUG[24197] cdr_addon_mysql.c: cdr_mysql: got a timeout of 0 Feb 25 00:13:54 DEBUG[24197] cdr_addon_mysql.c: cdr_mysql: got user of asterisk Feb 25 00:13:54 DEBUG[24197] cdr_addon_mysql.c: cdr_mysql: got dbname of asterisk Feb 25 00:13:54 DEBUG[24197] cdr_addon_mysql.c: cdr_mysql: got password of ******* Feb 25 00:13:54 DEBUG[24197] res_config_mysql.c: MySQL RealTime Host: 62.24.228.231 Feb 25 00:13:54 DEBUG[24197] res_config_mysql.c: MySQL RealTime Port: 3306 Feb 25 00:13:54 DEBUG[24197] res_config_mysql.c: MySQL RealTime User: asterisk Feb 25 00:13:54 DEBUG[24197] res_config_mysql.c: MySQL RealTime Password: ******* Feb 25 00:13:54 DEBUG[24197] res_config_mysql.c: MySQL RealTime: Cannot Connect: Access denied for user: 'asterisk@62.24.228.231' to database$ Feb 25 00:13:54 DEBUG[24197] res_config_mysql.c: MySQL RealTime: Cannot Connect: Access denied for user: 'asterisk@62.24.228.231' to database$ Feb 25 00:13:54 DEBUG[24197] pbx_dundi.c: Seeding global EID '00:06:5b:1a:3f:19' from 'eth0' Feb 25 00:13:54 DEBUG[24197] app_voicemail.c: VM Review Option disabled globally Feb 25 00:13:54 DEBUG[24197] app_voicemail.c: VM Operator break disabled globally Feb 25 00:13:54 DEBUG[24197] app_voicemail.c: VM CID Info before msg disabled globally Feb 25 00:13:54 DEBUG[24197] app_voicemail.c: ENVELOPE before msg enabled globally Feb 25 00:13:54 DEBUG[24197] app_voicemail.c: Duration info before msg enabled globally Feb 25 00:13:54 DEBUG[24197] app_voicemail.c: We are not going to skip to the next msg after save/delete

can some one tell me the best way to resolve this, as in amini guide to adding a user that can connect im not sure if the user asterisk has the proper permission. i useed the following command to try and correct this

INSERT INTO user -> VALUES('62.24.228.231','asterisk',PASSWORD('*******), -> 'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');

that actually didnt work, so i tried this instead

and that didnt work either, does any one know the proper grant commands in mysql, as i am used to using a hosting control panel like plesk to do this sort of job.


#5

i dont beleive it,

after checking everything thorugh i came to this my current mysql socket was…

and when looking in to my.cnf in .etc the actual local socket for mysql was

oh well i now have the following in the debug log

Feb 25 00:44:49 DEBUG[25411] res_musiconhold.c: killing 25441! Feb 25 00:44:49 DEBUG[25411] res_musiconhold.c: mpg123 pid 25441 and child died after 0 bytes read Feb 25 00:44:49 DEBUG[25537] cdr_addon_mysql.c: cdr_mysql: got hostname of localhost Feb 25 00:44:49 DEBUG[25537] cdr_addon_mysql.c: cdr_mysql: got port of 3306 Feb 25 00:44:49 DEBUG[25537] cdr_addon_mysql.c: cdr_mysql: got a timeout of 0 Feb 25 00:44:49 DEBUG[25537] cdr_addon_mysql.c: cdr_mysql: got user of root Feb 25 00:44:49 DEBUG[25537] cdr_addon_mysql.c: cdr_mysql: got dbname of asterisk Feb 25 00:44:49 DEBUG[25537] cdr_addon_mysql.c: cdr_mysql: got password of ******* Feb 25 00:44:49 DEBUG[25537] cdr_addon_mysql.c: Successfully connected to MySQL database. Feb 25 00:44:49 DEBUG[25537] res_config_mysql.c: MySQL RealTime Host: localhost Feb 25 00:44:49 DEBUG[25537] res_config_mysql.c: MySQL RealTime Port: 3306 Feb 25 00:44:49 DEBUG[25537] res_config_mysql.c: MySQL RealTime User: root Feb 25 00:44:49 DEBUG[25537] res_config_mysql.c: MySQL RealTime Password: ******* Feb 25 00:44:49 DEBUG[25537] res_config_mysql.c: MySQL RealTime: Successfully connected to database. Feb 25 00:44:49 DEBUG[25537] pbx_dundi.c: Seeding global EID '00:06:5b:1a:3f:19' from 'eth0' Feb 25 00:44:50 DEBUG[25537] app_voicemail.c: VM Review Option disabled globally Feb 25 00:44:50 DEBUG[25537] app_voicemail.c: VM Operator break disabled globally Feb 25 00:44:50 DEBUG[25537] app_voicemail.c: VM CID Info before msg disabled globally Feb 25 00:44:50 DEBUG[25537] app_voicemail.c: ENVELOPE before msg enabled globally Feb 25 00:44:50 DEBUG[25537] app_voicemail.c: Duration info before msg enabled globally Feb 25 00:44:50 DEBUG[25537] app_voicemail.c: We are not going to skip to the next msg after save/delete

well there you have, on to the next problems i may find

thanks any way guys

Alan