SER (Sip Express Router) Introduction

 

Copy from  http://www.voipforo.com/en/ser/ser_intro.php

SER (Sip Express Router) Introduction

SER is the acronym of SIP express Router. It can act as SIP registrar, proxy or redirect server. The official website with information and sources for download is http://www.iptel.org/

It has high-performance, and can be configured and modified because is open source. SER features an application-server interface, presence support, SMS gateway, SIMPLE2Jabber gateway, RADIUS/syslog accounting and authorization, server status monitoring. And can be configured by web using databases.

Its performance let it deal with operational burdens, such as broken network components, attacks, power-up reboots and rapidly growing user population.

It can work simultaneously with IPv4 e IPv6 in a transparent way given connectivity for both protocols. Its functionality and management is easier using MySQL modules.

SER's configuration ability meets needs of a whole range of scenarios including small-office use, enterprise PBX replacements and carrier services.

SER (SIP express router) can be a perfect complement for Asterisk due to it gives Asterisk new functionalities. More info in SER vs Asterisk Comparative

 

SER (Sip Express Router) basic installation

Now we are going to install SER (SIP express Router) under linux Operating system. This is the basic installation. In the following chapters there are more complex installations with databases like MySQL and different configurations. If an error appears you can visit the last chapter about errors and solutions and maybe you can solve it.

Installation:

1 ) Download and extract the package

It can be downloaded at http://ftp.iptel.org/pub/ser/latest/

My advise is download the last version of the /src/ folder. In our example is "ser-0.9.6_src.tar.gz" and save it to our computer for example at /usr/src/

* Binary versions can be downloaded of the /bin folder of the FTP or specific versions for a distribution, for example for Debian at /packages folder but I prefer the source packages (besides I use SuSE linux).

# cd /usr/src/
# tar -zxvf ser-0.9.6_src.tar.gz
# rm -f ser-0.9.6_src.tar.gz
# cd ser-0.9.6_src

2) Make and install

Make the program and the modules and then we install the program in the folder we want, for example /usr/local. (from this point we suppose that the program is installed in /usr/local folder)

# make && make modules
# make prefix=/usr/local install

3) Asign a domain to the machine

# export SIP_DOMAIN = "localhost"

This must be done every time the machine starts (a new line in the log script of the shell can be added in order to do it automatically when the machine starts)

We have chosen localhost because our machine is in the local area network and does not have a specific domain name. If the machine has a domain name we can write something like "myserver.domain.com"

4) Start and stop the server

The server start with the following command

# /usr/local/sbin/serctl start

When the server has started it can be monitored with

# /usr/local/sbin/serctl moni

And to stop the server

# /usr/local/sbin/serctl stop

5) Configure a softphone to verify

You can configure a softphone to verify the sip server (for example sjphone configuration):

Proxy Domain: localhost or the IP of your server
Puerto: 5060 (default port)
User Domain: localhost or the IP of your server

Any user and password is possible at this step.

* The SER (SIP Express Router) is installed and working. It is an easy installation. You can read also the install file that comes with the package you have downloaded. If you can problems you can read SER errors + solutions. Now we are going to configure SER (SIP express router) with MySQL support.

 

SER (Sip Express Router) installation with MYSQL

Now we are going to install SER (SIP express Router) using MYSQL. It is supposed that MySQL is correctly installed in the machine. In addition we have followed the steps of the basic installation of the previous chapters and we have SER installed with the basic configuration.

Installation:

1) Execute ser_mysql.sh script

VERY IMPORTANT: we must be root to execute the script. A simple sudo is not valid. we must be log as root. In other way an error like "/usr/local/sbin/ser_mysql.sh : line 160: gen_ha1 command not found HA1 calculation failed." will be displayed.

# /usr/local/sbin/ser_mysql.sh create

Next fill the following gaps:

MySQL Password for root:
root password of MySQL
Domain for the default user 'admin' : localhost (or the one we have chosen)
Enter password: blank and Enter. It will take the default password.

2 ) Configure ser.cfg file

ser.cfg is the configuration file of SER server. We are going to speak about it in the following chapters.

this file is placed in /usr/local/etc/ser/

In order to use MySQl we have to modify the ser.cfg file in the following way. We must uncomment some lines. Pay attention at the lines in bold.

#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# simple quick-start config script
#

# ----------- global configuration parameters ------------------------

#debug=3 # debug level (cmd line: -dddddddddd)
#fork=yes
#log_stderror=no # (cmd line: -E)

/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/

check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
#port=5060
#children=4
fifo="/tmp/ser_fifo"

# ------------------ module loading ----------------------------------

# Uncomment this if you want to use SQL database
loadmodule "/usr/local/lib/ser/modules/mysql.so"

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"

# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"

# ----------------- setting module-specific parameters ---------------

# -- usrloc params --

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

# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)

# -- auth params --
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# SQL settings

