Table of Contents

Install And Maintain OpenSER From CVS

This is a step by step tutorial about how to install and maintain OpenSER using the sources from CVS. Even it is more complex to install, it is easier to maintain. Installation is done once while maintainace has to be done each time a new issue was discovered and fixed. Using the CVS, you get access to the latest code very quickly.

This document focuses on OpenSER v1.0.1 with MySQL support, using a Debian unstable system.

1. Prerequisites

To be able to follow the guidelines from this document you need root access.

The following packages are required before proceeding to the next steps.

- cvs client: apt-get install cvs

- gcc compiler: apt-get install gcc

- flex - apt-get install flex

- bison - apt-get install bison

- libmysqlclient15-dev - apt-get install libmysqlclient15-dev

2. Getting sources from CVS

First of all, you have to create a directory on the file system where the sources will be stored.

mkdir -p /usr/local/src/openser-1.0.1

cd /usr/local/src/openser-1.0.1

Download the sources from CVS using the following commands. When prompted for a password for 'anonymous', simply press the Enter key.

cvs -d:pserver:anonymous@openser.cvs.sourceforge.net:/cvsroot/openser login

cvs -z3 -d:pserver:anonymous@openser.cvs.sourceforge.net:/cvsroot/openser co -r rel_1_0_0 sip-server

3.Tuning Makefiles

Next step is to edit Makefile files to include the MySQL module.

cd sip-server

vim Makefile

Find the variable containing the list with to excluded module. The line is starting with:

exclude_modules?=

Remove the 'mysql' string from the list. Save the Makefile and exit.

4. Compile OpenSER

Once the mysql module was removed from excluded modules list, you can compile OpenSER.

make all

You can get a nicer output of the compilation process using:

NICER=1 make all

5. Install OpenSER

When the compilation is ready, install OpenSER with the following command:

make install

6. What and where was installed

The binaries and executable scripts were installed in:

/usr/local/sbin

These are:

- openser - OpenSER server

- openser_gen_ha1 - tool for generating HA1 string for WWW digest authentication

- openser_mysql.sh - script to create an manage the MySQL database

- openserctl - script to manage and control OpenSER server

- openserunix - script to manage and control OpenSER server via unix sockets

To be able to use the binaries from command line, make sure that '/usr/local/sbin' is set in PATH environment variable. You can check that with 'echo $PATH'. If not and you are using 'bash', open '/root/.bash_profile' and at the end add:

PATH=$PATH:/usr/local/sbin
export $PATH

OpenSER modules are installed in:

/usr/local/lib/openser/modules/

The documentation and readme files are installed in:

/usr/local/share/doc/openser/

The man pages are installed in:

/usr/local/share/man/man5/
/usr/local/share/man/man8/

The configuration file was installed in:

/usr/local/etc/openser/openser.cfg

7. Create MySQL database

To create the MySQL database, you have to use the openser_mysql.sh script:

 /usr/local/sbin/openser_mysql.sh create

You will be asked for the domain name OpenSER is going to serve (e.g., mysipserver.com) and the password of the 'root' MySQL user. The script will create a database named 'openser' containing the tables required by OpenSER.

The script will add two users in MySQL:

- openser - having the password 'openserrw', user which has full access rights to 'openser' database

- openserro - having the password 'openserro', user which has read-only access rights to 'openser' database

Do change the passwords for these two users immediately after the database is created.

8. Edit configuration file

To fit your requirements for the VoIP platform, you have to edit the configuration file.

/usr/local/etc/openser/openser.cfg

Follow the instruction in the commentaries to enable usage of MySQL. If you changed the password for the 'openser' user of MySQL, you have to update the value for 'db_url' parameters.

9. The init.d script

The init.d script can be used to start/stop the OpenSER server in a nicer way. A sample of init.d script for OpenSER is provided at:

/usr/local/src/openser-1.0.1/sip-server/etc/openser.init

Follow the instruction provided by http://www.openser.org/dokuwiki/doku.php?id=make_openser.init_script_work to make the srcript work for your system.

Then you can start/stop OpenSER using the following commands:

/etc/init.d/openser start
/etc/init.d/openser stop

10. Ready to rock

Now everything is in place. You can start the VoIP service, creating new accounts and setting the phones.

A new account can be added using 'openserctl' tool via 'openserctl add <username> <password> <email>'.

openserctl add test testpasswd test@mysipserver.com

If you are asked for SIP_DOMAIN environment variable do one of the following option.

1.
export SIP_DOMAIN=mysipserver.com
2.
edit '/root/.openserctlrc' and add:
SIP_DOMAIN=mysipserver.com

11. Maintenance

The maintenance process is very simple right now. You have to be user 'root' and execute following commands:

cd /usr/local/src/openser-1.0.1/sip-server
cvs update -dP
make all
make install
/etc/init.d/openser restart

Now you have the latest OpenSER v1.0.1 running on your system.

12. Time for maintenance service

Notofication about CVS commits are sent to the mailing list: devel@openser.org. Each commit notification contains the reference to the branch where the commit has been done. If the commit message contains the line:

Modified files:        (Branch: rel_1_0_0)

then an update has been made to OpenSER version 1.0.1 and it will be available to the public cvs in short time (several hours due to SourceForge CVS management policy).