ubuntu9.10 install OpenSER and use RTP Proxy to realize turn, solve the problem that symmetric NAT brings to SIP voice communication

Source: Internet
Author: User
Tags gz file syslog

ubuntu9.10 Install OpenSER and use RTP Proxy to realize turn, solve the problem that symmetric NAT brings to SIP voice communication


Reprinted from Link http://hi.baidu.com/zj8la8la/blog/item/d700d8b2c11a41abd9335af9.html


Leave a note, convenient other people, online resources are not complete, I do a complete bar, at least I test through:
My goal is very simple, just realize the SIP network MySQL database support.
Start: Set the domain name

* If your machine has a domain name, you can use it directly, if not, you can edit the/etc/hosts, add a line:
Code: 127.0.0.1 sip.org)

Need to install: Apt-get Install OpenSER Openser-mysql-module

Configuration only needs to be configured:/etc/openser/directory: openser.cfg OPENSERCTLRC two files

Install Rtpproxy First

Get rtpproxy-1.1 (official web http://www.rtpproxy.org/)
# wget http://b2bua.org/chrome/site/rtpproxy-1.1.tar.gz

Translated Rtpproxy
# CD rtpproxy-1.1
#./configure
# make; Make install


--RTP Proxy--
Set up to perform Rtpproxy
# vi/etc/rc.local (Join the following two lines)
/usr/local/bin/rtpproxy-f
/usr/local/sbin/opensipsctl start

Hand-performed Rtpproxy
#/usr/local/bin/rtpproxy-f

If you run, you can see that there are 2 files under the/var/run catalogue.
Rtpproxy.pid
rtpproxy.sock=--Opensips--
Set Nathelper for NAT traversal
Copying the original/usr/share/doc/openser/examples/nathelper.cfg to the
/etc/openser, and renamed as Openser.cfg (there are/usr/share/doc/openser/examples/nathelper.cfg.gz files in the original directory, please extract. gz file, gzid-d nathelper.cfg.gz get nathelper.cfg file, then copy the past)


Then configure the copied:openser.cfg file:

In/etc/openser/openser.cfg


#set Module Path
Mpath= "/usr/local/lib/openser/modules/" #这个修改为下面的黄字:

Mpath= "/usr/lib/openser/modules/"


Uncomment the line for MySQL DB support:
LoadModule "Mysql.so"

Uncomment the following lines for MySQL based authentication support:
LoadModule "Auth.so"
LoadModule "Auth_db.so"
Modparam ("auth", "calculate_ha1", yes)
Modparam ("auth_db", "Password_column", "password")
if (!www_authorize ("sip.org", "subscriber")) {Www_challenge ("sip.org", "0"), exit;


Uncomment the following line to enable DB persistency for location entries:
Modparam ("Usrloc", "Db_mode", 2)
and comment The following line:
Modparam ("Usrloc", "Db_mode", 0)


Find the Scarlet Letter and delete the # number in front. Sip.org to your own server's IP.

To Modify the OPENSERCTLRC file:
IN/ETC/OPENSER/OPENSERCTLRC, uncomment the following lines:
Sip_domain = sip.org
DBENGINE = MYSQL
Dbhost = localhost
(If MySQL is installed in another machine, give it host name or IP address)


Find the line where the Scarlet Letter is located, and delete the previous # number. Sip_domain = fill in your own server IP here.

OK, configure the above two files, to support the MySQL database
Then establish the OpenSER database:
Command:
#/usr/sbin/openserdbctl Create

MySQL Password for root:
Info:test Server CharSet
Info:creating Database OpenSER ...
Info:core openser tables succesfully created.
Install presence related tables? (y/n): Y
Info:creating presence tables into OpenSER ...
Info:presence tables succesfully created.
Install tables for IMC Cpl Siptrace Domainpolicy Carrierroute? (y/n): Y
Info:creating extra tables into OpenSER ...
Info:extra tables succesfully created.

After filling in two Y, the library was successfully built. Database name: OpenSER If the MySQL has a password, enter the command will prompt the password, fill in the root password.

Start OpenSER:
root@ubuntu:/usr/sbin# Openserctl Stop

Info:stopping OpenSER:
info:stopped
root@ubuntu:/usr/sbin# Openserctl Start

Info:starting OpenSER:
Info:started (pid:21415)

Note the path of the boot file, which is mostly said on the Web:/etc/init.d/openser star Startup In fact, this is useless. Please use the red Word above to start: see the above prompts, indicating success: 21415 will change does not matter, it is just PID.

To see if the SIP port is open
root@louis-laptop:/home/louis# netstat-au|grep "SIP"
UDP 0 0 Louis-laptop.local:sip *:*
UDP 0 0 Localhost:sip *:*
With this hint, the instructions are OK.

If there is a firewall, open port 5060 8000. I didn't open the firewall, so I didn't need to.

Add two users now:
#openserctl add 100@localhost (user name: 100 Password: 100)
#openserctl add 101@localhost (user or: 101 Password: 101)
(Prompts to enter the password when adding a user; OPENSERRW this is the default.)

With soft terminal login, test interoperability success.

Description: After the installation is successful, MySQL will automatically generate two users, the user name is OpenSER Openserro

About modifying the default password OPENSERRW

1. EDIT/ETC/OPENSER/OPENSERCTLRC

* Note that OpenSER has read and write only two accounts in the data library.
* DBRWPW safe to meet the request must be set, do not use default password.
As for DBROPW, because I didn't find the right position in openser.cfg,
So, according to default, Openserro. Modification:/ETC/OPENSER/OPENSERCLTRC
* Uncomment and edit following lines.

sip_domain=feena.csie.ncnu.edu.tw
Dbengine=mysql
Dbhost=localhost
Dbname=openser
Dbrwuser=openser
dbrwpw= "Foofoo" #这里修改为foofoo
Dbrouser=openserro
dbropw= "Openserro"
Dbrootuser= "Root"

3. Use the following command to create OPENSER database structures.
(You are prompted for password of MySQL "root" user)

/USR/SBIN/OPENSERDBCTL Create

4. Edit/etc/openser/openser.cfg

* Uncomment and edit 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 ("Usrloc", "Db_url", #如果按以上文档配置下来, to add the following two lines
"Mysql://openser:foofoo@localhost/openser")

Modparam ("auth", "calculate_ha1", yes)
Modparam ("auth_db", "Password_column", "password")
Modparam ("auth_db", "Db_url", #如果按以上文档配置下来, to add the following two lines
"Mysql://openser:foofoo@localhost/openser")


5./etc/init.d/openser Start

Summary: After installation to change the default password words need to change two places, one is the database openser user password Two is. openser.cfg file, you need to add the two lines, a total of two

Before the installation of the database before the creation of a password before the change, you need to modify a place, that is./OPENSERCTLRC. Look at the 1th amendment above.
Source: Http://hi.baidu.com/zj8la8la/creat/blog service: http://www.mansiyu.com Fashion wig dealer.

--------------------------------------------------------------


The following is for the latest version, OpenSER has been changed to Opensips. The above installation is openser1.3.1. The following is a new version of the content, seen elsewhere, turned around.

※ If this article is useful and feasible for you, please give it back to me after you try, so that I can know if there is any shortage.

※ The NAT penetration used in this paper is TURN, which can be applied to various NAT environments, but it is easy to produce the system bottle neck.

Keywords: IP Phone, SIP, Opensips,openser, SER, NAT traversal, RTP Proxy, TURN, traversal Using Relay NAT

[Environment]
Operating system: Linux (Trustix 3.0.5) Under VMware
Core version: 2.6.19.7-3TR
Cpu:intel (R) Pentium (r) D CPU 2.80GHz
Ram:128mb
Nic:pcnet/pci II 79c970a (pcnet32)
NET: Under the VM, to Publick IP (140.111.xxx.xxx/255.255.255.0) in bridge mode
Firewall: No settings

[Software]
Opensips (old name OpenSER), Rtpproxy, GCC, make, bison or YACC, sed, tar

[Observations] (To be compensated)

The use of RTP Proxy is TURN to solve the dilemma that symmetric NAT brings to SIP voice communication.


[Installation and setting]
Get opensips-1.4.2 (official web http://www.opensips.org/)
# wget http://opensips.org/pub/opensips/latest/src/opensips-1.x.x-notls_src.tar.gz (version change)
Get rtpproxy-1.1 (official web http://www.rtpproxy.org/)
# wget http://b2bua.org/chrome/site/rtpproxy-1.1.tar.gz

Unlock
# tar ZXVF opensips-1.5.1-tls_src.tar.gz
# tar ZXVF rtpproxy-1.1.tar.gz

Translated Opensips
# CD opensips-1.5.1-tls/
# vim Makefile (find Db_mysql, delete, so you can edit MySQL support)
# make; make modules; Make install

Translated Rtpproxy
# CD rtpproxy-1.1
#./configure
# make; Make install


--RTP Proxy--
Set up to perform Rtpproxy
# vi/etc/rc.local (Join the following two lines)
/usr/local/bin/rtpproxy-f
/usr/local/sbin/opensipsctl start

Hand-performed Rtpproxy
#/usr/local/bin/rtpproxy-f

If you run, you can see that there are 2 files under the/var/run catalogue.
Rtpproxy.pid
rtpproxy.sock=


--Opensips--
Set Nathelper for NAT traversal
Copy the nathelper.cfg from the example catalogue in the original tarball to
/usr/local/etc/opensips and renamed Opensips.cfg

Execute
# Opensipsctl Start
If it's not a problem, it's going to work. PID
Ex:--
Info:starting opensips:
Info:started (pid:9296)


[Continue to protect] (a couple of simple instructions)

View users who are already on the line
# Opensipsctl Online
Surveillance System
# Opensipsctl Moni
New user (recommended to have MySQL match to remember user information)
# opensipsctl add ' username ' password ' e-mail '

Read a piece of Taiwanese writing, and I write about, turn around;;OpenSEROpenSER is a SIP Server with open source
Provides most commonly used SIP Server features:
-SIP Proxy Server
-SIP Register Server
-SIP REDIRECT Server

System Requirements:
-GCC Compiler
-Flex
-Bison
-Libmysqlclient15-dev
-OpenSSL
-MySQL

Translated installation OpenSER
Download the latest version here
The version I use is: openser-1.3.2-tls.tar.gz

Modify Makefile to remove MySQL from exclude modules
....

exclude_modules?= ... mysql ...

....
Make all
Make install


Attached:
If you don't want to change Makefile, you can use the following instructions
Make all include_modules= "MySQL"
Make install include_modules= "MySQL"
Will install the file under/usr/local.
The file will appear under/usr/local/sbin (OpenSER openserctl openserdbctl Openserunix).
The config file will appear under/usr/local/etc/openser (Dictionary.radius openser.cfg OPENSERCTLRC)

Create OpenSER log files
Modify the/etc/syslog.cfg and add the blue part
.....

#
# don ' t log messages with log_local0 In/var/log/syslog anymore
*.*;auth,authpriv.none,local0.none-/var/log/syslog

#
# log messages with Log_local0 In/var/log/openser.log
local0.*-/var/log/openser.log

.....

will appear under the/var/log/Openser.log

If you want to modify the OpenSER log settings
To modify the Openser.cfg
Relative parameters:
-Debug:Set log level (0~9).
-Log_stderror:If set to "Yes", print debugging information to standard error output.
If set to "No", the syslog would be used.
The Default is ' no ' (printing to syslog).
-log_facility:is used to specify what type of the "is logging" message.
Valid values are "log_local0" through "log_local7".
The manual page of syslog for more information.

Reference data:
Http://www.openser.org/dokuwiki/doku.php/tutorials:debug-syslog-messages#introduction

Activating the user function (Mysql)
Modify OPENSERCTLRC
......

Sip_domain=<your Server domain>

......

Dbengine=mysql

......

Modify Openser.cfg to cancel the following annotations
......

LoadModule "Mysql.so"

LoadModule "Auth.so"
LoadModule "Auth_db.so"

.......

Modparam ("Usrloc", "Db_mode", 2)

Modparam ("auth_db", "CALCULATE_HA1", yes)
Modparam ("auth_db", "Password_column", "password")

.......

if (!www_authorize ("<your Server domain>", "subscriber")
{
Www_challenge ("<your Server domain>", "0");
Exit
}

.......

Build a openser MySQL tabel
Openserdbctl Create

Will create two MySQL users: OpenSEROpenserro
The password is divided into: OPENSERRWOpenserro

Add a new account using the OPENSERCT add command


How to use
Start Service: Openserctl start
Stop service: Openserctl stop
Find out who's online: Openserctl online
Additional account: Openserctl add <username> <password> <email>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.