#the deafult database name is "ser" . dbhost can be "localhost"
modparam("usrloc", "db_url","mysql://mysqluser:mysqlpassword@dbhost/dbname")
modparam("auth_db", "db_url","mysql://mysqluser:mysqlpassword@dbhost/dbname")



 route{
 
         # initial sanity checks  messages with
         # max_forwards==0, or excessively long requests
         if (!mf_process_maxfwd_header("10")) {
                 sl_send_reply("483","Too Many Hops");
                 break;
         };
         if ( msg:len > max_len ) {
                 sl_send_reply("513", "Message too big");
                 break;
         };
 
         # we record-route all messages — to make sure that
         # subsequent messages will go through our proxy; that's
         # particularly good if upstream and downstream entities
         # use different transport protocol
         record_route();
         # loose-route processing
         if (loose_route()) {
                 t_relay();
                 break;
         };
 
         # if the request is for other domain use UsrLoc
         # (in case, it does not work, use the following command
         # with proper names and addresses in it)
         if (uri==myself) {
 
                 if (method=="REGISTER") {
 
 # Uncomment this if you want to use digest authentication
                         if (!www_authorize("localhost", "subscriber")) {
                                 www_challenge("localhost", "0");
                                 break;
                         };
 
                         save("location");
                         break;
                 };
 
                 lookup("aliases");
 
                 # native SIP destinations are handled using our USRLOC DB
                 if (!lookup("location")) {
                         sl_send_reply("404", "Not Found");
                         break;
                 };
         };
         # forward to current uri now; use stateful forwarding; that
         # works reliably even if we forward from TCP to UDP
         if (!t_relay()) {
                 sl_reply_error();
         };
 
 }

3) Some comments of the lines added

- The default port of SER server is 5060 (same as Asterisk). We can modify it at

#port=5061

- these lines added

modparam("usrloc", "db_url","mysql://user:password@localhost/ser")
modparam("auth_db", "db_url","mysql://user:password@localhost/ser")

are for versions up to 0.9.3. For lower versions:

modparam("usrloc", "db_url","sql://user:password@localhost/ser")
modparam("auth_db", "db_url","sql://user:password@localhost/ser")

4) Restart SER server

# /usr/local/sbin/serctl restart

Remember to export the SIP_DOMAIN variable if you have restarted the machine

# export SIP_DOMAIN="localhost"

5) Configure a softphone to verify

In this case it is neccessary the user and password

The default name is "admin" and the password "heslo"

6) Add a new user

# /usr/local/sbin/serctl add <name> <password> <email>

If a password is asked it must be "heslo" and if an error like "/usr/local/sbin/ser_mysql.sh : line 160: gen_ha1 command not found HA1 calculation failed." appears remember that it is necessary to log as root (not sudo)

You can verify that the new user can register in your ser server with your softphone.

7) Add a line to the startup file of mysql

This is advisory in order the SER server can manage multiple connections to the database. You have to add the following line to the file my.cnf of MySQL in the [mysqld] part

max_connections = 500

* The SER (SIP Express Router) is just working with MySQL. This is a bit difficult part. If you have had problems you can try to solve them in the chapter about error + solutions of the SER server.

SER (Sip Express Router) - Errors + solutions

SER (SIP Express Router) is sometimes a bit problematic. There are some methods to detect the problems.

1. If the SER server does not start correctly we can look at the following file to look for errors

/var/log/messages

In this file appears information about errors and warning when the SER server starts or tries to start

Another way is to start the SER server with "#/usr/local/sbin/ser -c" instead of "# /usr/local/serctl start" . This way we could see the messages at the screen or command line.


2. If the SER server starts but we want to monitor it we can execute the command

/usr/local/sbin/serctl moni

3. If the ser_mysql.sh script does not work verify that the mysql client is installed in a proper way.

Some common errors and the possible solution:

Problem

Solution

Starting SER : PID file /var/run/ser.pid does not exist -- SER start failed

When starting the server with /usr/local/sbin/serctl start

Look at /var/log/messages because is a common failed error

ser: ERROR: load_module: could not open module </usr/local/lib/ser/modules/mysql.so>: libmysqlclient.so.15: cannot open shared object file: No such file or directory

At the file /var/log/messages

It is a bit strange but it can be solve. I solve it this way (perhaps is not the better one). A library is missing but perhaps we have a superior or inferior one: Find it at /usr/lib and then we can do for example

# ln -s libmysqlclient.so.14 libmysqlclient.so.15

new connection(): Can´t connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

At the file /var/log/messages

Happens when mysql.sock is not at that folder It can be at /tmp/ You can solve it doing a virtual link

# ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock

submit_query(): Unknown column 'table version' in field list'

At the file /var/log/messages

Incompatibiitly between 0.8.X and 0.9.x. A table field has been changed We are executing 0.9.x version with 0.8.x database version

Solution: re-execute ser_mysql.sh script of 0.9.x version

ALERT: Backup the database previously.

/usr/local/sbin/ser_mysql.sh: line 160: gen_ha1: command not found HA1 calculation failed

When executing /usr/local/sbin/ser_mysql.sh create

Appear when we are not root. Sudo is not enough. We must be logged as root. If we do that the problem disappears.

* Warning: no fifo_db_url given - fifo DB commands disabled

At the file /var/log/messages

It is just a warning. We can do nothing. Or doing the following:

Add the following line to ser.cfg

fifo_db_url="mysql://mysqluser:mysqlpassword@dbhost/dbname"

If you have had a different problem you can send me an email and I will add it here for everybody. Or perhaps I can help you if I have time enough.

 

 

转载于:https://www.cnblogs.com/lqx/archive/2009/07/22/1528539.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值