Exporting queue_log data

This query lets you export the contents of the queue_log table in SQL format for inspection. Instead of exporting the whole table, it exports only the period specified.

/usr/bin/mysqldump \\
  -h localhost \\
  -u queuemetrics -p \\
  --databases queuemetrics \\
  --tables queue_log \\
  --where="time_id between \\
           unix_timestamp('2008-10-23 00:00:00') \\
       and unix_timestamp('2008-10-28 00:00:00')" \\
  > outfile.sql
When you run an export, make sure that you express the time period in GMT time, as that is usually the one used by Asterisk. If you have to send the file over for inspection, you can greatly reduce its size by compressing it, e.g.
bzip2 outfile.sql
This will create a file called ‘oufile.sql.bz2’. Continue Reading...



New server 100210

We are now running on a new web server that is located at Rackspace. Continue Reading...



Listening to multi-folder recordings in queuemetrics

It is possible to have QueueMetrics search for recordings in multiple directories, e.g. one directory for each day. This has the great advantage of being faster (because QueueMetrics does not have to scan through the whole file set) and more manageable (because you can easily move files around by date e.g. from a local volume to a NAS unit as needed). In order to do this, you have to configure “LocalFilesByDay” storage in QueueMetrics. In this example, we imagine that your recordings are held in a directory structure like /recordings/YYYY/MM/DD/myfile.wav It is also mandatory that all files have in their name the unique-id of the call that was recorded, so that QM can match audio files to calls. Continue Reading...



Storing audio files in subfolders

It is often useful to store audio recordings in different subfolders, e.g. per day. We imagine that you want to record queue traffic on an external volume called /recording . Continue Reading...



How to reboot a Draytek 2600 router

This recipe explains how to reboot a Draytek Vigor 2600 router from the Unix command line. Simply run the following command to reboot router 192.168.5.1 whith administrative user USER password PASS:

wget -O - "http://USER:PASS@192.168.5.1/cgi-bin/reboot.cgi?sReboot=Current&submit=++OK++"
You get a message like:
--14:17:50--  http://USER:*password*@192.168.5.1/cgi-bin/reboot.cgi?sReboot=Current&submit=++OK++
           => `-'
Connecting to 192.168.5.1:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://192.168.5.1/doc/reboot1.sht [following]
--14:17:51--  http://192.168.5.1/doc/reboot1.sht
           => `-'
Connecting to 192.168.5.1:80... connected.
HTTP request sent, awaiting response... 401 Unauthorized
Authorization failed.
and the router reboots immediately. Continue Reading...



Updating QueueMetrics using yum

If you did the original installation of QueueMetrics using yum, updating it is very easy. Continue Reading...



IPMI sensors under Debian

