AstRecipes » Compiling Asterisk 1.2 with TDM400 and H323

This recipe shows how to:
star Compile Asterisk 1.2 (works fine with 1.2.4)
star Add the H.323 modules
star Start a TDM400 card with 1 FXS and 1 FXO port

This recipe was tested on CentOS 3.5 (kernel 2.4).

I suppose all sources will be downloaded and compiled in /src.

Downloading and compiling Asterisk
First we build the zaptel drivers:
 

cd /src
wget http://ftp.digium.com/pub/zaptel/zaptel-1.2.3.tar.gz
tar zxvf zaptel-1.2.3.tar.gz
cd zaptel-1.2.3
make
make install
cd ..
 

Now we build libpri:
 

wget http://ftp.digium.com/pub/libpri/libpri-1.2.2.tar.gz
tar zxvf libpri-1.2.2.tar.gz
cd libpri-1.2.2
make
make install
cd ..
 

Now we build Asterisk itself:
Please note that by 'make samples' you'll delete you existing configuration - Make a backup first!
 

wget http://ftp.digium.com/pub/asterisk/asterisk-1.2.4.tar.gz
tar zxvf asterisk-1.2.4.tar.gz
cd asterisk-1.2.4
make
make install
make samples
 

Now we build Asterisk addons: (optional)
 

wget http://ftp.digium.com/pub/asterisk/asterisk-addons-1.2.1.tar.gz
cd asterisk-addons-1.2.1
make
make install
 

Now we install Asterisk sounds too:
 

wget http://ftp.digium.com/pub/asterisk/asterisk-sounds-1.2.1.tar.gz
cd asterisk-sounds-1.2.1
make install
 

Compiling H.323 drivers
The chan_h323 divers requires OpenH323 and a support library named PwLib. Make sure to download those exact versions! I use links to find the correct download URL.

 

cd /src
links http://prdownloads.sourceforge.net/openh323/
 
wget http://umn.dl.sourceforge.net/sourceforge/openh323/pwlib-v1_9_0-src-tar.gz
tar zxvf pwlib-v1_9_0-src-tar.gz
cd pwlib_v1_9_0/
./configure
make
make install
make opt
 
PWLIBDIR=/src/pwlib_v1_9_0
export PWLIBDIR
 

Now we fetch and compile OpenH323. Compilation will take quite a while, but that's okay.
 

cd /src
links http://prdownloads.sourceforge.net/openh323/
 
wget http://umn.dl.sourceforge.net/sourceforge/openh323/openh323-v1_17_1-src-tar.gz
tar zxvf openh323-v1_17_1-src-tar.gz
cd openh323_v1_17_1/
./configure
make
make opt
make install
 
OPENH323DIR=/src/openh323_v1_17_1/
export OPENH323DIR
 

It is very important to set PWLIBDIR and OPENH323DIR, because such variables will be used for further compiling.

Now we build the channel driver:
 

cd /src/asterisk-1.2.4/chnnels/h323/
make
make opt
cd ..
cd ..
make install
 

OpenH323 generates its libs in /usr/local/lib but my Linux uses /usr/lib for shared libraries, we'll need to copy the genberated libraries from /usr/local/lib to /usr/lib.
 

