These instructions will show how we’ve successfully installed Asterisk on a Fedora Core 3 Linux Distribution with a HFC isdn pci card. We’re not linux gurus so if you have any suggestion on this installation feel free to drop us a line. This tutorial is protected by Creative Commons license.

Our goals:

  • Connect 5 Phones together with their own extension
  • Route incoming calls to selected extension.
  • Manage our 2-lines ISDN
  • Avoid expensive hardware or software
  • Integrate personal voicemail
  • Integrate fax support

Hardware setup

  • A rackmount Machine with AMD Athlon Xp 1800, 512 Mb Ram, Asus A7V880 Motherboard with integrated lan, a 15 Gb ST HDD, a vintage video card, 52x Lg Cd-Rom, and floppy drive. (A sort of recycled machine)
  • This Digicom ISDN HFC Card
  • 5 GrandStream Budgetone 100

Software Setup

  • Fedora Core 3 iso images: disk 1 and 3 only
  • Various software from the internet (about 70 mb to download)
  • Off course, latest Stable Asterisk

# # # # # # Fedora Setup # # # # # #
Download from a mirror Fedora Core 3 only disk 1 and 3, burn them and perform a minimal installation with automatic disk partition (if you don’t care about the content of your disk, delete all previous partition.).

NOTE: During installation you must provide valid network informations in order to follow these instructions.

Now we’re going to set up the machine in order to install Asterisk and all of its components: login as root and follow these steps (you can copy/paste the commands in your terminal but read carefully what they do)

Import a public gpg key:
rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora

Update installed packages (including kernel, libraries etc):
yum update

If you have anything else to do, it’s the right moment, this operation will take many time, according to your internet connection.

Now reboot your machine, it will boot with the updated kernel (in this case 2.6.10-1.770_FC3) you can test it with:

[root@hermes ~]# uname -r
2.6.10-1.770_FC3

Now we’ll install some required software and we’ll do some kernel related operation:

ALL these packages MUST BE installed
yum install qt-devel
yum install rpm-build
yum install gcc
yum install gcc-c++
yum install redhat-rpm-config
yum install gtk2-devel
yum install ncurses-devel
yum install readline-devel
yum install bison
yum install krb5-devel
yum install openssl-devel
yum install cvs
yum install patchutils
yum install libidn-devel

Yum will solve automatically all dependencies.

Now we must download the kernel source rpm, in this case kernel-2.6.10-1.770_FC3.src.rpm from the updates

mkdir /downloads
wget (url of kernel-2.6.10-1.770_FC3.src.rpm)

Now cd to /downloads directory (or where you downloaded the package) and install the package with:

rpm -Uvh kernel-2.6.10-1.770_FC3.src.rpm

If you get this error

error: cannot create %sourcedir /usr/src/redhat/SOURCES

you must create 2 directories:

mkdir /usr/src/redhat
mkdir /usr/src/redhat/SOURCES

and retry Update the source rpm.

Now move to specs directory

cd /usr/src/redhat/SPECS

open with your favorite text editor the file kernel-2.6.spec

vi kernel-2.6.spec

and change this line to fit as follow:


%define buildup 0
%define buildsmp 0
%define buildsource 1
%define builddoc 0

Save, exit and build your new rpm:

rpmbuild --target i686 -ba kernel-2.6.spec
Let fedora working and don’t stop the process. When it’s done move to i686 dir and update your rpm

cd /usr/src/redhat/RPMS/i686
/kernel-sourcecode-2.6.10-1.770_FC3.root.i686.rpm

Fax Support

Before installing our pbx we’ll install fax support with tiff library. If you are not interested in fax support jump to Asterisk Setup.

Get latest tiff library from Maptools.org (in this case tiff-3.7.2)

cd /usr/src
wget http://dl.maptools.org/dl/libtiff/tiff-3.7.2.tar.gz
tar -zxvf tiff-3.7.2.tar.gz
cd tiff-3.7.2
./configure
make
make install

