在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")

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/18699.html