Asterisk real time(error)

hi

i m getting following error while configuring asterisk realtime with Mysql

Nov 14 03:29:53 ERROR[6448]: res_config_mysql.c:651 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on "localhost" (err 2005). Check debug for more info.
Nov 14 03:29:53 NOTICE[6448]: chan_sip.c:12487 reload_config: Unable to load config sip.conf

my configuration for extconfig.conf are as under

sip.conf => mysql,asterisk,sip_m

my configuration for res_mysql.conf

[general]
dbhost = "localhost"
dbname = asterisk
dbuser = myuser
dbpass = mypass
dbport = 3306
dbsock = /tmp/mysql.sock

i would be thankful to u…

as the message says … check debug for more info. turn on debug logging and see if it really does give you more.

i take it you’ve checked the MySQL server is actually running ?

yah mysql server is running. and i had made following change aswell but its still displaying same error…changes i have made r as under

res_mysql.conf

[general] 
dbhost = 127.0.0.1
dbname = asterisk 
dbuser = root
dbpass = 1223
dbport = 3306 
dbsock = /var/run/mysqld/mysqld.sock 

the debug log ? have you tried connecting from the console using mysqladmin with those credentials and host details ?

here is the result of debug reload

Reloading SIP
Nov 15 18:03:40[b] DEBUG[/b][5404]: res_config_mysql.c:405 config_mysql: MySQL RealTime: Static SQL: SELECT category, var_name, var_val, cat_metric FROM sip_m] WHERE filename='sip.conf' and commented=0 ORDER BY filename, cat_metric desc, var_metric asc, category, var_name, var_val, id
    -- Reloading module 'codec_gsm.so' (GSM/PCM16 (signed linear) Codec Translator)
  == Parsing '/etc/asterisk/codecs.conf': Found
Nov 15 18:03:40 ERROR[5404]: res_config_mysql.c:651 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on 127.0.0.1 (err 2003). Check debug for more info.
Nov 15 18:03:40 ERROR[5404]: res_config_mysql.c:651 mysql_reconnect: MySQL RealTime: Failed to connect database server asterisk on 127.0.0.1 (err 2003). Check debug for more info.
Nov 15 18:03:40[b] DEBUG[/b][5404]: res_config_mysql.c:652 mysql_reconnect: MySQL RealTime: Cannot Connect (2003): Can't connect to MySQL server on '127.0.0.1' (111)
Nov 15 18:03:40 NOTICE[5404]: chan_sip.c:12487 reload_config: Unable to load config sip.conf
Nov 15 18:03:40 NOTICE[5404]: chan_sip.c:12487 reload_config: Unable to load config sip.conf

i hav’nt tried it from mysql admin… :question:

Asterisk is unable to connect to your database.

  1. Check you mysqld.sock path…

  2. Use the mysql command line utility to verify the username and password is correct. ‘mysql -u USERNAME -p’ You will be prompted for a password.

  3. Make sure you have flushed privileges in mysql to ensure that your user is loaded from the table.

I bet you it is one of those…
-Cheers, Peter.

maybe you need to set the password with with OLD_PASSWORD flag? (for your mysql user)

mysql> SET PASSWORD FOR
-> ‘some_user’@‘some_host’ = OLD_PASSWORD(‘newpwd’);

thanks for reply…i follow ur suggestions and now its seems a bit better…and now i got this reply.

*CLI>
Nov 17 11:13:11
DEBUG[3113]: res_config_mysql.c:674 mysql_reconnect: MySQL RealTime: Everything is fine.
Nov 17 11:13:11 WARNING[3113]: res_config_mysql.c:415 config_mysql: MySQL RealTime: Failed to query database. Check debug for more info.
Nov 17 11:13:11 WARNING[3113]: res_config_mysql.c:415 config_mysql: MySQL RealTime: Failed to query database. Check debug for more info.