Get and compile the latest Spand Fax software (in this case 0.0.2pre10) from this ftp server
cd /usr/src
wget (latestspand)
tar -zxvf spandsp-0.0.2pre10.tar.gz
cd spandsp-0.0.2
./configure
make
make install

NOTE: This section is under construction

# # # # # # Asterisk Setup # # # # # #

Get the latest bristuff package from junghanns.net (in this case 0.2.0-RC7k) and unpack it

cd /usr/src
wget (latest bristuff)
tar -zxvf bristuff-0.2.0-RC7k.tar.gz

Now we have to make some changes in order to get asterisk and zap working on fedora:
cd /usr/src

Add these 2 links:
ln -s /lib/modules/2.6.10-1.770_FC3/build/ /usr/src/linux-2.6
ln -s /usr/src/linux-2.6.10-1.770_FC3.root/ /usr/src/linux

edit in your text editor /etc/udev/rules.d/50-udev.rules and add
KERNEL="zapctl", NAME="zap/ctl"
KERNEL="zaptimer", NAME="zap/timer"
KERNEL="zapchannel", NAME="zap/channel"
KERNEL="zappseudo", NAME="zap/pseudo"
KERNEL="zap[0-9]*", NAME="zap/%n"

You must also edit some header files in order to avoid compile errors

