Monday, January 08, 2007

Installing Asterisk again

I installed Asterisk again. This time version 1.4.

As always I did a Debian Sarge netsinstall. On boot I choose the linux26 option to have a 2.6 kernel rather than the 2.4 that comes by default.. Why? Have no idea.

The installation is really basic, I don't choose any configuration when Debian asksfor "Desktop", "Web Server", etc.. I just give the ok and start with an empty server.

(Note that I tried to run the "testing" or "etch" version of netinstall but Asterisk requieres headers. The etch version repository don't have the headers for the default installation and you need to recompile.. AND I CANNOT RECOMPILE THE BLODDY KERNEL YET. I tried, I really tried and read several posts/pages and run diferent methods - from building my debian kernel package to actually recompile the kernel from source - but always I get a Kernel Panic. If anybody want's to sit with me and show me how to do it, I will pay for the lunch/coffee).

After the installation I changed the source.list to add contrib and non-free packages when installing new software. The file can be seen below:

rbast:/etc/asterisk# cd /etc/apt/
rbast:/etc/apt# more sources.list
#deb file:///cdrom/ sarge main

deb http://ftp.uk.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ stable main contrib non-free

deb http://security.debian.org/ stable/updates main contrib non-free
rbast:/etc/apt#


You have to run apt-get update after this to let Debian pick up the changes (need to read more about apt).

Then I run the apt-get dist-upgrade to upgrade all the packages installed.

First step after install - as I like to do things remotely - is to do the apt-get install ssh. This will install a ssh client and server (openssh) so I can log in remotely and keep working from my laptop. Ah.. I never mentioned this but the "server" is an old HP PIII box.

Next step install the headers needed for Asterisk:

apt-get install kernel-headers-`uname -r`

Download all the packages again:

wget http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.0.tar.gz
wget http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.0.tar.gz
wget http://ftp.digium.com/pub/libpri/releases/libpri-1.4.0.tar.gz
wget http://ftp.digiu
m.com/pub/asterisk/releases/asterisk-addons-1.4.0.tar.gz
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-sounds-1.2.1.tar.gz


And follow the installation as with 1.2.x, only a few things changed (maybe more.. correct me please).

On the asterisk package you need to run the configure utility as show below:
tar xvfz asterisk-1.4.0.tar.gz
cd asterisk-1.4.0
./configure
make
make install
make samples


Also on the asterisk-addons or you will get an error message after the make if not.

Some tips I picked up this time (also the last time but I didn't take note of them at that time) are:

a) run lspci - shows the 2 fxo clones I bought (2 years ago by now).

rbast:/usr/src/asterisk# lspci
0000:00:1f.5 Multimed
ia audio controller: Intel Corp. 82801AA AC'97 Audio (rev 02)
0000:01:0b.0 Communication controller: Tiger Jet Network Inc. Tiger3XX Modem/ISDN interface
0000:01:0e.0 Communication controller: Tiger Jet Network Inc. Tiger3XX Modem/ISDN interface
rbast:/usr/src/asterisk#


b) run lsmod - shows the modules loaded. (I have way too much modules)

rbast:/usr/src/asterisk# lsmod
Module Size Used by
wcfxo 12448 0
zaptel 231332 1 wcfxo


Other usefull things to check are:
cat /proc/zaptel/* --> it should show 2 files.

After installation I need to configure my 2 fxo boards:

In zaptel.conf set the following configuration:

fxsks=1-2
loadzone=uk
defaultzone=uk


Then execute:

/sbin/ztcfg -vvvv

In zapata.conf set the following configuration:

[channels]
language=en

context=zap
signalling=fxs_ks
callerid="Line 1"
channel => 1
callerid="Line 2"
channel => 2


Finally reload chan_zap.so

Set sip.conf as follows to have 2 extensions - a grandstream budgetone 100 and then a normal xlite softphone.

[10001]
type=friend
context=sip
regexten=10001
secret=10001
username=10001
callerid="GrandStream1" <10001>
host=dynamic
nat=no
canreinvite=yes
dtmfmode=info
call-limit=1
disallow=all
allow=ulaw

allow=alaw
callingpres=allowed_passed_screen

[10002]
type=friend
regexten=10002
context=sip
secret=10002
username=10002
callerid="XLite" <10002>
host=dynamic
nat=yes
canreinvite=no
disallow=all

llow=gsm
allow=ulaw
allow=alaw


My extensions.conf atm is rather simple. I have 2 sip phones, 2 zap lines and just for testing the following configuration should work:

[general]
static=yes
writeprotect=no
clearglobalvars=no
[sip]
exten => 10001,1
,Dial(SIP/10001,20,tr);
exten => 10002,1,Dial(SIP/10002,20,tr);
exten => _8XXXX,1,Dial,Zap/1/${EXTEN}
exten => _9XXXXXXXXXXX,1,Dial,Zap/1/${EXTEN}
[zap]
exten => s,1,Dial(SIP/10001,20,tr);

The above configuration should ring the 2 sip phones and allow the sip phones to ring any extension on my office through the 1st zap channel (need to read about macros to use both and pick up an available zap channel).

It will also send any call from my pbx to the grandstream phone.

My PBX is an Avaya CM3. I want to set up an H323 trunk, but at the moment anybody dialing extension 8xxx1 and 8xxx2 (I am not trying to hide the extensions number, I really don't remember them) will send the calls to the grandstream sip phone.

The Grandstream configuration is simple and show on the picture attached. To configure it first check the phone ip - activate dhcp or enter an ip using he keypad - and log in. The default password is admin, if you don't know the password you can reset it by going to the "reset" option on the phone menu throught the keypad and enter the mac address of the phone. Look for the grandstream manual on the net as they have some rules of how to change the mac address letters for numbers.

That is all for today.. Good luck!

Usefull links:
http://kb.digium.com/ -> Digium Knowledge Base.