Tuesday, June 3, 2008

Getting Started with OpenSER: INSTALLATION OF OpenSER on Linux ( CentOS )

INSTALLATION OF OpenSER on Linux ( CentOS )

1. First install the following dependencies that will be needed to compile OpenSER sources:

- bison
- flex
- mysql
- mysql-devel
- subversion (if you intend to use subversion to get its sources

*you can install the said sources via tarballs or rpms or via yum which I did :-)

2. Now get the source OpenSER package ( I get the latest one which is 1.3.x)

svn co http://openser.svn.sourceforge.net/svnroot/openser/branches/1.3 sip-server

or via

wget http://www.openser.org/pub/openser/latest/src/openser-1.3.2-tls_src.tar.gz

3. Unzip and extract the files

tar xvzf openser-1.3.2-tls_src.tar.gz

4. cd to the source directory

cd openser-1.3.2-tls

5. Do following for compilation and installation

make clean
make all include_modules="mysql"
make prefix=/usr/local install include_modules="mysql"

6. Now edit first openserctlrc

vi /usr/local/etc/openser/openserctlrc

uncomment the line that says

DBENGINE=MYSQL

7. Now we can create the database for the OpenSER

/usr/local/sbin/openserdbctl create

*Note that upon execution of this command it will create 2 users for OpenSER

8. Now we wil edit first the openser.cfg to enable MySQL support.

vi /usr/local/etc/opernser.cfg

You will have to uncomment the following lines:

- loadmodule "/usr/lib/openser/modules/mysql.so"

- loadmodule "/usr/lib/openser/modules/auth.so"

- loadmodule "/usr/lib/openser/modules/auth_db.so"

- modparam("usrloc", "db_mode", 2)

- modparam("auth", "calculate_ha1", yes)

- modparam("auth_db", "password_column", "password")

- if (!www_authorize("sip.org", "subscriber")) {
- www_challenge("sip.org", "0");
- break;
- };


Make sure you change the two sip.org instances in the above config, to your
domain, or realm. In my case, I changed this to 192.168.2.235 which was the
IP address of this box.

Also, be sure to comment out the following line:

modparam("usrloc", "db_mode", 0)


9. Now let us copy the init script so as to start OpenSER as service ( such as starting it at boot). Copy the openser.init which can be found on the base directory of the OpenSER source. In my case I installed the source on root directory

cp /root/openser-1.3.2-tls/packaging/rpm/openser.init /etc/init.d/openser
chmod 755 /etc/init.d/openser
/sbin/chkconfig --add openser

also before you start the openser correct the path of its service execution

vi /etc/init.d/openser

change the following line

oser=/usr/sbin/openser

with this one since we installed the binaries on path /usr/local

oser=/usr/local/sbin/openser


10. Now you can start the openser service

/sbin/service openser start

11. To test we will create user / SIP account to test our set up. We can do this by using the openserctl tool

openserctl add test testpasswd test@192.168.2.235

*Note you might encounter problem once you issued the command above and complaining for the SIP_DOMAiN. To fix that,
issue the command as follows:

export SIP_DOMAIN=192.168.2.235

Now re issue the command for adding new user / SIP account

12. Test it by registering a softphone and filling up the phone's registration info's. You should be able to register already.


"Now you have a working SIP Server". Actually I am still exploring it too..... I'll give you some more additional infos whatever turns out during my studied on this software. I am more familiar with tweaking Asterisk not this one. But I heard that using Asterisk/OpenSER tandem is great for offering VOIP services.

Okey that' all for this tutorial hope this help for those who are just about to start with SER/OpenSER. Cheers to all!!!! And God Bless!!!!! :-)

Here are some more helpful links:

http://www.openser.org/dokuwiki/doku.php/install:openser-from-svn
http://www.openser.org/mos/view/-OpenSER-Installation-Notes/
http://www.oldskoolphreak.com/tfiles/voip/beginners_openser.txt

4 comments:

Andy said...

Hi,

Just wanted to say that compared to ALLLLL the other install guides out there for OpenSER, this one is by far the best and most easy to follow. I've been having a heck of a time following other peoples who told me to change files and such that weren't even there. Great Job on this write up. Keep em coming!!!

Engr. Muhammad Noman said...

dear bloggers.

kindly help me how can i install
the following on my newly installed fedora 8.

- bison
- flex
- mysql
- mysql-devel
- subversion (if you intend to use subversion to get its sources


i am new with linux platform and need ur help to install these stuff and OpenSER. kindly help .
my email addreess is

nomansaeed at gmail dot com

土魚瓜瓜 said...

hi, I was following your instruction and all went well until I tried to make it a service in the init.d. Then when I did #service openser start. I got an error message saying"start-stop-daemon" command not found.

I did some research online and found that Centos does not come with the start-stop-daemon tool. So just wondering if you did have the same issue when you install openser on your centos?

thank you

Khan said...

I need help building VoIP prototype, and having problems with OpenSIPS NAT traversal using RTPproxy, could you guide me please need to know how to contact you?
see voiprookie.blogspot for details please.