Thursday, August 24, 2006

Asterisk Installation on Debian Sarge 3.1

Asterisk Installation on Debian Sarge:
Linux rbast 2.6.8-2-386 #1 Tue Aug 16 12:46:35 UTC 2005 i686 GNU/Linux

After several days of trying to have a Linux box with a recompiled kernel (and failed every time) I gave up and just do the basic/minimum and no packages installation of debian netinstall. After that I started the Asterisk installation.


Here are the steps. They worked for me, I picked them up from several sites.

cd /usr/src/
apt-get install kernel-headers-2.6.8-2-386

apt-get install cvs
apt-get install libssl-dev
apt-get install zlib1g-dev
apt-get install libnewt-dev
apt-get install bison
apt-get install ncurses-dev
apt-get install libssl-dev
apt-get install initrd-tools
apt-get install procps


mkdir asterisk
cd asterisk

wget http://ftp.digium.com/pub/asterisk/asterisk-1.2.4.tar.gz
wget http://ftp.digium.com/pub/zaptel/zaptel-1.2-current.tar.gz
wget http://ftp.digium.com/pub/libpri/libpri-1.2-current.tar.gz
wget http://ftp.digium.com/pub/libiax/iax-0.2.2.tar.gz
wget http://ftp.digium.com/pub/asterisk/asterisk-1.2-current.tar.gz
wget http://ftp.digium.com/pub/asterisk/asterisk-addons-1.2-current.tar. gz

tar xvfz libpri-1.2-current.tar.gz
cd libpri-1.2.3/
make clean
make
make install

