Debian Sarge Install Howto

From GNU Telephony

Revision as of 07:15, 14 September 2007 by Dyfet (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installing Bayonne2 on a Debian Sarge


Here are some notes if you want to venture into the Bayonne2 world.

This document will be divided in two parts: - installing a standalone Bayonne2 server - building a sample SIP based IVR


Prerequisites

These are some Debian dependencies for being able to compile something:

gcc g++ libc6-dev cpp linux-kernel-headers

These one will be needed too

libgsm1-dev libgsm1 pkg-config

if you want to use third party Perl scripts:

libperl-dev >= 5.8.7-3


Now, grab the most recent stables versions of these components here (link)

 SIP libs: libosip2, libeXosip2
 Bayonne stuff: bayonne2, commoncpp2, ccaudio2, ccrtp, ccscript3


Compilation

You'll have to compile each component, respecting a certain order. First, the drivers (SIP, oH323, etc), then CommonCpp and his child apps, and finally Bayonne.

Basically, the raw command lines will be:

$ tar xzf libosip2-x-y-z.tar.gz
$ cd libosip2-x-y-z && ./configure
$ make
$ su -c make install
$ tar xzf libeXosip2-x-y-z.tar.gz
$ cd libeXosip2-x-y-z && ./configure --disable-josua
$ make
$ su -c make install
$ tar xzf commoncpp2-x-y-z.tar.gz
$ cd commoncpp2-x-y-z && ./configure
$ make
$ su -c make install
$ tar xzf ccaudio2-x-y-z.tar.gz
$ cd ccaudio2-x-y-z && ./configure
$ make
$ su -c make install
$ tar xzf ccrtp-x-y-z.tar.gz
$ cd ccrtp-x-y-z && ./configure
$ make
$ su -c make install
$ tar xzf ccscript3-x-y-z.tar.gz
$ cd ccscript3-x-y-z && ./configure
$ make
$ su -c make install
$ tar xzf bayonne-1.2.0-x-y-z.tar.gz
$ cd bayonne-1.2.0-x-y-z && ./configure
$ make
$ su -c make install


Now you're done. If everything's allright the Bayonne Telephony server is now installed under /use/local You should find config files under /etc/bayonne, and an Init script under /etc/init.d You may also find a default config file like /etc/sysconfig/bayonne or /etc/default/bayonne


Adjust the server paths and some parameters in your config files:

/etc/bayonne/server.conf
[paths]
libexec = /usr/local/share/bayonne/libexec
datafiles = /var/lib/bayonne
logfiles = /var/log/bayonne
runfiles = /var/run/bayonne
config = /etc/bayonne
;drivers = /usr/local/lib/bayonne-majver-minver
;modules = /usr/local/lib/bayonne-majver-minver
scripts = /usr/local/share/bayonne/scripts
prompts = /usr/local/share/bayonne/audio
[server] user = bayonne group = bayonne voice = en/deborah logging = notice


Testing a SIP based IVR

As we have builded Bayonne with the osip2 libs, we could try a sample application. Modify the existing configuration for SIP operations:

#/etc/bayonne/drivers.conf
[sip]
inband = false
interface = <your eth_ip>:5060
;rtp = 5074
#/etc/bayonne/server.conf
[engine]
driver = sip


Be sure you have opened the necessary ports. By default, SIP requires UDP/5060 and RTP requires UDP/5074+(n*4), where n is the number of needed timeslots.


Let's try this sample script dtmf_say.scr, which should be placed in the scripts directory (ie: /usr/local/share/bayonne/ivrscripts)

 %% ignored if no sip driver loaded...
   register.sip proxy=172.20.0.56 uri=sip:dtmf_say@bayonne
clear %session.digits play o k goto ::mytest
program mytest sleep 15 goto ::mytest
^dtmf string.1 %keyp collect %keyp count=1 slog "DTMF %keyp detected" play &number %keyp goto ::mytest


Now let's start Bayonne and have a look at the log file. SIP registration is being made, directories are scanned for script files, found script files are compiled in memory.

 Mar 16 15:36:02 ptg1 bayonne[4531]: sip: adding sdp encoding 0 PCMU/8000
 Mar 16 15:36:02 ptg1 bayonne[4531]: sip: bound to port 5060
 Mar 16 15:36:02 ptg1 bayonne[4531]: sip msgport starting
 Mar 16 15:36:02 ptg1 bayonne[4531]: binding ivrscript...
 Mar 16 15:36:02 ptg1 bayonne[4531]: compiled runlevel::default; 1 steps
 Mar 16 15:36:02 ptg1 bayonne[4531]: compiled runlevel::down; 1 steps
 Mar 16 15:36:02 ptg1 bayonne[4531]: compiler scanning /usr/local/share/bayonne/ivrscript1
 Mar 16 15:36:02 ptg1 bayonne[4531]: compiler scanning /usr/local/share/bayonne/scripts
 Mar 16 15:36:02 ptg1 bayonne[4531]: register dtmf_say as dtmf_say on sip:172.20.0.56
 Mar 16 15:36:02 ptg1 bayonne[4531]: compiled dtmf_say 8 steps
 Mar 16 15:36:02 ptg1 bayonne[4531]: compiled dtmf_say 3 steps
 Mar 16 15:36:02 ptg1 bayonne[4531]: 3 scripts compiled
 Mar 16 15:36:02 ptg1 bayonne[4531]: driver(s) started; 16 timeslot(s) used
 Mar 16 15:36:02 ptg1 bayonne[4531]: tcpmon service started
 Mar 16 15:36:03 ptg1 bayonne[4531]: registration for sip:dtmf_say@172.20.0.58:5060 confirmed

I'm calling now...

 Mar 16 15:36:09 ptg1 bayonne[4531]: sip/0: DTMF 4 detected
 Mar 16 15:36:11 ptg1 bayonne[4531]: sip/0: DTMF 5 detected

...and I've heard Deborah's voice saying four, five! Note that 'o k' is made from o.au and k.au in the audiodir/en/deborah directory; in the same way, play &number %keyp will be playing 0.au, 1.au etc...


Logging


You may want to go further in troubleshooting your applications, so you need a correct logging solution. Consider installing syslog-ng on your system, then uninstall sysklogd and klogd (however they should be already removed for conflict).

# apt-get install syslog-ng
# apt-get --purge remove sysklogd klogd
# mkdir /var/log/bayonne


Here's an extract from my syslog-ng.conf file:

destination df_bayonne_info { file("/var/log/bayonne/all.log"); };
destination df_bayonne_debug { file("/var/log/bayonne/debug.log"); }
filter f_bayonne_info { facility(user) and match("bayonne"); }; filter f_bayonne_debug { facility(user) and match("bayonne") and level(debug); };
log { source(s_all); filter(f_bayonne_info); destination(df_bayonne_info); }; log { source(s_all); filter(f_bayonne_debug); destination(df_bayonne_debug); };


Now, enable a sufficient level of logging into your bayonne server and restart it.

#/etc/bayonne/server.conf
[server]
logging = debug


Monitoring your server activity

A few monitoring apps are included in the server build. I don't know much about them, maybe I'll try to write a dedicated article later.

#/etc/bayonne/server.conf
[server]
monitoring = tcp
#/etc/bayonne/module.conf
[tcpmon]
interface = 127.0.0.1:5555
secret = pass

Restart your bayonne server. You are now able to telnet localhost 5555 and manage your telephony server.

Personal tools