Bash Scripts – exit on immediate fail

Comments Off

With some bash scripts it can be useful to have them exit as soon as a command fails. To accomplish this have the following just after the “#!/bin/bash” line:

set -o errexit

This will cause the script to exit as soon as any command or program returns an exit status not equal to zero.
Thanks to Rory.

Skype, Linux and NFS

Comments Off

A problem I found when using the Linux client for Skype is that it will try to perform file locking, which is a problem if your home partition is an NFS drive.

To overcome this limitation, create a directory on the local hard disk:

  1. sudo mkdir /usr/local/skype
  2. sudo chown tom.tom /usr/local/skype

Delete the configuration that Skype attempted to install, and symlink to the directory on the local harddisk:

  1. rm -rf /home/tom/.Skype
  2. ln -s /usr/local/skype /home/tom/.Skype

After this Skype worked as normal.

Building Asterisk 1.4.30 and GNUGK (H323 support) on Centos 5.2

Comments Off

The completed system must support SIP clients connected to Asterisk, and H323 clients that connect to GNUGK (GNU Gatekeeper). Calls between H323 and SIP clients must be supported, in both directions.

This guide is mainly for building the Asterisk and associated RPMs. Rolling out these packages to other servers is a fairly simple task.

GNUGK is used for H323 as Asterisk 1.4.* does not support video codecs. The ‘oh323′ module is used in Asterisk, to interface with GNUGK. The ‘ooh323′ connected but the connection was unreliable and the sound quality poor, so this wasn’t used.

Additional packages required for building:

yum -y install gcc gcc-c++ kernel-devel bison openssl-devel \
libtermcap-devel ncurses-devel doxygen curl-devel newt-devel \
mlocate lynx tar wget nmap bzip2 mod_ssl crontabs vixie-cron \
speex speex-devel unixODBC unixODBC-devel libtool-ltdl \
libtool-ltdl-devel make readline-devel mysql-connector-odbc mysql mysql-devel \
mysql-server php-mysql pwlib pwlib-devel openldap-devel SDL SDL-devel \
sqlite sqlite-devel flex bison libtiff-devel bridge-utils rpm-build speex speex-devel

Before building Asterisk, the following packages must be built:

Build process:

  1. ./configure --prefix=/usr --sysconfdir=/etc --with-postgres=no
  2. make menuselect
  3. make
  4. make
  5. make install
  6. checkinstall

The ‘make’ command may have to be repeated if it is a clean build.

Optional post-compile steps:

  1. make samples
  2. make progdocs
  3. make config
  4. Asterisk-addons (version 1.4.10) may be installed, and provides the ‘h323′ module which I do not use.

Asterisk-oh323 should be compiled and installed.

Asterisk 1.4.30 is now built.

The following packages should be installed on target servers before installing the packaged RPMs:

  • SDL
  • esound
  • audiofile
  • speex
  • speex-devel

The following RPMs which have been constructed during this process, should be installed in the following order:

  1. pwlib_v1_10_2-1.10.2-1.i386.rpm
  2. openh323_v1_18_0-1.18.rpm
  3. gnugk-2.3.1-1.i386.rpm
  4. asterisk-1.4.30-1.i386.rpm
  5. asterisk-oh323-1.i386.rpm

My servers have suffered from poor Postgresql libraries and bad ooh323 experiences. The following two commands prevented my Asterisk daemon from repeatedly crashing:

  • rm /usr/lib/asterisk/modules/chan_ooh323.so
  • rm /usr/lib/asterisk/modules/res_config_pgsql.so

Configuration:
To configure and route H323 calls from GNUGK into Asterisk, edit the /etc/asterisk/oh323.conf file and set the ‘alias’ and the ‘gwprefix’ under the ‘register’ section. For example:

alias=asterisk
gwprefix=9

All calls from H323 clients starting with a ’9′ will be routed into Asterisk. Asterisk can now process and forward these calls by adding the following line in /etc/asterisk/extensions.conf:

exten=>9X.,1,Dial(SIP/${EXTEN:1})

which will strip away the ’9′.

For SIP calls to be routed out over H323, enter the following into /etc/asterisk/extensions.conf:

exten=>8X.,1,Dial(OH323/${EXTEN:1})

which will route all calls starting with an ’8′ into the OH323 module, and strip off the leading digit.

Building Asterisk-oh323 module for Asterisk-1.4.30 on CentOS 5.2

Comments Off

The interface between Asterisk and GNUGK is the ‘oh323′ which is loaded into Asterisk.

The official version of Asterisk-oh323 does not compile against Asterisk version 1.4.30 due to type mismatches with Asterisk include files. I have modified Asterisk-oh323 to resolve this issue, my version is available here.

To compile, variables in the Makefile should be updated to reflect the local environment. The build procedure:

  1. make
  2. make install
  3. checkinstall

The library ‘chan_oh323′ should be configured to installed in the directory /usr/lib/asterisk/modules/

A sample configuration file is included called ‘oh323.conf.sample’. which should be copied to ‘/etc/asterisk/oh323.conf’

For the module to load, see file ‘/etc/asterisk/modules.conf’ and either “autoload=yes” should be set or the module must be specified separately.

Building GNUGK 2.3.1 on CentOS 5.2

Comments Off

The GNU Gatekeeper is the service used by H323 client. This service supports voice and video codecs.
H323 Clients may call each other using their H323 alias, and as part of the bigger picture H323 and SIP clients may call each other using the ‘oh323′ module of Asterisk.

Prerequisites for the build processes are:

GNUGK build process:

  1. ./configure --prefix=/usr --sysconfdir=/etc
  2. make optdepend
  3. make
  4. make install
  5. checkinstall

Older Entries