感谢支持
我们一直在努力

在Ubuntu 12.04 x64 搭建VOIP Server

通过Ubuntu 12.04 x64 部署opensips、rtpproxy、mediaproxy,实现了sip服务、媒体转发等服务。通过配置与测试,还支持ICE方式建立点对点的音视频会话。花了些时间折腾,大家如有问题请留言沟通。

软件版本:

opensips: opensips_1_10 (下载编译再安装)
rtpproxy: Basic version: 20040107 (直接安装)

mediaproxy: mediaproxy-2.5.2 (下载编译再安装)

客户端: Microsip 测试

 

安装与配置的步骤:

 

一、opensips

  • 编译opensips 1.10

make menuconfig

如下配置参数:

1 Configure Compile Options -> Configure Excluded Modules :

[*] db_mysql

[*] dialplan

2 Configure Compile Options -> Configure Install Prefix :/usr/local/sbin/

3 Compile And Install OpenSIPS,直此安装完成。(如果少了些什么库,请apt-get install xxx)

 

  • 生成脚本

安装位置在/usr/local/sbin。其中,sbin为程序目录,etc为配置参数所在目录,还有lib64和share两个目录。

利用 /usr/local/sbin/sbin/osipsconfig 生成配置文件,具体操作

1 Generate OpenSIPS Script ->Residential Script -> Configure Residential Script :

[*] ENABLE_TCP

[*] USE_AUTH

[*] USE_DBACC

[*] USE_DBUSRLOC

[*] USE_NAT

 

2 Save Residential Script

3 Generate Residential Script:生成配置文件位于/usr/local/sbin//etc/opensips/opensips_residential_xxx.cfg

 

  • 编辑参数

进入/usr/local/sbin/etc/opensips,覆盖旧的配置文件: cp opensips_residential_xxx.cfg opensips.cfg

编辑opensips.cf文件,修改如下(注意红色部分):

####### Global Parameters #########

#debug=3
#log_stderror=no
log_facility=LOG_LOCAL1

fork=yes
children=4

/* uncomment the following lines to enable debugging */
debug=6
#fork=no
log_stderror=yes

listen=udp:x.x.x.x:5060 # CUSTOMIZE ME

disable_tcp=yes
disable_tls=yes

 

#### URI module

loadmodule “uri.so”
modparam(“uri”, “db_url”, “mysql://opensips:opensipsrw@localhost/opensips”)
modparam(“uri”, “use_uri_table”, 0)

#### USeR LOCation module
loadmodule “usrloc.so”
modparam(“usrloc”, “nat_bflag”, “NAT”)
modparam(“usrloc”, “db_mode”, 2)
modparam(“usrloc”, “db_url”, “mysql://opensips:opensipsrw@localhost/opensips”) # CUSTOMIZE ME

#### ACCounting module
loadmodule “acc.so”
/* what special events should be accounted ? */
modparam(“acc”, “early_media”, 0)
modparam(“acc”, “report_cancels”, 0)
/* by default we do not adjust the direct of the sequential requests.
if you enable this parameter, be sure the enable “append_fromtag”
in “rr” module */
modparam(“acc”, “detect_direction”, 0)
modparam(“acc”, “failed_transaction_flag”, “ACC_FAILED”)
/* account triggers (flags) */
modparam(“acc”, “db_flag”, “ACC_DO”)
modparam(“acc”, “db_missed_flag”, “ACC_MISSED”)
modparam(“acc”, “db_url”,
“mysql://opensips:opensipsrw@localhost/opensips”) # CUSTOMIZE ME

#### AUTHentication modules
loadmodule “auth.so”
loadmodule “auth_db.so”
modparam(“auth_db”, “calculate_ha1”, yes)
modparam(“auth_db”, “password_column”, “password”)
modparam(“auth_db”, “db_url”,
“mysql://opensips:opensipsrw@localhost/opensips”) # CUSTOMIZE ME

modparam(“auth_db”, “load_credentials”, “”)

#### NAT modules
loadmodule “nathelper.so”
modparam(“nathelper”, “natping_interval”, 10)
modparam(“nathelper”, “ping_nated_only”, 1)
modparam(“nathelper”, “received_avp”, “$avp(received_nh)”)

loadmodule “rtpproxy.so”
modparam(“rtpproxy”, “rtpproxy_sock”, “udp:localhost:7722”) # CUSTOMIZE ME

#### MediaProxy module
loadmodule “mediaproxy.so”
modparam(“mediaproxy”, “disable”, 0)
modparam(“mediaproxy”, “mediaproxy_socket”, “/var/run/mediaproxy/dispatcher.sock”)
modparam(“mediaproxy”, “mediaproxy_timeout”, 1000)
modparam(“mediaproxy”, “signaling_ip_avp”, “$avp(nat_ip)”)
modparam(“mediaproxy”, “media_relay_avp”, “$avp(media_relay)”)
modparam(“mediaproxy”, “ice_candidate”, “low-priority”)

配置opensipsctlrc,修改内容如下(注意红色部分):

## your SIP domain
SIP_DOMAIN=x.x.x.x

## chrooted directory
# $CHROOT_DIR=”/path/to/chrooted/directory”

## database type: MYSQL, PGSQL, Oracle, DB_BERKELEY, or DBTEXT,
## by default none is loaded
# If you want to setup a database with opensipsdbctl, you must at least specify
# this parameter.
DBENGINE=MYSQL

## database host
DBHOST=localhost

## database name (for ORACLE this is TNS name)
DBNAME=opensips

# database path used by dbtext or db_berkeley
# DB_PATH=”/usr/local/etc/opensips/dbtext”

## database read/write user
DBRWUSER=opensips

## password for database read/write user
DBRWPW=”opensipsrw”

## database super user (for ORACLE this is ‘scheme-creator’ user)
DBROOTUSER=”root”

# user name column
USERCOL=”username”

 

  • 建立数据库

进入/usr/local/sbin/sbin ,

./opensipsdbctl create

  • 建立sip帐户

./opensipsctl add test test

  • 开启sip服务(注:一般在开启rtpproxy, mediaproxy服务后,最后再开启sip服务)

./opensipsctl start

 

二、安装并配置rtpproxy

参考 http://www.linuxidc.com/Linux/2014-01/95845.htm

 

三、编译并安装mediaproxy: (注:需要安装Python库)

./setup.py build
./setup.py setup

我遇到的问题: 运行media-relay –no-fork, 出现media-relay Segmentation fault, 导致程序崩溃。

需要下载一个libgcrypt11_1.5.0-3Ubuntu0.1+agp_amd64.deb 安装一下,问题解决。

 

开启服务:

service mediaproxy-relay start

service mediaproxy-dispatcher start

更多Ubuntu相关信息见Ubuntu 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=2

赞(0) 打赏
转载请注明出处:服务器评测 » 在Ubuntu 12.04 x64 搭建VOIP Server
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