Você está na página 1de 10

OpenSIPS installation Guide v1.

0
sdfasfasdf

OpenSIPS Configuration Guide


Version 1.0

2010.11.25

Project Team
Marco Pierobon (15)
Michel Hognerud (30)
Nina Mulkijanyan (24)
Prajwol Kumar Nakarmi (30)
Sharique Javaid (15)
Sujan Dey (15)
Syed Saad Ali (30)
Venkatesh Change Gowda (24)

Project Owners
marco87c@hotmail.it
hognerud@kth.se
ninamu@kth.se
nakarmi@kth.se
sharique@kth.se
sujan@kth.se
ssali3@kth.se
vch@kth.se

Niklas Lindhe niklas@xtecom.com


Erik Eliasson eliasson@it.kth.se

Project Coach
Hans Eriksson hansa@me.com

Project Champion
Bjrn Pehrson bpehrson@kth.se
Page 1 of 10

Development partner:

OpenSIPS installation Guide v1.0

Revision History
Version

Date

Remarks

Authors

1.0

2010-11-25

Document creation

Nina Mulkijanyan, Prajwol Kumar


Nakarmi

Page 2 of 10

OpenSIPS installation Guide v1.0

Table of Contents
Revision History ...................................................................................................................................... 2
1. Introduction ........................................................................................................................................ 4
1.1 Purpose ......................................................................................................................................... 4
1.2 Scope ............................................................................................................................................. 4
1.3 Target audience ............................................................................................................................ 4
2. OpenSIPS installation .......................................................................................................................... 5
2.1 Assumptions .................................................................................................................................. 5
2.2 Installation .................................................................................................................................... 5
3. OpenSIPS module configuration ......................................................................................................... 6
3.1 MySQL module .............................................................................................................................. 6
Prerequisites ................................................................................................................................... 6
Step-by-step instruction ................................................................................................................. 6
3.2 DB authentication module ............................................................................................................ 6
Prerequisites ................................................................................................................................... 6
Step-by-step instruction ................................................................................................................. 7
3.3 Presence module .......................................................................................................................... 8
Prerequisites ................................................................................................................................... 8
Step-by-step instruction ................................................................................................................. 8
4. References ........................................................................................................................................ 10

Page 3 of 10

OpenSIPS installation Guide v1.0

1. Introduction
1.1 Purpose
The purpose of the document is to provide instruction to install and configure OpenSIPS server on
Linux OS. The document also includes the guide to configure OpenSIPS authentication and presence
modules.

1.2 Scope
The scope of the document covers the minimal installation of OpenSIPS software and configuration
of authentication and presence modules.

1.3 Target audience


The target audience of the document is network administrators who need to deploy OpenSIPS server
as SIP server or SIP proxy.

Page 4 of 10

OpenSIPS installation Guide v1.0

2. OpenSIPS installation
2.1 Assumptions

OpenSIPS is to be installed on Debian-based OS supporting aptitude manager.


Vim is used as text editor, any other editor can be used.

2.2 Installation
1) Add OpenSIPS repository to source.list
sudo vim /etc/apt/sources.list
# debian.leurent.eu (Stable version)
deb http://debian.leurent.eu/debian stable main
deb-src http://debian.leurent.eu/debian/ stable main
sudo aptitude update
aptitude install -y leurent-archive-keyring
sudo aptitude update
2) Install OpenSIPS
sudo apt-get install opensips
sudo vim /etc/default/opensips
RUN_OPENSIPS=YES
sudo apt-get install opensips
3) Create run directory
sudo vim /etc/init.d/opensips
[ -d $HOMEDIR ] || mkdir $HOMEDIR
4) Edit opensipsctlrc file
sudo vim /etc/opensips/opensipsctlrc
Uncomment following line and replace domain.com with the default SIP domain.
SIP_DOMAIN=domain.com
5) Run OpenSIPS
sudo /etc/init.d/opensips start
6) Test the installation
sudo netstat -tulp | grep opensips

