– Kamailio SIP Server –

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
install:openser-from-svn [2012/03/18 07:39]
124.120.131.116
install:openser-from-svn [2012/03/20 20:11] (current)
80.250.1.245 old revision restored
Line 1: Line 1:
 +======= Note ========
 +
 +Note: Kamailio has moved to git.  See [[install:kamailio-3.0.x-from-git]] for details. 
 +1.5 and prior are still in subversion.
 +
 +
 +======= Install And Maintain Kamailio (OpenSER) From SVN =======
 +
 +<code>
 +Main author:
 +   Daniel-Constantin Mierla <miconda (at) gmail.com>
 +</code>
 +
 +This is a step by step tutorial about how to install and maintain Kamailio (OpenSER) using the sources from SVN. 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 SVN, you get access to the latest code very quickly.
 +
 +This document focuses on Kamailio (OpenSER) v1.3.0 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.
 +
 +- __svn__ client: apt-get install subversion
 +
 +- __gcc__ compiler: apt-get install gcc
 +
 +- __flex__ - apt-get install flex
 +
 +- __bison__ - apt-get install bison
 +
 +- __libmysqlclient15-dev__ - apt-get install libmysqlclient15-dev
 +
 +- __make__ - apt-get install make
 +
 +===== 2. Getting sources from SVN =====
 +
 +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.3.0
 +  
 +  cd /usr/local/src/openser-1.3.0
 +
 +
 +Download the sources from svn using the following command.
 +
 +<code>
 +svn co http://openser.svn.sourceforge.net/svnroot/openser/branches/1.3 sip-server
 +
 +</code>
 +
 +
 +===== 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 Kamailio (OpenSER) =====
 +
 +Once the mysql module was removed from excluded modules list, you can compile Kamailio (OpenSER).
 +
 +  make all
 +
 +You can get a nicer output of the compilation process using:
 +
 +  NICER=1 make all
 +
 +===== 5. Install Kamailio (OpenSER) =====
 +
 +When the compilation is ready, install Kamailio (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:
 +
 +- __kamailio__ - Kamailio server
 +
 +- __kamdbctl__ - script to create and manage the Databases
 +
 +- __kamctl__ - script to manage and control Kamailio server
 +
 +- __kamunix__ - script to manage and control Kamailio server via unix sockets
 +
 +- __kamdbctl__ - script to manage Kamailio Database
 +
 +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
 +
 +Kamailio modules are installed in:
 +
 +  /usr/local/lib/kamailio/modules/
 +
 +The documentation and readme files are installed in:
 +
 +  /usr/local/share/doc/kamailio/
 +
 +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/kamailio/kamailio.cfg
 +
 +===== 7. Create MySQL database =====
 +
 +In order to create the database you need to specify the wanted db type (DBENGINE=MYSQL) in 
 +
 +   /usr/local/etc/kamailio/kamctlrc
 +
 +To create the MySQL database, you have to use the database setup script:
 +
 +   /usr/local/sbin/kamdbctl create
 +
 +
 +Call this script without any parameter to get some help for the usage. You may be asked for the domain name Kamailio 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. You can change the default settings in the openserctlrc file mentioned above.
 +
 +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/kamailio/kamailio.cfg
 +
 +Follow the instruction in the comments 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 Kamailio server in a nicer way. A sample of init.d script for Kamailio is provided in the source tree at the following locations. Choose the correct one to suit your distro:
 +
 +<code>
 +./pkg/kamailio/debian-etch/kamailio.init
 +./pkg/kamailio/gentoo/kamailio.init
 +./pkg/kamailio/rpm/kamailio.init
 +./pkg/kamailio/rpm/kamailio.init.SuSE
 +./pkg/kamailio/debian-lenny/kamailio.init
 +./pkg/kamailio/fedora/kamailio.init
 +./pkg/kamailio/debian/kamailio.init
 +</code>
 +
 +
 +Copy the init file into the /etc/init.d/ and remove .init from the filename if required for your distro. Edit the file and check the paths at the top suit your install. Set RUN_KAMAILIO to yes here too. On Redhat you need to chmod +X the file.
 +
 +You also need to setup a configuration file in the /etc/default/ directory. Choose an appropriate file from:
 +
 +<code>
 +./pkg/kamailio/debian-etch/kamailio.default
 +./pkg/kamailio/rpm/kamailio.default
 +./pkg/kamailio/debian-lenny/kamailio.default
 +./pkg/kamailio/debian/kamailio.default
 +</code>
 +
 +You need to rename the file to 'kamailio' after you've copied it.
 +
 +Then you can start/stop Kamailio using the following commands:
 +
 +<code>
 +  /etc/init.d/openser start
 +  /etc/init.d/openser stop
 +</code>
 +
 +Note that you'll also need to consider how your starting/stopping rtpproxy, if you are using it.
 +
 +===== 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>'.
 +
 +  kamctl add test testpasswd test@mysipserver.com
 +
 +If you are asked for SIP_DOMAIN environment variable do one of the following option.
 +
 +<code>
 +  1.
 +  export SIP_DOMAIN=mysipserver.com
 +
 +  2.
 +  edit '/root/.openserctlrc' and add:
 +  SIP_DOMAIN=mysipserver.com
 +</code>
 +
 +===== 11. Maintenance =====
 +
 +The maintenance process is very simple right now. You have to be user 'root' and execute following commands:
 +
 +<code>
 +  cd /usr/local/src/openser-1.3.0/sip-server
 +  svn up
 +  make all
 +  make install
 +  /etc/init.d/openser restart
 +</code>
 +
 +Now you have the latest OpenSER v1.3.0 running on your system.
 +
 +
 +===== 12. Time for maintenance service =====
 +
 +Notification about SVN commits are sent to the mailing list: **devel@kamailio.org**. Each commit notification contains the reference to the branch where the commit has been done. If the commit message contains the line:
 +
 +<code>
 +Modified Paths:
 +--------------
 +    branches/1.3/..
 +</code>
 +
 +then an update has been made to OpenSER version 1.3.0 and it will be available to the public SVN in no time.
 +
 +===== Installation Stuff =====
 +
 +{{indexmenu>install|js}}