Recently I had the idea of setting up Asterisk on my up-to-date Ubuntu server. Asterisk is a very powerfull but also very complex, feature-rich and flexible telephony server. If all you want is sending and receiving faxes, an answering machine for your ISDN phones or similar simple things based on ISDN services, capisuite is the way to go. But as soon as you want services based on analog lines or VoIP, you should get familar with Asterisk. So I did.
My goal is a quite complex set up aiming on saving on international calls with my mobile by forwarding calls and some other ideas, but it's not all laid out yet and might change so I won't go into detail here at this time. Goal of this article is to get a basic asterisk up and running as a base to start working on it.
After reading this article you might think: Why going through all this trouble with Ubuntu? Why not use AsteriskNow or Trixbox? Well, the problem with AsteriskNow 1.0.2 is that when you use the Fritz!PCI card the whole system will crash during the boot process. But only if you have the ISDN cable plugged in. But even if you boot without the cable plugged in there are several problems because the fcpci driver is just broken. I never tried Trixbox but I don't like the halfway commercial philosophy of the project and the fact that it rewrites the config files when you change something in the web interface.
Getting the Fritz!PCI card up and running
It should work out of the box in Ubuntu. But actually it doesn't.
The driver is called fcpci.ko and resides in linux-restricted-modules, so installing this package and capiutils
In order to solve this problem you should build the module yourself. To do it the ubuntu way you should do it as described here. And don't backup the files in the target directory in the last step, just overwrite them. First download the proper sources.
$ sudo -s # tar -xzf AVM-Fritz.tar.gz # mv AVM-Fritz /usr/src # cd /usr/src/AVM-Fritz/fcpci-3.11.07 # make # cp driver.o fcpci.mod.o lib.o main.o queue.o tables.o tools.o /lib/linux-restricted-modules/2.6.24-16-generic/fcpci/
After a reboot the module fcpci.ko will be built and loaded automatically.
Installing Asterisk and get asterisk-chan-capi working
Asterisk is in universe, so you can install it easily with apt-get. To make it work with ISDN you need asterisk-chan-capi for asterisk to be able to communicate with the CAPI layer. asterisk-config has a set of example configuration files. To have some sound files to work with you should also install at least asterisk-sounds-main.
The dialplan resides in /etc/asterisk/extensions.conf. Due to some reason I don't know the start-extension s doesn't work for CAPI devices, so you have to use the MSN you're calling asterisk at. In this example I use 123456.
Now we need to make sure chan_capi gets loaded when asterisk is started. To do so we need to edit /etc/asterisk/modules.conf. Change the line
noload => chan_capi.so
load => chan_capi.so
So now we restart asterisk and connect to asterisk to see what's going on and then we call our MSN 123456. What you will see will look like this.
# /etc/init.d/asterisk restart # asterisk -r Asterisk 1.4.17~dfsg-2ubuntu1, Copyright (C) 1999 - 2007 Digium, Inc. and others. Created by Mark Spencer <email@example.com> Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= This package has been modified for the Debian GNU/Linux distribution Please report all bugs to http://bugs.debian.org/asterisk ========================================================================= Connected to Asterisk 1.4.17~dfsg-2ubuntu1 currently running on abfax (pid = 11102) Verbosity is at least 3 [May 17 15:17:10] WARNING: channel.c:3059 set_format: Unable to find a codec translation path from unknown to gsm [May 17 15:17:10] WARNING: file.c:871 ast_streamfile: Unable to open /usr/share/asterisk/sounds/hello-world (format 0x0 (nothing)): No such file or directory [May 17 15:17:10] WARNING: app_playback.c:437 playback_exec: ast_streamfile failed on CAPI/ISDN1#02/123456-0 for /usr/share/asterisk/sounds/hello-world
This looks pretty bad and google isn't a big help in this case. But the problem is known as well and can be solved by compiling the packet asterisk-chan-capi.