Monitoring hardware sensors can be extremely useful for a production server. Recent servers - in my case a quad-code HP ML310 G5 - often adhere to a standard called IPMI for hardware monitoring. My Debian kernel does not automatically load the required IPMI drivers, though the kernel modules are actually present with the distribuited kernel (in my case a 2.6.18-6-686-bigmem #1 SMP). In order to make them work, I have to manually load IPMI modules:

modprobe ipmi_si
modprobe ipmi_devintf
They will log on /var/log/messages the fact that they are being loaded. At the end you should get something like:
ml310:~# lsmod | grep ipmi
ipmi_devintf            9320  0
ipmi_si                34572  0
ipmi_msghandler        32288  2 ipmi_devintf,ipmi_si
Userland access tools are available in a standard Debian package called ipmitools
apt-get install ipmitools
Usage is quite easy… see below. Seeing which sensors are available
ml310:~# ipmitool -I open sdr list
Int. Health LED  | 0 unspecified     | ok
VRM (CPU1)       | 0 unspecified     | cr
CPU Fan          | 60.37 unspecifi | nc
Rear Fan         | 33.32 unspecifi | nc
Temp 1           | 24 degrees C      | ok
Temp 2           | 30 degrees C      | ok
Temp 3           | 19 degrees C      | ok
Getting sensor details
ml310:~# ipmitool -I open sdr get 'Temp 1'
Sensor ID              : Temp 1 (0x5)
 Entity ID             : 7.1 (System Board)
 Sensor Type (Analog)  : Temperature
 Sensor Reading        : 24 (+/- 0) degrees C
 Status                : ok
 Positive Hysteresis   : Unspecified
 Negative Hysteresis   : Unspecified
 Minimum sensor range  : -127.000
 Maximum sensor range  : Unspecified
 Event Message Control : Entire Sensor Only
 Readable Thresholds   :
 Settable Thresholds   : ucr unr
 Threshold Read Mask   : ucr unr
See also Continue Reading...



Compiling Asterisk on EPIA with VIA C3

Some EPIA boards are based on the VIA C3 processor, that is basically a clone of an i686 that does not support the whole instruction set. Therefore, in order to be sure that what you try to execute will actually work, you have to compile as if the processor were an i586, though Debian Etch thinks to be on an i686:

gimel:~/asterisk-1.4.18.1# uname -a
Linux gimel 2.6.18-5-486 #1 Fri Jun 1 00:07:22 UTC 2007 i686 GNU/Linux
As CentOS does not seem to be working on this kind of boards, we installed from scratch using a Debian compiled for i486, with the usual developement tools. As always, we need the kernerl headers in order to compile, so we run:
apt-get install linux-headers-2.6.18-5-486
As the deb archives seemed not to be able to download this package, we had to run an update in order to successfully install
apt-get update
apt-get install linux-headers-2.6.18-5-486
we then download the latest Asterisk version:
wget http://downloads.digium.com/pub/asterisk/releases/asterisk-1.4.18.1.tar.gz
wget http://downloads.digium.com/pub/zaptel/releases/zaptel-1.4.9.2.tar.gz
wget http://downloads.digium.com/pub/libpri/releases/libpri-1.4.3.tar.gz
We first start by compiling Zaptel. Note that we have to tell it explicitly to compile for i586, so we do:
tar zxvf zaptel-1.4.9.2.tar.gz
cd zaptel-1.4.9.2
./configure
Unfortunately, the configure command will not configure the architecture - at this point, we have to manually modify the Makefile in order to detect the ARCH used; look for the line where it defines ARCH, comment it and add a new one, as in:
#ARCH:=$(shell uname -m | sed -e s/i.86/i386/)
ARCH=i586
Now we export CFLAGS, so that GCC knows we want i586:
export CFLAGS="-march=i586"
And we proceed as usual:
make menuconfig
make
make install
cd ..
We now have to compile libpri, and again we want i586 code - it seems like there is no switch for that, but in CFLAGS we trust:
tar zxvf libpri-1.4.3.tar.gz
cd libpri-1.4.3
make
make install
cd ..
Now let’s go for Asterisk - Asterisk does have a handy switch for the configure script, but unfortunately it will not compile and crash with linking problems. Therefore we do:
cd asterisk-1.4.18.1
./configure --build=pentium
and then we edit the Makefile, so that we add explicit linking to libpthread and libresolv:
ASTLDFLAGS+=$(LDOPTS) -lpthread -lresolv
(One could have done that by export CFLAGS=”-lpthread -lresolv” ) and then we go on as usual:
make menuconfig
make
make install
make samples
The make part will be pretty slow - VIA C3’s are not exactly number-crunchers. That’s all there is - but finding it out took the best part of an afternoon. For your information, here is the show translations command for that machine:
         Translation times between formats (in milliseconds) for one second of data
          Source Format (Rows) Destination Format (Columns)

          g723 gsm ulaw alaw g726aal2 adpcm slin lpc10 g729 speex ilbc g726 g722
     g723    -   -    -    -        -     -    -     -    -     -    -    -    -
      gsm    -   -    6    6       15     6    5    26    -     -  110   15    -
     ulaw    -  23    -    1       11     2    1    22    -     -  106   11    -
     alaw    -  23    1    -       11     2    1    22    -     -  106   11    -
 g726aal2    -  32   11   11        -    11   10    31    -     -  115    1    -
    adpcm    -  23    2    2       11     -    1    22    -     -  106   11    -
     slin    -  22    1    1       10     1    -    21    -     -  105   10    -
    lpc10    -  55   34   34       43    34   33     -    -     -  138   43    -
     g729    -   -    -    -        -     -    -     -    -     -    -    -    -
    speex    -   -    -    -        -     -    -     -    -     -    -    -    -
     ilbc    -  43   22   22       31    22   21    42    -     -    -   31    -
     g726    -  31   10   10        1    10    9    30    -     -  114    -    -
     g722    -   -    -    -        -     -    -     -    -     -    -    -    -
See also: Continue Reading...