通過Ubuntu 12.04 x64 部署opensips、rtpproxy、mediaproxy,實現了sip服務、媒體轉發等服務。通過配置與測試,還支持ICE方式建立點對點的音視頻會話。花了些時間折騰,大家如有問題請留言溝通。
軟件版本:
opensips: opensips_1_10 (下載編譯再安裝)
rtpproxy: Basic version: 20040107 (直接安裝)
mediaproxy: mediaproxy-2.5.2 (下載編譯再安裝)
客戶端: Microsip 測試
安裝與配置的步驟:
一、opensips
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")