Nov 17 11:13:11 DEBUG[3113]:
res_config_mysql.c:416 config_mysql: MySQL RealTime: Query: SELECT category, var_name, var_val, cat_metric FROM sip_budd WHERE filename=‘sip.conf’ and commented=0 ORDER BY filename, cat_metric desc, var_metric asc, category, var_name, var_val, id

Nov 17 11:13:11 DEBUG[3113]:
res_config_mysql.c:417 config_mysql: MySQL RealTime: Query Failed because: Unknown column ‘category’ in 'field list’
Nov 17 11:13:11 NOTICE[3113]: chan_sip.c:12487 reload_config: Unable to load config sip.conf
Nov 17 11:13:11 NOTICE[3113]: chan_sip.c:12487 reload_config: Unable to load config sip.conf

configuration r as under

res_mysql.conf

[general]
dbhost = 127.0.0.1
dbname = asterisk
dbuser = root
dbpass = 123
dbport = 3306
dbsock = /var/lib/mysql/mysql.sock // (i found mysql sock here)

and set password for mysql

SET PASSWORD FOR
-> ‘root’@localhost’ = OLD_PASSWORD(‘123’); //(and its ok)

set privileges as

grant show databases on . to asterisk@localhost identified by 123;

extconfig.conf

sip.conf => mysql,asterisk,sip_budd

so…

Per this line:

res_config_mysql.c:417 config_mysql: MySQL RealTime: Query Failed because: Unknown column ‘category’ in ‘field list’

Your Query Failed. This means that your table is not setup properly.
You can see this with "Unknown column ‘category’ in ‘field list’ ". That is a basic SQL error pointing to the fact that ‘catagory’ is not a column in your table.

Not to be mean or anything, but it really does not seem like you have done any homework on this. A simple search in google for ‘asterisk realtime’ will lead you to several very good resources on this.

Please take a look at (and read it completely as some comments may suggest doing things a bit differently than those listed at the top of the document):

voip-info.org/wiki-Asterisk+RealTime

Good Luck. -Cheers, Peter.

make sure to read the realtime wiki…

did you even setup your database? did you setup the tables?

the asterisk realtime wiki has the DB structure that you need…

[quote=“dosti”]thanks for reply…i follow ur suggestions and now its seems a bit better…and now i got this reply.

*CLI>
Nov 17 11:13:11
DEBUG[3113]: res_config_mysql.c:674 mysql_reconnect: MySQL RealTime: Everything is fine.
Nov 17 11:13:11 WARNING[3113]: res_config_mysql.c:415 config_mysql: MySQL RealTime: Failed to query database. Check debug for more info.
Nov 17 11:13:11 WARNING[3113]: res_config_mysql.c:415 config_mysql: MySQL RealTime: Failed to query database. Check debug for more info.

Nov 17 11:13:11 DEBUG[3113]:
res_config_mysql.c:416 config_mysql: MySQL RealTime: Query: SELECT category, var_name, var_val, cat_metric FROM sip_budd WHERE filename=‘sip.conf’ and commented=0 ORDER BY filename, cat_metric desc, var_metric asc, category, var_name, var_val, id

Nov 17 11:13:11 DEBUG[3113]:
res_config_mysql.c:417 config_mysql: MySQL RealTime: Query Failed because: Unknown column ‘category’ in 'field list’
Nov 17 11:13:11 NOTICE[3113]: chan_sip.c:12487 reload_config: Unable to load config sip.conf
Nov 17 11:13:11 NOTICE[3113]: chan_sip.c:12487 reload_config: Unable to load config sip.conf

configuration r as under

res_mysql.conf

[general]
dbhost = 127.0.0.1
dbname = asterisk
dbuser = root
dbpass = 123
dbport = 3306
dbsock = /var/lib/mysql/mysql.sock // (i found mysql sock here)

and set password for mysql

SET PASSWORD FOR
-> ‘root’@localhost’ = OLD_PASSWORD(‘123’); //(and its ok)

set privileges as

grant show databases on . to asterisk@localhost identified by 123;

extconfig.conf

sip.conf => mysql,asterisk,sip_budd

so…[/quote]

hi

thanks alot i got it working query is secessful