cd ..
tar xvfz zaptel-1.2-current.tar.gz
cd zaptel-1.2.8/
make clean
make linux26)
make install
modprobe zaptel
modprobe wcfxo
ztcfg
(from goods2world where I bout the cheap/clone x100p. => Also, this commands need to get executed whenever
you restart the system. Make sure to add it to init.d loading scripts. Stupid installation manual can be found
here http://www.goods2world.com/downloads/X100PG2W.pdf)


cd ..
tar xvfz asterisk-1.2-current.tar.gz
cd asterisk-1.2.11/
make
make install
make samples

(don't know why I put this notes here)
wget http://ftp.digium.com/pub/asterisk/g729/linux/32-bit/i386/codec_g72 9a.so
wget http://ftp.digium.com/pub/asterisk/g729/register_utility/glibc2.3.5 /x86/register
wget http://ftp.digium.com/pub/asterisk/releases/asterisk-sounds-1.2.1.t ar.gz

cd ..
tar xvfz asterisk-sounds-1.2.1.tar.gz
cd asterisk-sounds-1.2.1
make clean
make install

cd ..
cd asterisk-addons-1.2.4/
make clean
make
make install


cd..
modprobe ztdummy


From Asterisk TFOT
Let’s look at some examples. To start Asterisk and connect to the CLI with a verbos-
ity level of 3, use the following command:
# /usr/sbin/asterisk –cvvv
If the Asterisk process is already running (for example, if you started Asterisk with
/usr/sbin/asterisk), instead use the reconnect switch, like so:
# /usr/sbin/asterisk –vvvr

Get a sipphone and install it. Try to connect to the ip of the server and dial any number.
The examples installation prepared the system to accept any incoming call and play a menu so
anything you dial will work. If you hear the menu. You are ready for phase II (now what!!!)

Next step. READ THE MANUALS!!!!

Tuesday, August 22, 2006

SELinux Tip

I installed vlcplayer and mplayer to watch movies and also add some codecs. When run this applications generated errors on dmesg like the following:

audit(1156241386.596:14): avc: denied { execmod } for pid=2850 comm="vlc" name="libavutil.so.49.0.0" dev=dm-0 ino=284990 scontext=user_u:system_r:unconfined_t:s0 tcontext=system_u:object_r:lib_t:s0 tclass=file

This was an issue on SELinux don't giving them access to the files. Looking around I found the following comment on http://fedora.redhat.com/docs/selinux-faq-fc5/:


SELinux restricts certain memory protection operation. Following is a list of those denials, as well as possible reasons and solutions for those denials. For more information on these restrictions, see http://people.redhat.com/drepper/selinux-mem.html.

These show up in /var/log/messages (or /var/log/audit/audit.log if using the audit daemon) as avc denials. These can also show up when running programs with errors like

error while loading shared libraries: /usr/lib/libavutil.so.49:
cannot restore segment prot after reloc: Permission denied

which indicates that the library is trying to perform a text relocation and failing. Text relocations are bad, but can be allowed via the first hint below. Below are the SELinux memory permissions that are denied, as well as hints at how to address these denials.

execmod

This is usually based on a library label. You can permanently change the context on the library with the following commands

# /usr/sbin/semanage fcontext -a -t textrel_shlib_t '/usr/lib/libavutil.so.49.0.0'
# /sbin/restorecon -v /usr/lib/libavutil.so.49.0.0

with the particular library at fault in place of /usr/lib/libavutil.so.49.0.0. Now your application should be able to run. Please report this as a bugzilla.
execstack

Attempt to execstack -c LIBRARY. Now try your application again. If the application now works, the library was mistakenly marked as requiring execstack. Please report this as a bugzilla.
execmem, execheap

A boolean for each one of these memory check errors have been provided. So if you need to run an application requiring either of these permissions, you can set the boolean allow_exec* to fix the problem. For instance if you try to run an application and you get an AVC message containing an execstack failure. You can set the boolean with

setsebool -P allow_execstack=1

Sunday, August 20, 2006

Wireless on a nx6125

My work laptop is an HP nx6125 and it comes with a Broadcom wireless adapter. To make it run on windows I used ndiswrapper and worked fine. I went to HP support page and dowload the window drives. There I took the file bcmwl5a.ini (bcmwl5.ini doesn't work) and bcmwl5.sys and copied on the ndiswrapper directory.

Check this site for details:

http://ndiswrapper.sourceforge.net/mediawiki/index.php/Installation
http://ndiswrapper.sourceforge.net/mediawiki/index.php/Fedora

After ndiswrapper installation the process is as follows:

ndiswrapper -i
ndiswrapper -l
ndiswrapper -m
modprobe ndiswrapper

ifconfig eth0 down
ifconfig eth1 up (In fedora wlan is eth1)
iwconfig eth1 key
iwconfig eth1 essid
dhclient eth1
ifconfig to check the system

At this time you will see eth1 on the Network Manager of Fedora.

Serial Connection

My asterisk box (no monitor or keyboard) will need serial connection "just in case the network" goes down. I have another box next to it and connected through the serial. To allow this we need to change the inittab file as by default the serial connection is usually disabled.

As root vi /etc/inittab:
rbold:/etc# vi inittab
Check the file and you will find something like this:
# Example how to put a getty on a serial line (for a terminal)
T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

In my case I remove the coment from the fist line and it worked. I've seen on the web examples with s0 instead of T0, it makes more sense but maybe it is a Debian thing.

The options for this file are:
  • -L force line to be local line with no need for carrier detect (when you have no modem).
  • 9600 serial line rate in bps. Set this to your dumb terminal or terminal emulator line rate.
  • ttyS0 this is the serial port identifier.
  • vt100 is the terminal emulation.
Check the web for more otpions

Update

I got lost for 2 months. I was resolved to start on this and now is time. Since I started this a few things have happened:
  • Change job (well kind of - different company but same desk).
  • Change city, I left city move to a little boring - great to just read and learn - town.
  • Bought a Nikon D50
  • Installed FC5 on my laptop as base work OS (still have a pc with WXP for some win32 stuff).
  • Installed a Debian 3.1r2 - Unstable- pc to run Asterisk on it. Installation TODAY!
  • Got an iMac as secondary work pc.
Well lets see how this goes.