Compiling Asterisk 1.4 with TDM400 and H323

As a point of reference, we imagine you’re going to build your new Asterisk on a machine preinstalled with TrixBox; this means your machine is very easy to reinstall from scratch if anything goes wrong. This also means that you can start playing with Asterisk 1.4 in a virtual machine, so you have no risk. The first thing you have to do is to create a working directory for Asterisk (say /src/asterisk14) and use it as a base directory It will also be necessary to erase the existing Asterisk system - see Removing Asterisk. Make sure neither Asterisk nor its required libs and drivers (eg Zaptel) are running before attempting the installations. You’ll also need a bit more software:

  • The C++ developement environment
  • The Iksemel library, in order to test the Google Talk integration (we sure want that!)
  • The Gnu TLS package, as needed by Iksemel
  • Kernel development headers
Prerequisites Getting all this software is fairly easy to get installed, thanks to the very powerful yum installed that ships with CentOS:
yum install gcc-g++
yum install gnutls-devel
yum install kernel-devel
The first command may download and update quite a lot of stuff; don’t worry and let it run. Installing Iksemel You will then download the Iksemel v1.2 libary (http://code.google.com/p/iksemel/) and compile it like this:
wget http://iksemel.googlecode.com/files/iksemel-1.2.tar.gz
tar zxvf iksemel-1.2.tar.gz
cd iksemel-1.2
./configure
make
make install
cd ..
Checking you have the correct version of Make To make sure that you version of GNU Make is > 3.79, just run
[root@aleph asterisk]# make -v
GNU Make 3.81
If the version of Make is < 3.80, you should update it or Asterisk won’t compile - see http://forums.digium.com/viewtopic.php?t=12707. Most modern systems should not be affected by this, but this was the default version of make for RHEL 3 / CentOS 3; in this case, you should update it, either by using a RPM version or by compiling the new version of make right on your box. This should be very easy to do:
cp /usr/bin/make /usr/bin/make_OLD
wget http://ftp.gnu.org/pub/gnu/make/make-3.81.tar.gz
tar zxvf make-3.81.tar.gz
cd make-3.81
./configure
make
make install
cd ..

which make
make -v
If now you’re running Make 3.81, you’re just fine. Download and install OpenH323 libraries We have to download and install the correct version of OpenH323. Even if there is version 1.19 available as well, it does not seem to compile correctly, so we will use version 1.18. We will install manually just the shared library we need, so compilation is very easy.
wget http://downloads.sourceforge.net/openh323/pwlib-v1_10_3-src-tar.gz
tar zxvf pwlib-v1_10_3-src-tar.gz
cd pwlib_v1_10_3/
./configure
make
export PWLIBDIR=/src/asterisk-1.4/pwlib_v1_10_3
cp $PWLIBDIR/lib/libpt_linux_x86_r.so.1.10.3 /usr/lib
cd ..
We copy the shared library manually into the system folder. It is very important that you set the PWLIBDIR to your path, othewise OpenH323 will not find it.
wget http://downloads.sourceforge.net/openh323/openh323-v1_18_0-src-tar.gz
tar zxvf openh323-v1_18_0-src-tar.gz
cd openh323_v1_18_0/
./configure 
In the configure lines, check that it says something like: PWLib prefix set to…. /src/ast14/pwlib_v1_10_3
make opt
export OPENH323DIR=/src/asterisk-1.4/openh323_v1_18_0
cp $OPENH323DIR/lib/libh323_linux_x86_r.so.1.18.0 /usr/lib
cd ..
Again we must set the OPENH323DIR variable, so Asterisk can know here to look for OpenH323. We copy the library manually to the system directory, as we do not care about the rest of OpenH323 features. Installing Asterisk 1.4.0 First we have to download the latest version of Asterisk and Zaptel, as follows.
wget ftp://ftp.digium.com/pub/zaptel/zaptel-1.4.4.tar.gz
wget ftp://ftp.digium.com/pub/libpri/libpri-1.4.1.tar.gz
wget ftp://ftp.digium.com/pub/asterisk/asterisk-1.4.8.tar.gz
We start by building Zaptel, as follows:
tar zxvf zaptel-1.4.4.tar.gz
cd zaptel-1.4.4
./configure
make menuselect
At this point use the menuselect utility to select which Zaptel hardware - if any - you have on board. Please remeber that if you want to exit keeping the changes you made, you must press x , while q will quit without saving and the left arrow will get you back to the previous menu. Even if you do not have Zaptel hardware, you should compile the ztdummy driver.
make
make install
cd ..
If you get an error that says Error: syntax error before “zone_lock” then you have a small problem with you kernel sources; comment a single line in spinlock.h as suggested in http://bugs.digium.com/view.php?id=6425 and it will be solved. Now we build libpri - no configure or menuselect for it yet:
tar zxvf libpri-1.4.1.tar.gz
make
make install
cd ..
Now we build Asterisk itself:
tar zxvf asterisk-1.4.8.tar.gz
./configure
make menuselect
At this point, you should go to the Channels menu and see that H323 and chan_google are enabled. If it’s not, vey likely you did not set OPENH323DIR or PWLIBDIR, so configure cannot enable H.323 by default.
make
make
When compiling with H.323 support, the first time you run make it will end with an error telling you to run make again. This is okay, just do it as it says.
make install
make samples
cd ..
Asterisk is now ready. Starting the TDM400 We have a TDM 400 with 1 FXS channel on port 1 and 1 FXO channel on port 4, so we create the following files: /etc/zaptel.conf
loadzone = it
defaultzone=it
fxoks=1
fxsks=4

/etc/asterisk/zapata.conf
[#CODE:]
[channels]
language=en
;
; FXS - telefono analogico
;
signalling=fxo_ks
context=interni_analogici
group=1
callwaiting=yes
threewaycalling=yes
transfer=yes
cancallforward=yes
channel => 1
;
; FXO - linea
;
busydetect=yes
busycount=5
signalling=fxs_ks
context=rete_pubblica
group=2
channel => 4
We start up the drivers by typing
modprobe zaptel
modprobe wctdm
And we expect no error messages save the correct output on /var/log/messages, something on the lines of:
Oct 15 07:58:58 beth-pbx kernel: Zapata Telephony Interface Registered on major 196
Oct 15 07:59:09 beth-pbx kernel: PCI: Found IRQ 9 for device 01:01.0
Oct 15 07:59:09 beth-pbx kernel: Freshmaker version: 73
Oct 15 07:59:09 beth-pbx kernel: Freshmaker passed register test
Oct 15 07:59:09 beth-pbx kernel: Module 0: Installed -- AUTO FXS/DPO
Oct 15 07:59:09 beth-pbx kernel: Module 1: Not installed
Oct 15 07:59:09 beth-pbx kernel: Module 2: Not installed
Oct 15 07:59:09 beth-pbx kernel: Module 3: Installed -- AUTO FXO (FCC mode)
Oct 15 07:59:09 beth-pbx kernel: Found a Wildcard TDM: Wildcard TDM400P REV I (2 modules)
Oct 15 07:59:09 beth-pbx kernel: Registered tone zone 0 (United States / North America)
Starting it all together To run Asterisk now, type:
ztcfg -v
asterisk -vvvvvvvvvvvvvvvvvvvvvvvvvvc
Asterisk should load and start. The ztcfg command is needed to apply the configuration information in /etc/zaptel.conf to the zaptel driver. Your fresh copy of Asterisk should be ready to run. If it crashes on startup complaining of missing dynamic library modules, just copy them to /usr/lib. Enabling H.323 In order to enable H.323, you simply edit /etc/asterisk/h323.conf as follows:
gatekeeper = DISCOVER
context=h323
This will tell it to find the gatekeeper automatically and to route incoming calls to context h323. To place an outbound call fron Asterisk, you just dial:
exten => 21,1,Dial(h323/21)
This will find the terminal 21 through the Gatekeeper and will call it as needed. See also: Continue Reading...



Installing QueueMetrics beta through RPM

The official QueueMetrics repository contains only production-quelity versions of QueueMetrics. Still, sometimes a beta version is released in RPM format, so we need to install it manually. Make sure QueueMetrics is installed through yum We want everything to be working before installing a beta, so we do the following steps to install the latest working version:

wget https://yum.loway.ch/loway.repo -O /etc/yum.repos.d/loway.repo
yum install queuemetrics
And follow the on-screen database installation instructions. Download and install the beta As the beta will be installed locally and is not a signed package, we need to modify /etc/yum.conf and set gpgcheck=0 in the main section. When this is done, you can download and install the package through:
wget http://queuemetrics.com/download/rpm-beta/queuemetrics-1.4.0b1-20.noarch.rpm
yum localupdate queuemetrics-1.4.0b1-20.noarch.rpm
After it’s done, it’s a good idea to start the automatic datbase check and upgrade utility located at http://myserver:8080/queuemetrics/dbtest Reverting to the last stable version If you want to get back to the latest stable version, you can simply type the following commands:
yum remove queuemetrics
yum install queuemetrics
The beta will be removed and the last stable version will be pulled from the public repository. Continue Reading...



vicidial

Qui parliamo di vicidial - scrivi qui il tuo testo. aqui hablamos de Vicidial Here is the onfo about Vicidial Continue Reading...



QueueMetrics user tracking

To track your users loggin on and off of QueueMetrics, have a look at localhost-xxxx.txt under tomcat/logs, you should find something that looks like the following examples. The value in square brackets (that we edited for brevity) is the session-id, it stays the same throughout the session. All entries havinbg the same session-id are for the same user from the same browser. This is for a log-on:

[EFDC....] Inizio classe it.loway.app.queuemetrics.validazione.logon
[EFDC....] Fine classe it.loway.app.queuemetrics.validazione.logon
[EFDC....] Utente 'demoadmin' in classe '3'
[EFDC....] Utente 'demoadmin' ha chiavi 'USER QUEUE_AN ...'
[EFDC....] Inizio classe it.loway.app.queuemetrics.autenticazione.caricaDatiIniziali
[EFDC....] Fine classe it.loway.app.queuemetrics.autenticazione.caricaDatiIniziali
[EFDC....] Inizio classe it.loway.app.queuemetrics.oq.caricaCodeOutbound
[EFDC....] Fine classe it.loway.app.queuemetrics.oq.caricaCodeOutbound
[EFDC....] Tempo totale esecuzione verbo 'qm_autentica': 91 ms
The entry “Utente ‘demoadmin’ in classe ‘3’” means that a user called “demoadmin” just logged on. This is for a log off:
[EFDC....] Utente  sconnesso.
[EFDC....] Tempo totale esecuzione verbo 'qm_logoff': 14 ms
This way you can track what your users have been doing and who logged on to the system. Continue Reading...



Detecting missing Queue exit events

On some version of Asterisk, there are conditions when an unanswered call would exit the queue without leaving a trace of its exiting in the queue_log, therefore generating incomplete call processing events that lead reporting software like QueueMetrics to produduce inaccurate results. You will notice this if you encounter pieces of the queue_log that look like the following example:

1167421685|1169421668.34679|qname|NONE|ENTERQUEUE||5555551234
1167099900|1169099887.31480|qname|NONE|ENTERQUEUE||5555551234
1168222540|1168222529.5949|qname|NONE|ENTERQUEUE||5555551234
Here you can see that the caller-id 5555551234 entered the queue three times in a row but its exiting statuses were never recorded. To solve this problem, it is important to know why the queue was exited without response, and this can be obtained with a sample piece of the dialplan like the following:
exten => s,1,queue(myqueue)
exten => s,2,System( echo "${EPOCH}|${UNIQUEID}|myqueue|NONE|EXITCODE|${QUEUESTATUS}" >> /var/log/asterisk/queue_log )
exten => h,1,System( echo "${EPOCH}|${UNIQUEID}|myqueue|NONE|EXITHANGUP|${QUEUESTATUS}" >> /var/log/asterisk/queue_log )
You should leave this code running for a while and then review the queue_log manually for traces of ENTERQUEUEs followed only by EXITCODE and EXITHANGUP records. They will be followed by the condition causing the problem, like TIMEOUT, FULL, JOINEMPTY, LEAVEEMPTY, JOINUNAVAIL, or LEAVEUNAVAIL. After you have this information, you can know how to modify the dialplan to record a fake queue end entry, therefore producing a valid queue_log file. Note: version 1.4 of Asterisk should finally be unaffected by this problem. See also: Continue Reading...



QueueMetrics logs

QueueMetrics does not have its own logging facilities, but uses the logging facilities provided by the servlet container it’s running into (that’s in most cases Apache Tomcat). In a standard QueueMetrics installation, they are located in /usr/local/queuemetrics/tomcat/logs and look a bit like the following example:

[root@qm ~]# cd /usr/local/queuemetrics/tomcat/logs/
[root@qm logs]# ll
total 184
-rw-r--r--  1 root root 53897 Feb 21 21:56 catalina.out
-rw-r--r--  1 root root  5411 Nov 28 16:54 localhost_log.2006-11-28.txt
-rw-r--r--  1 root root  4210 Dec  2 23:46 localhost_log.2006-12-02.txt
-rw-r--r--  1 root root  4207 Dec  8 14:26 localhost_log.2006-12-08.txt
-rw-r--r--  1 root root 11278 Dec 14 19:01 localhost_log.2006-12-14.txt
-rw-r--r--  1 root root  7940 Dec 20 13:02 localhost_log.2006-12-20.txt
-rw-r--r--  1 root root 43429 Jan 18 22:15 localhost_log.2007-01-18.txt
-rw-r--r--  1 root root  7263 Jan 20 17:52 localhost_log.2007-01-20.txt
-rw-r--r--  1 root root 25099 Feb 21 21:56 localhost_log.2007-02-21.txt
The logs are comprised of a general file named catalina.out and of many subfiles, usually one per day, with the day’s activity, usually named localhost-date.txt. If you encounter any errors in QueueMetrics, it may be useful to send Loway the logs while the program was running. As the logs get extremely verbose, in order to report an error you should do the following: Continue Reading...



Changing DTMF tone frequency in Asterisk

When Asterisk is handling a call and needs to listen to that call, e.g. to monitor it for DTMF transfer tones, Asterisk will detect and rebuild all DTMF tones on that call. If you use Asterisk as a bridge to connect appliaces that communicate by exchanging DTMF tones (e.g. remote alarms trasmitting their alarm-ID, or other remote industrial appliances that were designed before the IP age), Asterisk will consistently intercept, buffer and regenate all DTMF tones it detects. This may be a problem, as some of those appliances use distinct DTMF-silence cadences, and by regenerating those tones they are output with Asterisk’s signal-silence cadences. In order to avoid this behaviour in Asterisk, what you can do is to modify the frequency of the DTMF tones Asterisk expects, so that the true DTMF tones are not recognized and therefore let alone by the DSP module. A bit of theory Any DTMF digit is built out of two distinct signals, chosen so that their harmonics do not overlap and are therefore easy to detect and hard to misinterpret. The basic DTMF system uses a telephone-keyboard style matrix of four columns by four rows, in exactly the same configuration that can be found in telephones all around the world (ordinary consumer telephones do not have the fourth column, but you get the idea)

  +--------+---------+---------+---------+---------+
  |        | 1209 Hz | 1336 Hz | 1477 Hz | 1633 Hz |
  +--------+---------+---------+---------+---------+
  | 697 Hz |   1     |   2     |    3    |    A    |
  | 770 Hz |   4     |   5     |    6    |    B    |
  | 852 Hz |   7     |   8     |    9    |    C    |
  | 941 Hz |   *     |   0     |    #    |    D    |
  +--------+---------+---------+---------+---------+
Therefore, to send a digit “3” the telephone will generate both a 697Hz and a 1477Hz tone at the same time. Changing the DTMF tones The Asterisk module dsp.c contains the definitions for DTMF tones. Just look for a part of the source code that says:
static float dtmf_row[] =
{
	697.0,  770.0,  852.0,  941.0
};
static float dtmf_col[] =
{
	1209.0, 1336.0, 1477.0, 1633.0
};
And change that to:
static float dtmf_row[] =
{
        732.0,  809.0,  894.0, 988.0
        /* 697.0,  770.0,  852.0,  941.0 */
};
static float dtmf_col[] =
{
        1270.0, 1404.0, 1551.0, 1715.0
        /* 1209.0, 1336.0, 1477.0, 1633.0 */
};
This will raise all detected DTMF codes by some 40Hz, enough for Asterisk to become completely tone-blind to existing DTMF codes. Once you made the change, you must recompile Asterisk by:
  1. Stopping Asterisk
  2. Go to your Asterisk source directory
  3. Enter make clean
  4. Enter make
  5. Enter make install
Note that you still can send Asterisk DTMF codes to transfer the call, start monitoring or what else - as long as you use the new DTMF tone matrix you just input. This is pretty easy to do with most industrial-grade call handling equipment. See also Continue Reading...



VoiceBlue with Asterisk IP PBX - How to

The present document is a step-by-step guide for configuring the 2N VoiceBlue gateway and Asterisk software IP PBX. It includes essential steps for interconnecting the two products rather than a detailed configuration analysis of the two units. For more information on the 2N VoiceBlue gateway configuration refer to the manual placed at http://www.2n.cz/products/gsm_gateways/voip/voiceblue.html. What is 2N VoiceBlue? The 2N VoiceBlue GSM gateway is an ideal complementary product to any SIP-based IP PBX. It’s suitable for small and medium companies with IP infrastructure and for companies with international affiliates. With VoiceBlue you gain significant savings on outgoing and incoming calls from IP to GSM networks and backwards. Thanks to the efficient and powerful Least Cost Router (LCR), the VoiceBlue GSM gateway always chooses the cheapest possible way to route the call (according to GSM prefixes, free minutes on SIM cards etc.).Using the VoiceBlue gateway you achieve complete independence when connecting to GSM networks and maintain 100% control of your GSM call costs. With the help of voice prompts and efficient Dynamic Clip Routing, VoiceBlue routes incoming GSM calls to the right IP phones. What is Asterisk? Asterisk is a software PBX originally developed by Mark Spencer. This software PBX is designed as an open source, which means that it can be downloaded from the Internet, namely from: http://www.asterisk.org/index.php?menu=download, installed and used without any limitations. The fact that the Asterisk is a software PBX indicates that VoIP is the native environment for this PBX. Asterisk supports VoIP using three protocols, which means that its users can use a wide range of VoIP telephones, both software ones and hardphones. Together with the above mentioned VoIP services, Asterisk supports connection of TDM equipment by means of PCI cards supporting both digital (ISDN PRI/BRI) and analog trunks. Since the PCI bus on the PC is not unlimited, Asterisk users employ as much VoIP equipment as possible in order to save the TDM interface for other services, such as PSTN connection, or use of analog telephones. This is why most Asterisk users use the Ateus VoiceBlue VoIP GSM gateway for their GSM calls. You find below how to interconnect these two types of equipment. For more information on the Asterisk software solution see www.asterisk.org. Main scenario Suppose we have an IP network to which an Asterisk IP PBX, several SIP telephones and an 2N VoiceBlue VoIP-GSM gateway are connected. This typical configuration is shown in the figure below. Furthermore, suppose that the network is addressed as shown in the figure and GSM numbers are all numbers starting with 6,7,8 and containing 9 digits. For configuration simplicity, use SIM cards from one GSM provider. Now say that all incoming calls are answered by the gateway, which replays the invitation message and waits for 10s for another DTMF dialling. After this timeout, the gateway dials extension 111, which is a dial-in to the operator. 2N VoiceBlue Gateway Configuration Step-by-step configuration…ready in 5 minutes:-) System Parameters Set information on the IP interface only …address, mask, default gateway Ethernet Parameters SIP proxy (GSM->IP) instructs the gateway where to send the invite packet during a GSM-VoIP incoming call …the Asterisk address in our case SIP proxy (IP->GSM) instructs the gateway from which IP address the gateway may receive SIP packets …the Asterisk address in our case SIP registrar To enable incoming calls to Asterisk for some units, register the selected units as Friend types in the Asterisk system. Set the following parameters in VoiceBlue for registration: SIP registrar …equipment for which the gateway is to be registered (Asterisk) Username …username under which the gateway shall be registered Password …registration password Assignment to Groups Since SIM cards from one GSM provider are used, all you have to do is make sure that all GSM modules have been assigned to the first group. Network List Create a network list containing the prefix of your GSM destinations …remember to keep the default number of digits (9 in our case). LCR Table Finally, sum up all settings in a single LCR table defining that all called numbers that match the network list 1 shall be routed via GSM group 1. Incoming Calls As far as incoming calls are concerned, the 2N VoiceBlue gateway has a relatively wide choice of possibilities. Besides call ignoring and rejection, you can mainly receive incoming calls as follows: Receive a call and replay the DISA message A simply modifiable message is stored in the gateway and replayed whenever an incoming call is answered. During this message, the calling subscriber can dial in to the required extension. Receive a call with the second dialtone The same as with DISA; the only difference is that the user hears the second dialtone instead of the message. Receive a call and forward it to the operator immediately An incoming call can be forwarded to the operator either immediately or after a timeout. The following configuration can be used as an example: Asterisk IP PBX Configuration Now add a few lines in the IP PBX configuration for both proper routing of outgoing calls to the VoiceBlue GSM gateway and receiving calls coming from the GSM gateway to Asterisk. Outgoing Calls The core of Asterisk connection lies in the /etc/asterisk/extensions.conf file. Open this file in your favourite editor and add the following lines:

exten => _6XXXXXXXX,1,Dial(SIP/${EXTEN:0}@10.0.0.20,,r)
exten => _7XXXXXXXX,1,Dial(SIP/${EXTEN:0}@10.0.0.20,,r)
exten => _8XXXXXXXX,1,Dial(SIP/${EXTEN:0}@10.0.0.20,,r)
Once you have saved and closed the file, restart Asterisk and from now on all calls starting with 6,7,8 should be routed to the VoiceBlue GSM gateway. Incoming Calls It is recommended to make a little restriction for incoming calls to prevent unauthorised persons from calling over your system. Since Ateus VoiceBlue works with the SIP, modify the /etc/asterisk/sip.conf file where the VoiceBlue section could look as follows, for example:
[voiceblue]
type=friend
disallow=all
allow=alaw
host=10.0.0.20
username=voiceblue
secret=password
permit=10.0.0.20/255.255.255.255
qualify=yes
Again, restart Asterisk after saving the file. After that, Asterisk will be ready to receive calls coming from the VoiceBlue GSM gateway. What to do in case of troubles? The first thing you should do when you find that there is something wrong is to run the trace in VoiceBlue … this helps you locate the problem. First of all you can see immediately whether any SIP messages come to the GSM gateway and if so, check the called numbers for proper format. If this is OK too, review the complete communication listing both on the VoIP and GSM sides. To start tracing click on Tracing in the CTRL section. For recommended trace parameters see the figure below. Continue Reading...