Page 5 of 10

OpenSIPS installation Guide v1.0

3. OpenSIPS module configuration


3.1 MySQL module
Prerequisites
MySQL installed
Step-by-step instruction
1) Install MySQL module
sudo apt-get install opensips-mysql-module

2) Configure OpenSIPS to use database


sudo vim /etc/opensips/opensipsctlrc
Uncomment the following lines and replace user and password with corresponding values for the
MySQL database
## database host
DBHOST=localhost
## database name (for ORACLE this is TNS name)
DBNAME=opensips
## database read/write user
DBRWUSER=user
## password for database read/write user
DBRWPW="password"
3) Create the database
sudo opensipsdbctl create
4) Restart OpenSIPS
sudo service opensips restart

3.2 DB authentication module


Prerequisites
MySQL installed
db_mysql module installed and configured
database created

Page 6 of 10

OpenSIPS installation Guide v1.0


Step-by-step instruction
1) For authentication with no plaintext passwords stored edit opensipsctlrc file
sudo /etc/opensips/opensipctlrc
STORE_PLAINTEXT_PW=0
2) Edit opensips.cfg file
sudo

/etc/opensips/opensips.cfg

Uncomment following lines


loadmodule "auth.so"
loadmodule "auth_db.so"

modparam("auth_db", "db_url",
"mysql://username:password@localhost/opensips")
Replace opensips, username, password with database name specified in opensipsctlrc,
username for the database and password correspondingly
For authentication with plaintext passwords stored in database
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
For authentication with only password hashes stored
modparam("auth_db", "calculate_ha1", 0)
modparam("auth_db", "password_column", "ha1")
In main route uncomment and replace domain with
a) default SIP domain for disabling storing plaintext passwords
b) IP address of the server for enabling storing plaintext passwords
#authenticate the REGISTER requests (uncomment to enable auth)
if (!www_authorize("domain", "subscriber"))
{
www_challenge("domain", "0");
exit;
}
3) Restart OpenSIPS
sudo service opensips restart
4) To create the user use command
sudo opensipsctl add username password

Page 7 of 10

OpenSIPS installation Guide v1.0

3.3 Presence module


The chapter describes the simplest configuration of a presence server without privacy rules, when
anybody is allowed to see the presence status of anybody. For enabling privacy rules and policies
XCAP server needs to be installed and configured. The installation of XCAP server and corresponding
OpenSIPS modules is out of the scope of this document.
Prerequisites
db_mysql
database created
Step-by-step instruction
1) Install presence modules
sudo apt-get install opensips-presence-modules
2) Load the modules into OpenSIPS and configure them
sudo vim /etc/opensips/opensips.cfg
Uncomment lines
loadmodule db_mysql.so
loadmodule "presence.so"
loadmodule "presence_xml.so
-- presence params -modparam("presence|presence_xml",
db_url", mysql://username:password@127.0.0.1/opensips")

modparam("presence", "server_address", "sip:sa@localhost:5060"


modparam("presence_xml", "force_active", 1)

Uncomment in main route


if( is_method("PUBLISH|SUBSCRIBE"))
route(2);
Uncomment presence handling route
# presence handling route
route[2]
{
# absorb retransmissions
if (! t_newtran())
{
sl_reply_error();
exit;
};
#handle presence requests
if(is_method("PUBLISH"))
{
handle_publish();
t_release();
/* the call to t_release is no longer needed in
1.5 */
Page 8 of 10

OpenSIPS installation Guide v1.0


}
else if( is_method("SUBSCRIBE")) {
handle_subscribe();
t_release();
/* the call to t_release is no longer needed in 1.5 */
};
}

exit;

3) Restart OpenSIPS
sudo service opensips restart

Page 9 of 10

OpenSIPS installation Guide v1.0

4. References
[1] OpenSIPS home page, http://opensips.org Referenced November 25th,2010

Page 10 of 10

Você também pode gostar