Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-17 Thread Lee, John (Sydney)
 I did not know what I did but I bumped into something in the log that
says:
 [Oct 16 ...] ERROR[24536] res_config_mysql.c: MySQL RealTime: Ping
failed
 (2006).  Trying an explicit reconnect.
 [Oct 16 ...] DEBUG[24536] res_config_mysql.c: MySQL RealTime: Server
Error
 (2006): MySQL server has gone away
 [Oct 16 ...] DEBUG[24536] res_config_mysql.c: MySQL RealTime:
Successfully
 connected to database.
 
 However, I believe the problem has something to do with MySQL refusing
to
 talk to Asterisk.

That was my wrong assumption.
I checked res_config_mysql.c and the comments says:
/* MySQL likes to return an error, even if it reconnects successfully.
 * So the postman pings twice. */
if (mysql_ping(mysql) != 0  mysql_ping(mysql) != 0) {...}

So, at this stage, my res_config_mysql.c is still not writing anything
into table queue_log despite having: a) correct res_mysql.conf b)
extconfig.conf c) mysql up and running d) res_config_mysql.c start up
okay

I believe that it is because the following if condition in logger.c is
never met:

***if (ast_check_realtime(queue_log))***
   {
 va_start(ap, fmt);
 vsnprintf(qlog_msg, sizeof(qlog_msg), fmt, ap);
 va_end(ap);
 snprintf(time_str, sizeof(time_str), %ld, (long)time(NULL));
 ast_store_realtime(queue_log, time, time_str, callid, callid,

queuename, queuename, agent, agent, event,

 event, data, qlog_msg, NULL);

Does anyone know what does ast_check_realtime do?
Is there a developer mailing list I can try?



___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-17 Thread Tilghman Lesher
On Friday 17 October 2008 01:09:18 Lee, John (Sydney) wrote:
 So, at this stage, my res_config_mysql.c is still not writing anything
 into table queue_log despite having: a) correct res_mysql.conf b)
 extconfig.conf c) mysql up and running d) res_config_mysql.c start up
 okay

 I believe that it is because the following if condition in logger.c is
 never met:

 ***if (ast_check_realtime(queue_log))***
{
  va_start(ap, fmt);
  vsnprintf(qlog_msg, sizeof(qlog_msg), fmt, ap);
  va_end(ap);
  snprintf(time_str, sizeof(time_str), %ld, (long)time(NULL));
  ast_store_realtime(queue_log, time, time_str, callid, callid,

 queuename, queuename, agent, agent, event,

  event, data, qlog_msg, NULL);

 Does anyone know what does ast_check_realtime do?

ast_check_realtime simply verifies that you have an entry in extconfig.conf
called queue_log at the time of last reload.  In other words, it's a check
to ensure that you have a realtime mapping.

-- 
Tilghman

___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-16 Thread Lee, John (Sydney)
 Also i would suggest enabling full log, as it's one place you can see
 everything. Then use grep to search for realtime messages. Your
 logger.conf should already have commented line:
 
 full = notice,warning,error,debug,verbose

Yes, I did that.

 # tail -fn0 /var/log/asterisk/full | grep -F res_config_mysql
 to see every message about realtime driver.

Still, I did not get any hit on res_config_mysql when I do an
AddQueueMember or RemoveQueueMember.
When I restarted Asterisk, I saw:
[Oct 16 ...] DEBUG[24880] res_config_mysql.c: MySQL RealTime Host:
localhost
[Oct 16 ...] DEBUG[24880] res_config_mysql.c: MySQL RealTime Port: 3306
[Oct 16 ...] DEBUG[24880] res_config_mysql.c: MySQL RealTime User: uid
[Oct 16 ...] DEBUG[24880] res_config_mysql.c: MySQL RealTime Password:
pwd
[Oct 16 ...] DEBUG[24880] res_config_mysql.c: MySQL RealTime:
Successfully connected to database.
[Oct 16 ...] NOTICE[24880] config.c: Registered Config Engine mysql
[Oct 16 ...] VERBOSE[24880] logger.c: MySQL RealTime driver loaded.
[Oct 16 ...] VERBOSE[24880] logger.c: res_config_mysql.so = (MySQL
RealTime Configuration Driver)

They all looked fine on startup.

I did not know what I did but I bumped into something in the log that
says:
[Oct 16 ...] ERROR[24536] res_config_mysql.c: MySQL RealTime: Ping
failed (2006).  Trying an explicit reconnect.
[Oct 16 ...] DEBUG[24536] res_config_mysql.c: MySQL RealTime: Server
Error (2006): MySQL server has gone away
[Oct 16 ...] DEBUG[24536] res_config_mysql.c: MySQL RealTime:
Successfully connected to database.

Then I recalled seeing something on the Internet about MySQL timing out
on connection from Asterisk.  

I created a /etc/my.cnf and bung in something like below and restarted
both mysql and Asterisk.

[mysqld]

...
wait_timeout=60
connect_timeout=10
interactive_timeout=120

but it still does not work.

However, I believe the problem has something to do with MySQL refusing
to talk to Asterisk.
The funny thing is I never had any problem with cdr_addon_mysql.so

Maybe they work using different methodologies I reckon?

Any more thoughts?


___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-15 Thread Lee, John (Sydney)
Hi Atis,

 queue_log = mysql,asteriskcdrdb,queue_log 
 that is engine,database,table
 If it's wrong, you should see some warnings when asterisk is starting
up.

Thanks for the suggestion.  I did not put in queue_log for table and
it has just taken the default which is queue_log.
In the console startup, you can see below that it has successfully bound
queue_log to /mysql/db1/queue_log.

# asterisk -rvvv
Asterisk 1.4.21.2, Copyright (C) 1999 - 2008 Digium, Inc. and others.
[...]
  == Parsing '/etc/asterisk/extconfig.conf': Found
  == Binding queue_log to mysql/db1/queue_log
Connected to Asterisk 1.4.21.2 currently running on machine
Verbosity is at least 3

In /var/log/asterisk/messages, I saw:
[Oct 15 15:31:48] NOTICE[20941] config.c: Registered Config Engine mysql

 Another idea that came into my mind is, that (if this config doesn't
 still work) you might have to do make dist-clean within
 asterisk-addons after reinstalling asterisk, and then configure, make,
 make install. It's because addons do use headers from installed
 version of asterisk, and they might not have correct declarations.


Basically, I did:
- Asterisk-1.4.21.2 
make clean
./configure
make
make install

- Asterisk-addons-1.4.7 
make dist-clean
./configure
make
make install

 Also, you mentioned that you checked /var/log/asterisk/messages,
 however i think debug is written into file called debug. Anyway you
 can enable full in logger.conf and get everything there. To debug
 this you shouldn't need more than core set verbose 3 and core set
 debug 1.

I turned on debug mode and tried an agent login and logoff.
However, when I looked into debug and messages, there are lots of
chan_sip.c and a few cdr_addon_mysql.c but no occurrence at all of
res_config_mysql.c

What is happening?  Do I have to explicitly load it?

*CLI module show like res_config_mysql
Module  Description  Use
Count
res_config_mysql.so MySQL RealTime Configuration Driver  0
1 modules loaded


___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-15 Thread Atis Lezdins
Hi John,

this is getting quite strange, and i'm becoming quite curios why it's
not working :)

