Lee, John (Sydney)
2008-Oct-10 07:50 UTC
[asterisk-users] Compile logger-mysql.c with UNDEFINED REF to `mysql_error'
Sorry to post a C compile error on this mailing list but this is Asterisk related. Basically, I was following http://www.plack.net/index.php/2007/01/07/asterisk_modification_for_queu e_logging to patch logger.c and Makefile in Asterisk 1.4.* in order to write queue_log to mySQL database. When I ran make, it complained: In function `write_mysql_logger': [...] /usr/src/asterisk-1.4.21.2/main/logger-mysql.c:98: undefined reference to `mysql_error' [...] collect2: ld returned 1 exit status make[1]: *** [asterisk] Error 1 make: *** [main] Error 2 In my modified Makefile, I already had the line: ASTCFLAGS+=-I/usr/include/mysql and I found that mysql.h is already in /usr/include/mysql. I also already had mysql-client installed. In logger-mysql.c, there is already a line at the front of the program: #include <mysql.h> Any thoughts?
Atis Lezdins
2008-Oct-10 09:04 UTC
[asterisk-users] Compile logger-mysql.c with UNDEFINED REF to `mysql_error'
On Fri, Oct 10, 2008 at 10:50 AM, Lee, John (Sydney) <John.Lee at compuware.com> wrote:> Sorry to post a C compile error on this mailing list but this is > Asterisk related. > > Basically, I was following > http://www.plack.net/index.php/2007/01/07/asterisk_modification_for_queu > e_logging > > to patch logger.c and Makefile in Asterisk 1.4.* in order to write > queue_log to mySQL database. > > When I ran make, it complained: > In function `write_mysql_logger': > [...] > /usr/src/asterisk-1.4.21.2/main/logger-mysql.c:98: undefined reference > to `mysql_error' > [...] > collect2: ld returned 1 exit status > make[1]: *** [asterisk] Error 1 > make: *** [main] Error 2 > > In my modified Makefile, I already had the line: > ASTCFLAGS+=-I/usr/include/mysql > and I found that mysql.h is already in /usr/include/mysql. > > I also already had mysql-client installed. > > In logger-mysql.c, there is already a line at the front of the program: > #include <mysql.h> > > > Any thoughts?This looks really old and weird. I could suggest using realtime queue_log backport from 1.6 which i'm currently using. http://ftp.iq-labs.net/queue_log-1.4/asterisk_queue_log_realtime_1.4.19.patch This uses standardized realtime/mysql library from asterisk addons. For it to support SQL inserts in 1.4, you would also need to apply both patches from (1 for asterisk, another for asterisk-addons) http://ftp.iq-labs.net/realtime_store_destroy-1.4/ This will later allow you to upgrade to 1.6 and having everything working without patching. Regards, Atis -- Atis Lezdins, VoIP Project Manager / Developer, atis at iq-labs.net Skype: atis.lezdins Cell Phone: +371 28806004 Cell Phone: +1 800 7300689 Work phone: +1 800 7502835
Lee, John (Sydney)
2008-Oct-13 06:51 UTC
[asterisk-users] realtime queue_log to mySQL backport to 1.4
> http://ftp.iq-labs.net/queue_log- > 1.4/asterisk_queue_log_realtime_1.4.19.patch > > This uses standardized realtime/mysql library from asterisk addons. > For it to support SQL inserts in 1.4, you would also need to apply > both patches from (1 for asterisk, another for asterisk-addons) > > http://ftp.iq-labs.net/realtime_store_destroy-1.4/ > > This will later allow you to upgrade to 1.6 and having everything > working without patching.I have patched in asterisk 1.4 . main/logger.c . include/asterisk/config.h . main/config.c I have patched in asterisk-addons 1.4 . res/res_config_mysql.c I have re-installed asterisk and asterisk-addons. I created a database called db1 and in there created a table called queue_log as per instruction http://www.voip-info.org/wiki/view/Asterisk+queue_log+on+MySQL I changed /etc/asterisk/extconfig.conf to add the following line: [settings] queue_log => mysql,db1 I changed /etc/asterisk/res_mysql.conf to add the following: [general] dbhost = localhost dbname = db1 dbuser = user dbpass = password dbport = 3306 dbsock = /var/lib/mysql/mysql.sock 1) However, whenever I perform an agent login, no row is written to table queue_log. I checked /var/log/asterisk/queue_log and a new entry is written there. 2) I set debug to 10 on the console in asterisk and re-did the test but there were no error messages in /var/log/asterisk/messages. 3) I set debug on in mysqld and there are no information for inserting into table queue_log, except the cdr logging as below. Tcp port: 0 Unix socket: (null) Time Id Command Argument 081013 15:59:36 1 Connect user at localhost on db1 2 Connect user at localhost on db1 081013 16:00:32 1 Query INSERT INTO cdr_log ... 081013 16:01:42 1 Query INSERT INTO cdr_log ... Is there anyone who can help me?
Lee, John (Sydney)
2008-Oct-15 05:08 UTC
[asterisk-users] realtime queue_log to mySQL backport to 1.4
> You might want to double check the socket path. Some distributionsuse> /var/run/mysqld/mysqld.sock as the socket file.Thanks for the suggestion Tilghman. I am using Redhat and the socket file is indeed /var/run/mysql/mysqld.sock. Actually, if you specify the wrong socket file, you will see an mySQL Realtime error message in /var/log/asterisk/messages.