in file /usr/src/linux/include/asm-i386/irq.h
at 16 change:
#include "irq-vectors.h" to:
#include "mach-default/irq_vectors.h"
(and not to: #include "mach-default/irq-vectors.h" as said on this tutorial on voip-info.org)

in file /usr/src/linux/include/asm-i386/mpspec.h at line 18 change:
asm/mpspec .h to:
asm/mach-default/mach_mpspec.h

in file /usr/src/linux/include/asm-i386/smp.h at line 71 change:
mach_apicdef .h to: asm/mach-default/mach_apicdef.h

Now we're ready to download and compile asterisk. We'll use the bristuff that will download, patch and compile automatically all packages.

We first need to do some changes in compile.sh file:

cd /usr/src/bristuff-0.2.0-RC7k
vi compile.sh

Change lines 3/4/5/6 from this:

cd zaptel-1.0.6
make clean all
make install
cd ..

to this:

cd zaptel-1.0.6
make clean all
make config
make linux26
make install
cd ..

Change lines 38/39/40/41 from:

cd zaphfc
make clean all
make install
cd ..

to:

cd zaphfc
make clean all
make loadlinux26NT
make install
cd ..

In order to install sample configuration you must uncomment line 55:

change
# make samples
to
make samples

save, exit and launch installation with:

./install

If you don’t recive errors, you have successfully compiled Asterisk.

Music on hold software

We’ll install some packages in order to get music on hold working without mpg123 that has some serious security bugs.

Download and compile Libid3tag, required by madplay

cd /usr/src
wget (latest libid3tag)
tar -zxvf libid3tag-0.15.1b.tar.gz
cd libid3tag-0.15.1b
./configure
make
make install

Download and compile LibMad required by madplay

cd /usr/src
wget (latest LibMad)
tar -zxvf libmad-0.15.1b.tar.gz
cd libmad-0.15.1b
./configure
make
make install

Download and compile Madplay

cd /usr/src
wget (latest madplay)
tar -zxvf madplay-0.15.2b.tar.gz
cd madplay-0.15.2b
./configure
make
make install

To avoid Errors loading shared libraries edit ld.so.conf:

vi /etc/ld.so.conf

add this line:

/usr/local/lib

finally, run ldconfig to create the necessary links and cache.

ldconfig

Fax Add-ons

Download and compile latestsendEmail in order to easily send email with attach from command line.

cd /usr/src
wget (latest SendEmail)
tar -zxvf sendEmail-v1.52.tar.gz
cd sendEmail-v1.52
cp sendEmail /usr/local/bin/
chmod +x /usr/local/bin/sendEmail
cd ..
rm -Rf sendEmail-v1.52

Download my modified version of the modified version of faxmail script and customize it to suit your needs.

mkdir -p /var/lib/asterisk/scripts/
cd /var/lib/asterisk/scripts/
wget http://blog.soolid.it/data/faxmail
chmod +x faxmail

# # # # # # Asterisk Configuration# # # # # #

This section must be improved

zapata.conf
Open file /etc/asterisk/zapata.conf and paste these lines:

[channels]
switchtype = euroisdn
; p2mp TE mode
signalling = bri_cpe_ptmp
;signalling = bri_cpe
; p2mp NT mode
;signalling = bri_net_ptmp
; p2p NT mode
;signalling = bri_net
pridialplan=local
prilocaldialplan=local
echocancel=no

immediate=no
group = 1
context=default
channel => 1-2

This configuration works in my configuration with a isdn box labeled NT1 Plus provided by TELECOM ITALY.

Zaptel.conf

Open /etc/zaptel.conf and paste these lines:

# hfc-s pci a span definition
# most of the values should be bogus because we are not really zaptel
loadzone=it
defaultzone=it
span=1,1,3,ccs,ami
bchan=1-2
dchan=3

Same thing as above: works with my italian isdn configuration.

Define SIP phones – sip.conf
Before using our Budgetone, we must tell to Asterisk server which phones are attached to it, to do that, you must edit the sip.conf file found in the /etc/asterisk/ directory.

cd /etc/asterisk
vi sip.conf

Add these line for each phone you wish to add:

[YourPhoneName]
type=friend
host=dynamic
defaultip=192.168.0.48 ; (change this to your phone’s ip)
dtmfmode=rfc2833
context=local
callerid=”Your phone name”

Save and Exit.

Now take your Budget tone and Plug power and network. Press menu and arrow-down; select “IP Addr.” and press menu again. Now insert your phone’s ip addres (es. 192.168.0.48).

Now open the ip address in your browser (in this case http://192.168.0.48) use password “admin” for first login and make some changes:

SIP Server : Your Asterisk IP address
SIP User ID : Your Phone name
Authenticate ID : Your phone name

Select “Update button” and “Reboot” button. Repeat this step for each phone.

Back to your terminal and open extension.conf file:

cd /etc/asterisk/
vi extensions.conf

add this line under [local]:

; YourPhone1Name
exten => 48,1,Dial(SIP/192.168.0.48/48)

change all “48″ to your extension number and “192.168.0.48 to your phone1 ip and repeat to each phone. Keep in mind to assign different ips and extension numbers to each phone, maybe if you reached this point without errors it’s usefull to say :)

Staring Asterisk

Ok now we are ready to start. First, plug your isdn cable in your asterisk box and then test if channels works with:

ztcfg -tvv

If you get an output like this:

Zaptel Configuration
======================

SPAN 1: CCS/ AMI Build-out: 399-533 feet (DSX-1)

Channel map:

Channel 01: Individual Clear channel (Default) (Slaves: 01)
Channel 02: Individual Clear channel (Default) (Slaves: 02)
Channel 03: D-channel (Default) (Slaves: 03)

3 channels configured.

Now you are ready to start Asterisk:

asterisk -vvvvvvc

If you dont get any error you are now in the asterisk command line [*cli>], and, you can try to call your internal phone with:

dial 48

Change 48 to your extension number. Your phone should now ring and your asterisk cli prompt you information about call or any error.

Now read more about Dialplan and configure your new Asterisk based PBX.

# # # # # # About this guide # # # # # #

To do’s

  • Improve configurations section
  • Add fax configuration
  • Build Index and chapters for better navigation

Reference
Some guides/howto/forum post that help me to write this guide>

12 Responses to “Asterisk on Fedora Core 3 with single HFC card.”

  1. Tobias Says:

    the lines
    Add these 2 links:
    ln -s /lib/modules/2.6.9-1.667/build/ /usr/src/linux-2.6
    ln -s /usr/src/linux-2.6.10-1.770_FC3.root/ /usr/src/linux

    have to be changed to:
    Add these 2 links:
    ln -s /lib/modules/2.6.10-1.770_FC3/build/ /usr/src/linux-2.6
    ln -s /usr/src/linux-2.6.10-1.770_FC3.root/ /usr/src/linux

    otherwise you’ll get (among much others) an error complaining about an invalid module of zaphfc.ko format when attempting to insmod the zaphfc module during “make load”/”make loadNT”

  2. Albo Says:

    woops, it was a stupid error. Now fixed. thanks

  3. Nik Says:

    Hi, I’m trying your guide, but, when yum update finish, the loaded kernel is 2.6.11-xxx instead of 2.6.10-xxx so, the file kernel-2.6.spec does not match with your example, the line %define buildsource do not exists.
    If I add it, it does not works and the file kernel-sourcecode-2.6.xxx do not exists.
    Any suggestion?
    Thanks,
    Nik

  4. Albo Says:

    A new kernel update was released some days ago so this tutorial is now obsolete. I need some extra time to update it to 2.6.11.xx. In the meanwhile you can try to manually update your system to 2.6.10.770 kernel:
    Do not launch “yum update” , manually wget 2.6.10.770 kernel packages from fedora updates/ repository and install them.

  5. Jugganot Says:

    Hi, I am following your guide to get Asterisk running on my fedora box. I have two problems.

    1. in file /usr/src/linux/include/asm-i386/mpspec.h at line 18 change:
    asm/mpspec .h to:
    asm/mach-default/mach_mpspec.h

    There is no entry at line 18 or anywhere in this file that has the line “asm/mpspec.h”.

    2. The last command “./install” I get as output:
    bash: ./install: No such file or directory
    Could you please shed some light on this. Thanks

  6. pedro Says:

    The command should be ./install.sh

  7. Kevin Says:

    I just used these step in attempts to install on Fedora 3 and I needed postgres-devel or make all of asterisk would: libpq-fe.h: No such file or directory

  8. Harald Holzer Says:

    Hi,

    recompling the kernel:

    install rpm-build package, /usr/src/redhat/* dirs are included in this rpm.
    (why you are recompile the kernel ?
    with pre kernel-2.6.12 all header files are in the kernel rpm,
    with newer kernel rpms, this headers are splitted out to kernel-devel packages.)
    use:
    ln -s /lib/modules/`uname -r`/build/ /usr/src/linux-2.6
    to avoid version numbers in documenations ;-)

    compiling bristuff-0.2.0-RC8h works out of the box, without changing anything.
    after installation, you can do:
    cp -rp /dev/zap* /etc/udev/devices/
    to preserve the filedevices, so you dont have to edited the udev rule files.

  9. GP Says:

    Sorry for a dumb question…but how do I update the new kernel RPM…running the command as published above from the i686 directory does not work.

    It says permission denied. Subsequently I tried,

    rpm -iv kernel-…..rpm

    is that correct?

    Thanks and sorry again for this rudimentary question.
    GP

  10. Si Says:

    Same problem as GP:

    “When it’s done move to i686 dir and update your rpm

    cd /usr/src/redhat/RPMS/i686
    /kernel-sourcecode-2.6.10-1.770_FC3.root.i686.rpm”

    Which RPM needs updating and how?

    Guide is great apart from that.
    Many thanks.

  11. Noma Trull Says:

    Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but instead of that, this is great blog. A fantastic read. I will certainly be back.

  12. 2k10onlinewilsonl Says:

    {I really enjoyed this post, especially the “examples in this post” portion which made it really easy for me to SEE what you were talking about without even having to leave the article. Thanks|

Leave a Reply