cp /usr/local/lib/* /usr/lib
 

Now we make sure the channel driver exists and is loadable:
 

ldd /usr/lib/asterisk/modules/chan_h323.so
 

There should be no missing references at this point.

Startingthe TDM400
I have a TDM 400 with 1 FXS channel on port 1 and 1 FXO channel on port 4.

I create the following files:
/etc/zaptel.conf
 

loadzone = it
defaultzone=it
fxoks=1
fxsks=4
 

/etc/asterisk/zapata.conf
 

[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
 

I start the driver by typing
 

modprobe zaptel
modprobe wctdm
 

And I expect no error messages save the correct output on /var/log/messages, something like:
 
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 Asteriskk type:
 

asterisk -vvvvvvvvvvvvvvvvvvvvvvvvvvc
 

Asterisk should load ans start.
When you are done with it, type "stop now".

 

 

Voip Help

Directories

Backup:    /var/lib/asterisk/backups 

Codecs: /usr/lib/asterisk/modules

web:    /var/www/html

 

Installing Asterisk@home on already installed OS (Linux Fedora Core 2)

mkdir /var/aah_load
cp asteriskathome-2.4.tar.gz /var/aah_load
cd /var/aah_load
tar xvfz asteriskathome-2.4.tar.gz
./install.sh

 

Upgrading to Asterisk 1.2.6.

amportal stop

cd /usr/src
wget http://ftp.digium.com/pub/telephony/zaptel/zaptel-1.2.5.tar.gz
wget http://ftp.digium.com/pub/telephony/libpri/libpri-1.2.2.tar.gz
wget http://ftp.digium.com/pub/telephony/asterisk/asterisk-1.2.6.tar.gz
wget http://ftp.digium.com/pub/telephony/asterisk/asterisk-addons-1.2.2.tar.gz
wget http://ftp.digium.com/pub/telephony/asterisk/asterisk-sounds-1.2.1.tar.gz

tar -zxvf zaptel-1.2.5.tar.gz
tar -zxvf libpri-1.2.2.tar.gz
tar -zxvf asterisk-1.2.6.tar.gz
tar -zxvf asterisk-addons-1.2.2.tar.gz
tar -zxvf asterisk-sounds-1.2.1.tar.gz

cd zaptel-1.2.5
make clean
make install
cd ..

cd libpri-1.2.2
make clean
make install
cd ..

cd asterisk-1.2.6
make clean
make install
cd ..

cd asterisk-addons-1.2.2
make clean
make install
cd ..

cd asterisk-sounds-1.2.1
make clean
make install
cd /root

amportal start
 

Updating Asterisk manually (preferred so you know you are getting stable releases)

*note this was put in place in case of a critical update to the Asterisk source, otherwise its not needed and only meant for advanced configurations.

#clean modules
rm -f /usr/lib/asterisk/modules/*

#asterisk 1.2.6
cd /usr/src
rm -rf asterisk
wget http://ftp.digium.com/pub/asterisk/asterisk-1.2.6.tar.gz
tar -zxvf asterisk-1.2.6.tar.gz
mv asterisk-1.2.6 asterisk

#zaptel 1.2.5
cd /usr/src
rm -rf zaptel
wget http://ftp.digium.com/pub/zaptel/zaptel-1.2.5.tar.gz
tar -zxvf zaptel-1.2.5.tar.gz
mv zaptel-1.2.5 zaptel

#libpri 1.2.2
cd /usr/src
rm -rf libpri
wget http://ftp.digium.com/pub/libpri/libpri-1.2.2.tar.gz
tar -zxvf libpri-1.2.2.tar.gz
mv libpri-1.2.2 libpri

#addons 1.2.2
cd /usr/src
rm -rf asterisk-addons
wget http://ftp.digium.com/pub/asterisk/asterisk-addons-1.2.2.tar.gz
tar -zxvf asterisk-addons-1.2.2.tar.gz
mv asterisk-addons-1.2.2 asterisk-addons

#sounds 1.2.1
cd /usr/src
rm -rf asterisk-sounds
wget http://ftp.digium.com/pub/asterisk/asterisk-sounds-1.2.1.tar.gz
tar -zxvf asterisk-sounds-1.2.1.tar.gz
mv asterisk-sounds-1.2.1 asterisk-sounds

#now rebuild and reboot
cd /usr/src
./rebuildastsrc.sh
reboot

#freepbx 2.0.1
cd /usr/src
wget http://internap.dl.sourceforge.net/sourceforge/amportal/freepbx-2.0.1.tar.gz
tar -zxvf freepbx-2.0.1.tar.gz
cd freepbx-2.0.1
./install_amp
amportal restart

*note: you will loose the maintenance feature. use may still use "http://server/maint/index.php?"
Steps for updating SVN HEAD (bleeding edge stable, not recommended?):

cd /usr/src
rm -f /usr/lib/asterisk/modules/*
./rm_astsrc.sh
./getastsrc_head.sh
./rebuildastsrc.sh
reboot
 

 

How do I know what versions of software are installed on my Asterisk@Home Server?

There are times when you really need to know what version of the software that is installed in A@H. Especially when you're troubleshooting a problem. Here is a quick list of instructions on how to determine that

 
  • Asterisk - First enter the Asterisk CLI (Command Line Interface) Asterisk -r then type show version then exit using quit
  • AMP - Enter the A@H Splash Page by typing HTTP://PutYourAsterisk@HomeIpaddressHere into a browser and click on AMP. The version is displayed in the Welcome Screen.
  • Flash Operator Panel - Type this at the CentOS Command Line: /var/www/html/panel/op_server.pl -v
  • Music On Hold (mpg123) - Type this at the CentOS Command Line mpg123 --help
  • SugarCRM - Enter the A@H Splash Page by typing HTTP://PutYourAsterisk@HomeIpaddressHere and click on CRM. Login to SugarCRM. Click About on the top right. The version information will then be displayed.
  • Festival Speech Engine - Type this at the CentOS Command Line: Festival The version is at the top. Type (quit) (literally WITH the parenthesis!!!) to exit.
  • Asterisk Span DSP Faxing - At the CentOS Command Line type: cd /var/aah_load and look for the file that begins with spandsp- and the rest is the version #.
  • Open A2Billing - (Someone please fill this part out, I couldn't find this information)
  • Linux CentOS - Type cat /etc/redhat-release at the command line
  • Apache Web Server - Type this at the CentOS Command Line: rpm -q httpd
  • PHP - Type this at the CentOS Command Line: PHP: echo "<?php phpversion('tidy'); ?>" | php
  • PhPMyAdmin - Enter the A@H Splash Page by typing HTTP://PutYourAsterisk@HomeIpaddressHere into a browser and click on AMP, then Maintenance, then phpmyadmin.
  • MySQL Database - Enter the A@H Splash Page by typing HTTP://PutYourAsterisk@HomeIpaddressHere into a browser and click on AMP, then Maintenance, then phpmyadmin. The MySQL version will be displayed. Another method is to type the following into your CentOS Command Line rpm -q mysql
  • Very Secure FTPD (VSFTPD) - Type this at the CentOS Command Line: rpm -q vsftpd
  • SendMail - Type this at the CentOS Command Line: rpm -q sendmail
  • OpenSSH - Type ssh -V
  • xPL - (Someone please fill this part out, I couldn't find this information)
  • Integrated WebMeetMe GUI - This is Andrew's Code and has the same version as Asterisk@Home
  • Digium card auto-config - This is Andrew's Code and has the same version as Asterisk@Home
  • Weather agi scripts - This is Andrew's Code and has the same version as Asterisk@Home
  • Wakeup calls - This is Andrew's Code and has the same version as Asterisk@Home From what I can see it's created by Andy Wysocki (Se reference under section 1.3) and the version used in A@H 2.2 is 1.02 and current version is 1.11. Comment by MatsK
  • Cisco SIP phone support - (Someone please fill this part out, I couldn't find this information)
  • Complete List of all Software Installed - For a complete list of all software installed in A@H type the following at the CentOS Command Line rpm -qa
This is the manual for GNU Gatekeeper 2.2.3.
A manual for your version is in your GnuGk download archive.

Chapters: Contents · Introduction · Installation · Getting started · Basic Config · Routing · RAS Config · Authentication · Accounting · Neighbors · Per Endpoint Config · Advanced Config · Monitoring

 

2. Compiling and Installing

 

2.1 Compiling the Gatekeeper

To build the gatekeeper you need at least PWLib 1.5.0 and OpenH323 1.12.0 or later. The development version of the gatekeeper usually needs the most recent OpenH323 version available. These libraries are available at OpenH323 Download Page. See the instructions on how to compile the OpenH323 code.

Order of compiling:

  1. PWLib (release + debug version)
  2. OpenH323
  3. OpenH323 test application (not needed, just to make sure everything works so far)
  4. The Gatekeeper

On Unix do a configure and make debug or make opt in the gatekeeper directory to build debug or release version, respectively. Use make both to build both versions. Note you have to use GCC 3.3.x or later. The older version may not work. Good practice is to do a make debugdepend or make optdepend in the gatekeeper directory before starting actual compilation (make debug or make opt) - these commands build approtiate dependency lists, so after you will update your sources from CVS, all affected files will get recompiled. Otherwise you can finish with the Gatekeeper partially compiled with the older headers and partially with the updated headers - a very bad thing.
 

On Windows just open and compile the provided solution (gk.sln) for Microsoft Visual Studio .NET 2003 or the workspace (gk.dsw) for Microsoft Visual Studio 6.0 SP6. Of course, you need to have PWLib and OpenH323 already compiled and approtiate include/library paths set up. If you want to get MySQL or PostgreSQL support, install/compile approtiate client libraries and add HAS_MYSQL=1 and/or HAS_PGSQL=1 to preprocessor macros of the gatekeeper project. You also need to tell the compiler where to find include files/libraries and instruct the linker to link with these client libraries.
 

Type configure --help to see a detailed list of all compile time options. You can use them to enable or disable some features of the gatekeeper. For example, if you do not need RADIUS just type: configure --disable-radius.
 

The recommended PWLib/OpenH323 versions are these from the Pandora release (1.7.5.2/1.14.4.2) or newer. Older versions are not supported anymore and are not guaranteed to work with the gatekeeper.

To build the gatekeeper that is statically linked with system and OpenH323 libraries, make optnoshared or make debugnoshared has to be used.

In order to use the gatekeeper under heavy load, enabling LARGE_FDSET feature (ONLY FOR UNIX VERSION) is recommended (configure --with-large-fdset=4096). Some systems also need to use ulimit in order to allow more than 1024 sockets to be allocated for a single process. Note that the PWLib library starting from version 1.5.3 supports a similar feature too, so you can choose between LARGE_FDSET GnuGk and PWLib implementation. GnuGk native implementation gives better performance results. Maximum LARGE_FDSET value should be calculated based upon predicted maximum sockets usage. A rule of thumb may be:

MAX_NUMBER_OF_CONCURRENT_CALLS * 10 * 120%

Where:
10 = 2 sockets for Q.931 + 2 sockets for H.245 + 6 sockets for RTP and other stuff
So for 100 concurrent calls you don't need more than ca. 1024 sockets in the LARGE_FDSET.

 

 

2.2 The addpasswd Utility

Status line access authentication and SimplePasswordAuth module require encrypted passwords to be stored in the gatekeeper configuration file. Also since 2.2.2 version, the gatekeeper supports encryption of all passwords in the config. addpasswd utility is required to generate and store these encrypted passwords. This utility is included with the gatekeeper and can be compiled using:

$ make addpasswd

The usage is as follows:

$ addpasswd CONFIG SECTION KEYNAME PASSWORD

Example 1: 'gkadmin' user with 'secret' password has to be added to [GkStatus::Auth] config section to enable status line interface authentication:

$ addpasswd gnugk.ini GkStatus::Auth gkadmin secret

Example 2: 'joe' user with 'secret' password has to be added to [Password] config section to enable endpoint authentication:

$ addpasswd gnugk.ini Password joe secret

Example 3: An encrypted shared secret is added to a RadAuth config section:

$ addpasswd gnugk.ini RadAuth SharedSecret VerySecretPassword

IMPORTANT: KeyFilled variable defines a default initializer for password encryption keys. It can be ommited in the config (it is defined to 0 then), but if it is specified, each time it changes, encrypted passwords have to be regenerated (encrypted again using the addpasswd utility).

2.3 Installing the Gatekeeper

There is no special installation procedure needed. Just copy the executable to the directory you like and create a config file for it. There are several config examples in the etc/ subdirectory of source tree. See section Configuration File for detailed explanations.

For example, in Linux x86 platform, the optimized executable gnugk is produced in obj_linux_x86_r/ subdirectory. You may copy it to /usr/sbin/, create a config in /etc/gnugk.ini and start it by

$ /usr/sbin/gnugk -c /etc/gnugk.ini -o /var/log/gnugk.log -ttt
See section Command Line Options for details.