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

Atis Lezdins atis at iq-labs.net
Tue Oct 14 03:54:42 CDT 2008


Hi John,

On Tue, Oct 14, 2008 at 3:36 AM, Lee, John (Sydney)
<John.Lee at compuware.com> 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:atis at iq-labs.net]
>> 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)
>> <John.Lee at compuware.com> 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 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?
>> >
>> >
>>
>>
>>
>> --
>> 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
>
>



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



More information about the asterisk-users mailing list