Using a HT-488 with Asterisk

The Grandstream HandyTone HT-488 is a low-cost SIP analog adapter that offers one FXS port and one FXO port to connect one analog telephone and one POTS line to the unit. The scenario We want to install the unit with an Asterisk server whick IP is 10.10.3.5 and want to register the telephone attached to the unit as SIP/32, while the FXO line will be seen by Asterisk as SIP/33. Installing the HT-488 As it ships, access for the web interface is disabled for users accessing from the WAN. To enable it, connect the LAN port of the unit to a PC with a cross-cable patch, use the unit’s own DHCP server to assign address to the PC and logon by navigating to http://192.168.2.1 (password admin ) - go to Basic settings and set WAN side http access. Save and reboot. Connect the unit to your LAN through the WAN port and connect to it through its DHCP-assigned address (to see what that is, connect a phone to the FXS port and digit **02** to have the unit read out the assigned IP address). If the unit did not get an IP address, select the option **01** and then 9 to switch from fixed-ip to DHCP mode. Firmware upgrade It is VERY IMPORTANT that you set the unit with a modern firmware, or you’ll have a number of problems. Luckily this is very easy: check the current TFTP server address on Grandsteram site (see below) and enter it under the configuration page, and set “Yes, check for upgrade every 1 minute”. Reboot. The unit light should go red while the unit downloads and installs the new firmware, it will take like 5 minutes to update. Unit configuration Continue Reading...



Tunnelling with PuTTY

When accessing a remote Unix system from a windows machine, it is very common to be given shell access via SSH. It is also very common to need being forwarder port 80 (for web configuration of the system) and port 8080 (for QueueMetrics); and this is a hassle to set up for remote system administrators who need to forward not one but three ports on their firewall. By using PuTTY, it is possible to enable “tunnelling”, so that one or more remote ports (endpoints) are connected to some other ports on the local machine. To do this, open up PuTTY and select : Continue Reading...



Generic QueueMetrics startup script

This is a general-use startup script that can be used to start and stop QueueMetrics on any Unix system:

#! /bin/bash
#
# This script starts and stops QueueMetrics
#

export JAVA_HOME=/mnt/hd1/j2sdk/jdk1.5.0_06
export JAVA_OPTS="-Xms256M -Xmx256M"
export TOMCAT=/mnt/hd1/tomcat



case "$1" in
  start)
        echo "Starting up QueueMetrics"
        echo "Using JAVA_HOME:       $JAVA_HOME"
        echo "Using JAVA_OPTS:       $JAVA_OPTS"

        $TOMCAT/bin/startup.sh
        ;;

  stop)
        echo "Shutting down QueueMetrics"
        $TOMCAT/bin/shutdown.sh
        ;;

  *)
        echo "Usage: $0 {start|stop}" >&2
        exit 1
        ;;
esac

exit 0
You should of course set the JAVA_HOME, JAVA_OPTS and TOMCAT variables as appropriate for your system. Automatic startup on Debian Just run:
chmod 755 /etc/init.d/queuemetrics
update-rc.d queuemetrics defaults
Automatic startup on RedHat Just run:
chkconfig –-add queuemetrics
To make sure it start in the right runlevels:
chkconfig –-list queuemetrics
If it does not, try again with:
chkconfig –-level 2345 queuemetrics on
Continue Reading...



Java translation encoding

Encoding a .properties file native2ascii -encoding ISO8859_1 src/$file dst/$file This even works on Win32 machines with Java installed. Continue Reading...



Removing unclosed entries from the queue_log

To find all single-event calls in your queue_log you can run the following query:

SELECT call_id, count( * ) , verb
FROM queue_log
WHERE partition = 'P001'
AND verb NOT IN (
'AGENTCALLBACKLOGIN', 'AGENTCALLBACKLOGOFF', 
'AGENTLOGIN', 'AGENTLOGOFF', 
'ADDMEMBER', 'REMOVEMEMBER', 
'PAUSEREASON', 'CALLSTATUS'
)
GROUP BY call_id
HAVING count( * ) = 1 
Change the partition as you see fit. Then you should delete them by call-id. Continue Reading...



Yum quick-start

Installing and removing yum install queuemetrics yum remove queuemetrics Installing from a local file yum localinstall queuemetrics.rpm yum localupdate queuemetrics.rpm Which packages match a certain name?

yum list grep -i queue
queuemetrics.noarch              1.4.2-29         installed
queuemetrics-java.i386           1_5_0_11-16      installed
queuemetrics-tomcat.noarch       5.0.28-9         installed
queuemetrics-java-debuginfo.i386 1_5_0_06-14      LowayResearch
Show the dependencies for a given package yum deplist queuemetrics Where does a file come from? yum provides /usr/local/queuemetrics/tomcat/RUNNING.txt It needs to download the filelists from each server, so it might be quite slow. Show package information yum info queuemetrics
Loading "installonlyn" plugin
Setting up repositories
Reading repository metadata in from local files
Installed Packages
Name   : queuemetrics
Arch   : noarch
Version: 1.4.2
Release: 29
Size   : 1.5 M
Repo   : installed
Summary: Loway QueueMetrics

Description:
A queue_log analyzer for Asterisk.
Continue Reading...



Compressing recorded calls to MP3

If you record a big chunk of traffic (or even all traffic, as some call-centers do) on your Asterisk box, you will see that it ends up taking a substantial amount of disk space. The problem is the following: Continue Reading...



Recording all outgoing traffic for some extensions

You want to record all outgoing traffic done by some extensions - not all extensions (it would be trivial) but just some of your choosing. You also want to be able to turn recordings on or off without modifying the dialplan. How to do it The idea is simple: we use Asterisk’s internal database to record a flag for each extension that tells us whether to record those calls or not. We add a check for this flag before dialling out, so we can catch all outgoing traffic. Modifying the dialplan Whenever you are currently dialing out (we assume that any number starting with 0 is an external call) you add the following piece of dialplan:

exten => _0.,1,NoOP,Dial out with hidden CLID
exten => _0.,2,SetCallerPres(prohib)
exten => _0.,3,DBGet(rec=registra/${CALLERIDNUM})
exten => _0.,4,GotoIf($[ ${rec} = 1 ]?10:20)
exten => _0.,10,MixMonitor(REC-${CALLERIDNUM}-${UNIQUEID}.wav|b|)
exten => _0.,11,Goto(20)
exten => _0.,20,Dial(Zap/g1/${EXTEN:1})
Deciding which extensions will be recorded Once your piece of dialplan is in place, you use the following command from the Asterisk CLI to tell Asterisk an extension is to be recorded:
database put registra 299 1
While you use the following to tell Asterisk an extension is not to be recorded anymore:
database put registra 299 0
If you want to know the status of your recorded extension, you type:
ast*CLI> database show registra
/registra/223                                     : 1
/registra/224                                     : 0
/registra/299                                     : 1
Any key that has value of 1 will be recorded; any other key (whether it has value 0 or does not exist) is not recorded. Finding recorded calls You can find the recorded calls by issuing the following command:
[root@ast monitor]# ls -l /var/spool/asterisk/monitor/REC*
-rw-r--r--  1 root root  186284 Aug  8 16:36 /var/spool/asterisk/monitor/REC-299-1186583777.73726.wav
-rw-r--r--  1 root root  206764 Aug  8 16:40 /var/spool/asterisk/monitor/REC-299-1186584038.73774.wav
And you can listen to them by copying them over to any audio software. Continue Reading...