Here is my long-awaited tutorial that explains how to setup cheap hfc-s cards to be used with asterisk.
After nearly one year work and endless discussions with Larry, we were able to get a hfc single and multiport setup running and decided to write two tutorials. Thanks to Larry for his great help.
This is the english tutorial. At http://com-in.de/index.php/howto-asterisk-hfc-gentoo you will find the german version. Keep in mind that these are not simple copies. If you have trouble it might be helpful to read both ones.
Introduction
When you have finished this tutorial you will be able to directly operate cheap hfc cologne cards with asterisk without the need for additional bridges like chan_misdn (misdn), bristuff (junghanns), visdn etc.
Using hfc-s (Datasheet) cards with your asterisk is the cheapest way to enable isdn support since these cards are already available for approx. 10€/$ at ebay and you can use more than one when you need more ports.
However the text of this first tutorial will only cover TE Mode. This is interesting for everyone who wants to operate VoIP-Devices in his/her network and dial in /out via ISDN. If you want to use your devices in NT mode it is only a few minutes more work. The ebuilds you can download here are already patched to support NT-mode.
Hardware Preparations
Before you start make sure you properly installed your ISDN card and that it does not share an IRQ with other devices. It took weeks for me to figure out that my setup did not work because my card was running on IRQ 18 and shared this with the built in ohci1394 kernel driver.
If you are unsure type lspci -v and make sure that the interrupt is not shared. Even if your card will work with a shared interrupt it can compromise your audio quality.
The output for my ready and running card is
01:07.0 Network controller: Cologne Chip Designs GmbH ISDN network controller [HFC-PCI] (rev 02)Subsystem: Cologne Chip Designs GmbH ISDN BoardFlags: bus master, medium devsel, latency 16, IRQ 18I/O ports at dc00 [disabled] [size=8]Memory at fcfff800 (32-bit, non-prefetchable) [size=256]Capabilities: [40] Power Management version 1Kernel driver in use: vzaphfcKernel modules: zaphfc
01:07.0 Network controller: Cologne Chip Designs GmbH ISDN network controller [HFC-PCI] (rev 02)
Kernel modules: zaphfc
Subsystem: Cologne Chip Designs GmbH ISDN Board
Flags: bus master, medium devsel, latency 16, IRQ 18
I/O ports at dc00 [disabled] [size=8]
Memory at fcfff800 (32-bit, non-prefetchable) [size=256]
Capabilities: [40] Power Management version 1
Kernel driver in use: vzaphfc
Software Installation
For this tutorial I use gentoo linux and will also provide ebuilds for it. However the patches are also usable with other distributions. If you took the time to build native packages for your distribution give a feedback so that I can link them.
Since gentoo’s last stable version of asterisk is currently 1.2.36 we want to unmask a newer release and use version net-misc/asterisk-1.6.2.5 for this tutorial. If you never used asterisk before I recommend to read something about it at first. (A reference guide to all things VOIP)
The dahdi version I use in this tutorial is net-misc/dahdi-2.2.1, the dahdi-tools version is net-misc/dahdi-tools-2.2.1.
The new ebuilds
The new ebuilds have the following differences to the native gentoo ebuilds:
- They are a bit more recent (spandsp, dadi, dahdi-tools)
- They support vzaphfc for one single-port HFC-cards (dahdi)
- They include the enhanced oslec-Echocanceller (dahdi)
- They include a NT-PTMP-Patch for asterisk
Until these packages are not part of the official portage tree you need to create an overlay if not existing that allows to use the new ebuilds instead of the official.
Creating an overlay for the Gentoo ebuilds
Simply create an overlay-directory, for example at /usr/portage/portage/overlay and insert the following line to your /etc/make.conf:
PORTDIR_OVERLAY=”/usr/local/portage/overlay”
Now we need to unpack the new ebuilds to our overlay:
cd /usr/local/portage/overlay
wget http://com-in.de/_dahdi/gentoo-local-portage.tar.bz2 -O /tmp/gentoo-local-portage.tar.bz2tar xjpf /tmp/gentoo-local-portage.tar.bz2
Since gentoo will still use the stable ebuilds it is time to unmask the new ones in /etc/portage/package.keywords. (If you don’t need NT-Mode you can also use asterisk and asterisk-addons from portage. But keep in mind these patches only work with asterisk > 1.6.1.)
net-libs/libpri
media-libs/spandsp
net-misc/dahdi
net-misc/dahdi-tools
net-misc/asterisk
net-misc/asterisk-addons
Installation of the new ebuilds
Next check your useflags. You really should have dahdi to build asterisk with dahdi support, if you want to use a fax device with your asterisk think about spandsp.
Now we are ready to install the new ebuilds with:
emerge libpri spandsp dahdi dahdi-tools asterisk asterisk-addons
DAHDI Configuration
After your new ebuilds are installed the next step is the configuration.
DAHDI-tools comes with a generator for your configuration called dahdi-genconf that automatically create /etc/dahdi/system.conf and /etc/asterisk/dahdi_channels.conf. The latter needs to be included in /etc/asterisk/chan_dahdi.conf.
You can try this tool but I recommend to use our tested configuration files and simply copy them to the correct locations. Don’t forget to backup your old configs, before!
If you have a HFC-Single-Port-Card use:
rm /etc/asterisk/chan_dahdi.conf /etc/dahdi/system.conf
wget http://com-in.de/_dahdi/hfcs-chan_dahdi.conf -O /etc/asterisk/chan_dahdi.conf
wget http://com-in.de/_dahdi/hfcs-system.conf -O /etc/dahdi/system.conf
For users with a HFC-Multiport-Card use:
rm /etc/asterisk/chan_dahdi.conf /etc/dahdi/system.conf
wget http://com-in.de/_dahdi/hfcx-chan_dahdi.conf -O /etc/asterisk/chan_dahdi.conf
wget http://com-in.de/_dahdi/hfcx-system.conf -O /etc/dahdi/system.conf
When you use the configuration files make sure that you adopted the settings in the configuration files for your card. For the hfc-s solution the configs should normally work out of the box. For the multiport solution you have to configure your localprefix, privateprefix and port groups according to your jumper settings of your cards ( TE/ NT mode ).
Enabling the setup
It is important to load your new modules before using them, so add the following to load the modules at startup. I use the new baselayout 2.0.1 so pick the lines for the baselayout you are using. Type eix baselayout if you don’t know your current baselayout (you need app-portage/eix for eix).
Adding the modules for Gentoo Baselayout <2
If you have a HFC-Single-Port-Card use:
echo “dahdi
zaphfc
dahdi_transcode
dahdi_echocan_oslec
dahdi_dummy” >> /etc/modules.autoload.d/kernel-2.6
For users with a HFC-Multiport-Card use:
echo “dahdi
zaphfc
dahdi_transcode
dahdi_echocan_oslec
dahdi_dummy” >> /etc/modules.autoload.d/kernel-2.6
Adding the modules for Gentoo Baselayout >=2
If you have a HFC-Single-Port-Card use:
echo “modules=\”\${modules} dahdi zaphfc dahdi_transcode dahdi_echocan_oslec dahdi_dummy\”" >> /etc/conf.d/modules
For users with a HFC-Multiport-Card use:
echo “modules=\”\${modules} dahdi wcb4xxp dahdi_transcode dahdi_echocan_oslec dahdi_dummy\”" >> /etc/conf.d/modules
Starting DAHDI and asterisk
Now you should be able to start dahdi and asterisk with
/etc/init.d/dahdi start
/etc/init.d/asterisk start
and insert them to your default runlevel when you want to start them automatically
rc-update add dahdi default
rc-update add asterisk default
Usage in the Dialplan
Finally you should be able to receive calls and start calls with Dial(DAHDI/g1/${EXTEN}).
The g1 means that the first free channel should be used. If you simply write 1 it will also work but dadi will always use the first channel.
Outlook
After this tutorial you should be able to receive and make calls using a cheap single and multiport hfc (cologne) card with your asterisk. If you have trouble read my next tutorial where I describe what really helps to debug your setup.
If you have trouble with your dialplan or want to learn something new, read my upcoming tutorial about dial plans in lua. You will learn how to write a extensions.lua for your asterisk 1.6.2 installation.
Tube Senf von admin
4 June 25, 2010, 12:10 am Uhr |
Okay, I have had the hope that Larry, the person whose tutorial has been linked in my first hyperlink still has the non-gentoo tutorial on his page but he unfortunately removed it.
You can go to the Gentoo issue tracker and search for the request to add dahdi. in the meantime it is integrated into gentoo but you will find all links and patches to the software there. I’m a bit i hurry so I’m sorry that I cannot give you a better answer but I think it is however good to find there. Maybe I gave the link in my older blog entry concerning dahdi.
Tube Senf von nemo3000
3 June 24, 2010, 11:13 pm Uhr |
Normaly I manul compile all and all work fine, I’m trying to install hfc from one mounth. Your guide is very good for gentoo but I don’t know this system and….where can I find the patch?…or wich is in this guide?
Tube Senf von admin
2 June 24, 2010, 8:16 am Uhr |
I’m not sure if the Ubuntu build of dahdi already included the patch.
However, the best way is to download all sources, patch them and compile it manually.
The resulting module should work with Ubuntu. I know that someone got it working on Ubuntu.
Stefan
Tube Senf von nemo3000
1 June 24, 2010, 1:47 am Uhr |
how can I install on ubuntu??