Could you try first setting up realtime for SIP or queues? This should
work out-of-the-box on 1.4.

http://www.voip-info.org/wiki/view/Asterisk+RealTime+Sip
http://www.voip-info.org/wiki/view/Asterisk+RealTime+Queue

For beginning you can just add queues=.. in extconfig.conf to see
that SQLs go trough and return errors.

You should see SELECT's in your log whenever accessing.

For example, entering into CLI:
ast-dev14*CLI queue show myqueue

would write into log:
[Oct 15 04:04:09] DEBUG[9935] res_config_mysql.c: MySQL RealTime:
Everything is fine.
[Oct 15 04:04:09] DEBUG[9935] res_config_mysql.c: MySQL RealTime:
Retrieve SQL: SELECT * FROM queue_table WHERE name = 'myqueue'

Also i would suggest enabling full log, as it's one place you can see
everything. Then use grep to search for realtime messages. Your
logger.conf should already have commented line:

full = notice,warning,error,debug,verbose

Then you can do:
# tail -fn0 /var/log/asterisk/full | grep -F res_config_mysql
to see every message about realtime driver.

After this you can unload and load module or restart asterisk
completely (if restarting, make sure it's started with -vvvd).

To reload module, use:
ast-dev14*CLI module unload res_config_mysql.so
MySQL RealTime unloaded.
ast-dev14*CLI module load res_config_mysql.so
  == Parsing '/etc/asterisk/res_mysql.conf': Found
MySQL RealTime driver loaded.
 Loaded res_config_mysql.so = (MySQL RealTime Configuration Driver)


On Wed, Oct 15, 2008 at 9:05 AM, Lee, John (Sydney)
[EMAIL PROTECTED] wrote:
 Hi Atis,

 queue_log = mysql,asteriskcdrdb,queue_log
 that is engine,database,table
 If it's wrong, you should see some warnings when asterisk is starting
 up.

 Thanks for the suggestion.  I did not put in queue_log for table and
 it has just taken the default which is queue_log.
 In the console startup, you can see below that it has successfully bound
 queue_log to /mysql/db1/queue_log.

 # asterisk -rvvv
 Asterisk 1.4.21.2, Copyright (C) 1999 - 2008 Digium, Inc. and others.
 [...]
  == Parsing '/etc/asterisk/extconfig.conf': Found
  == Binding queue_log to mysql/db1/queue_log
 Connected to Asterisk 1.4.21.2 currently running on machine
 Verbosity is at least 3

This seems somehow strange. If you connect to running asterisk with
-r, you shouldn't see parsing extconfig.conf, as it should be parsed
on startup time. You could also add -d to enable debug 1.


 In /var/log/asterisk/messages, I saw:
 [Oct 15 15:31:48] NOTICE[20941] config.c: Registered Config Engine mysql

 Another idea that came into my mind is, that (if this config doesn't
 still work) you might have to do make dist-clean within
 asterisk-addons after reinstalling asterisk, and then configure, make,
 make install. It's because addons do use headers from installed
 version of asterisk, and they might not have correct declarations.


 Basically, I did:
 - Asterisk-1.4.21.2
 make clean
 ./configure
 make
 make install

 - Asterisk-addons-1.4.7
 make dist-clean
 ./configure
 make
 make install

Yes, this is completely correct (assuming you restarted asterisk after :)


 Also, you mentioned that you checked /var/log/asterisk/messages,
 however i think debug is written into file called debug. Anyway you
 can enable full in logger.conf and get everything there. To debug
 this you shouldn't need more than core set verbose 3 and core set
 debug 1.

 I turned on debug mode and tried an agent login and logoff.
 However, when I looked into debug and messages, there are lots of
 chan_sip.c and a few cdr_addon_mysql.c but no occurrence at all of
 res_config_mysql.c

 What is happening?  Do I have to explicitly load it?

 *CLI module show like res_config_mysql
 Module  Description  Use
 Count
 res_config_mysql.so MySQL RealTime Configuration Driver  0
 1 modules loaded

This should also be fine.

You could also try catching me on irc, just look for atis_work or
atis_home in #asterisk.

Regards,
Atis

-- 
Atis Lezdins,
VoIP Project Manager / Developer,
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835

___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-14 Thread Tilghman Lesher
On Monday 13 October 2008 18:57:41 Lee, John (Sydney) wrote:
 By the way, did you see anything wrong with my config files?

 /etc/asterisk/res_mysql.conf
 [general]
 dbhost = localhost
 dbname = db1
 dbuser = user
 dbpass = password
 dbport = 3306
 dbsock = /var/lib/mysql/mysql.sock

You might want to double check the socket path.  Some distributions use
/var/run/mysqld/mysqld.sock as the socket file.

-- 
Tilghman

___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-14 Thread Atis Lezdins
Hi John,

On Tue, Oct 14, 2008 at 3:36 AM, Lee, John (Sydney)
[EMAIL PROTECTED] wrote:
 if you have applied everything correctly - queue_log file shoudln't
 have any more lines (except init when restarting asterisk).

 Thanks Atis.
 I see what you are saying.  In the patch for logger.c,

 The code to write to mysql is there except that we need to perform
 ast_check_realtime(queue_log).

 I guess ast_check_realtime() is looking into extconfig.conf and
 searching for
 queue_log = mysql,db1

Ok, after another check this seems wrong. For me it's:

queue_log = mysql,asteriskcdrdb,queue_log

that is engine,database,table

If it's wrong, you should see some warnings when asterisk is starting up.

Another idea that came into my mind is, that (if this config doesn't
still work) you might have to do make dist-clean within
asterisk-addons after reinstalling asterisk, and then configure, make,
make install. It's because addons do use headers from installed
version of asterisk, and they might not have correct declarations.

Also, you mentioned that you checked /var/log/asterisk/messages,
however i think debug is written into file called debug. Anyway you
can enable full in logger.conf and get everything there. To debug
this you shouldn't need more than core set verbose 3 and core set
debug 1.

Regards,
Atis


 which is there in my extconfig.conf already.

 Can any Asterisk developers enlighten me on this?



 void ast_queue_log(const char ...)
  {
 +   char qlog_msg[8192];
 +   char time_str[16];
 +
 +   if (ast_check_realtime(queue_log)) {
va_start(ap, fmt);
 +   vsnprintf(qlog_msg, sizeof(qlog_msg), fmt, ap);
va_end(ap);
 +
 +   snprintf(time_str, sizeof(time_str), %ld,
 (long)time(NULL));
 +   ast_store_realtime(queue_log, time, time_str,
 +   callid, callid,
 +   queuename, queuename,
 +   agent, agent,
 +   event, event,
 +   data, qlog_msg,
 +   NULL);
 +   } else {
 +   if (qlog) {
 +   AST_LIST_LOCK(logchannels);
 +   va_start(ap, fmt);
 +   fprintf(qlog, %ld|%s|%s|%s|%s|,
 (long)time(NULL), callid, queuename, agent, event);
 [...]
 +   }
}

 -Original Message-
 From: Atis Lezdins [mailto:[EMAIL PROTECTED]
 Sent: Monday, 13 October 2008 8:02 PM
 To: Lee, John (Sydney)
 Cc: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] realtime queue_log to mySQL backport to
 1.4

 Hi John,


 On Mon, Oct 13, 2008 at 9:51 AM, Lee, John (Sydney)
 [EMAIL PROTECTED] wrote:
  http://ftp.iq-labs.net/queue_log-
  1.4/asterisk_queue_log_realtime_1.4.19.patch

 Haven't you forgotten this one? ;)

 if you have applied everything correctly - queue_log file shoudln't
 have any more lines (except init when restarting asterisk).

 Regards,
 Atis

 
  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 CommandArgument
  081013 15:59:36   1 Connect [EMAIL PROTECTED] on db1
   2 Connect [EMAIL PROTECTED] 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

Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-14 Thread Lee, John (Sydney)
 You might want to double check the socket path.  Some distributions
use
 /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.


___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-13 Thread Atis Lezdins
Hi John,


On Mon, Oct 13, 2008 at 9:51 AM, Lee, John (Sydney)
[EMAIL PROTECTED] wrote:
 http://ftp.iq-labs.net/queue_log-
 1.4/asterisk_queue_log_realtime_1.4.19.patch

Haven't you forgotten this one? ;)

if you have applied everything correctly - queue_log file shoudln't
have any more lines (except init when restarting asterisk).

Regards,
Atis


 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 CommandArgument
 081013 15:59:36   1 Connect [EMAIL PROTECTED] on db1
  2 Connect [EMAIL PROTECTED] 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?





-- 
Atis Lezdins,
VoIP Project Manager / Developer,
[EMAIL PROTECTED]
Skype: atis.lezdins
Cell Phone: +371 28806004
Cell Phone: +1 800 7300689
Work phone: +1 800 7502835

___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-13 Thread Lee, John (Sydney)
Yes, I certainly applied the patch in
http://ftp.iq-labs.net/queue_log-1.4/asterisk_queue_log_realtime_1.4.19.
patch

Just to double-check, there is only one patch in this URL which is
main/logger.c

By the way, did you see anything wrong with my config files?

/etc/asterisk/extconfig.conf
[settings]
queue_log = mysql,db1

/etc/asterisk/res_mysql.conf
[general]
dbhost = localhost
dbname = db1
dbuser = user
dbpass = password
dbport = 3306
dbsock = /var/lib/mysql/mysql.sock


 -Original Message-
 From: Atis Lezdins [mailto:[EMAIL PROTECTED]
 Sent: Monday, 13 October 2008 8:02 PM
 To: Lee, John (Sydney)
 Cc: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] realtime queue_log to mySQL backport to
1.4
 
 Hi John,
 
 
 On Mon, Oct 13, 2008 at 9:51 AM, Lee, John (Sydney)
 [EMAIL PROTECTED] wrote:
  http://ftp.iq-labs.net/queue_log-
  1.4/asterisk_queue_log_realtime_1.4.19.patch
 
 Haven't you forgotten this one? ;)
 
 if you have applied everything correctly - queue_log file shoudln't
 have any more lines (except init when restarting asterisk).
 
 Regards,
 Atis
 
 
  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 CommandArgument
  081013 15:59:36   1 Connect [EMAIL PROTECTED] on db1
   2 Connect [EMAIL PROTECTED] 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?
 
 
 
 
 
 --
 Atis Lezdins,
 VoIP Project Manager / Developer,
 [EMAIL PROTECTED]
 Skype: atis.lezdins
 Cell Phone: +371 28806004
 Cell Phone: +1 800 7300689
 Work phone: +1 800 7502835


___
-- 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


Re: [asterisk-users] realtime queue_log to mySQL backport to 1.4

2008-10-13 Thread Lee, John (Sydney)
 if you have applied everything correctly - queue_log file shoudln't
 have any more lines (except init when restarting asterisk).

Thanks Atis.
I see what you are saying.  In the patch for logger.c, 

The code to write to mysql is there except that we need to perform
ast_check_realtime(queue_log).

I guess ast_check_realtime() is looking into extconfig.conf and
searching for 
queue_log = mysql,db1

which is there in my extconfig.conf already.

Can any Asterisk developers enlighten me on this?



void ast_queue_log(const char ...)
 {
+   char qlog_msg[8192];
+   char time_str[16];
+
+   if (ast_check_realtime(queue_log)) {
va_start(ap, fmt);
+   vsnprintf(qlog_msg, sizeof(qlog_msg), fmt, ap);
va_end(ap);
+
+   snprintf(time_str, sizeof(time_str), %ld,
(long)time(NULL));
+   ast_store_realtime(queue_log, time, time_str, 
+   callid, callid, 
+   queuename, queuename, 
+   agent, agent, 
+   event, event,
+   data, qlog_msg,
+   NULL);
+   } else {
+   if (qlog) {
+   AST_LIST_LOCK(logchannels);
+   va_start(ap, fmt);
+   fprintf(qlog, %ld|%s|%s|%s|%s|,
(long)time(NULL), callid, queuename, agent, event);
[...]
+   }
}

 -Original Message-
 From: Atis Lezdins [mailto:[EMAIL PROTECTED]
 Sent: Monday, 13 October 2008 8:02 PM
 To: Lee, John (Sydney)
 Cc: Asterisk Users Mailing List - Non-Commercial Discussion
 Subject: Re: [asterisk-users] realtime queue_log to mySQL backport to
1.4
 
 Hi John,
 
 
 On Mon, Oct 13, 2008 at 9:51 AM, Lee, John (Sydney)
 [EMAIL PROTECTED] wrote:
  http://ftp.iq-labs.net/queue_log-
  1.4/asterisk_queue_log_realtime_1.4.19.patch
 
 Haven't you forgotten this one? ;)
 
 if you have applied everything correctly - queue_log file shoudln't
 have any more lines (except init when restarting asterisk).
 
 Regards,
 Atis
 
 
  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 CommandArgument
  081013 15:59:36   1 Connect [EMAIL PROTECTED] on db1
   2 Connect [EMAIL PROTECTED] 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?
 
 
 
 
 
 --
 Atis Lezdins,
 VoIP Project Manager / Developer,
 [EMAIL PROTECTED]
 Skype: atis.lezdins
 Cell Phone: +371 28806004
 Cell Phone: +1 800 7300689
 Work phone: +1 800 7502835


___
-- 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