ubuntu12.04安装配置opensips,搭建voip服务器
生活随笔
收集整理的這篇文章主要介紹了
ubuntu12.04安装配置opensips,搭建voip服务器
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
ubuntu12.04安裝配置opensips,搭建voip服務器
wget?http://opensips.org/pub/opensips/1.11.2/src/opensips-1.11.2_src.tar.gz
tar?xcf opensips-1.11.2_src.tar.gz
cd?opensips-1.11.2-tls/
make?menuconfig cd?/etc/opensips
osipsconfig mv?opensips_residential_2014-7-10_16:19:22.cfg opensips.cfg
vi?opensips.cfg debug=3
log_stderror=no
log_facility=LOG_LOCAL0
fork=yes
children=4
/*?uncomment the following lines to?enable?debugging?*/
#debug=6
#fork=no
#log_stderror=yes
/*?uncomment the next line to?enable?the auto temporary blacklisting of?
? ?not available destinations?(default disabled)?*/
#disable_dns_blacklist=no
/*?uncomment the next line to?enable?IPv6 lookup after IPv4 dns?
? ?lookup failures?(default disabled)?*/
#dns_try_ipv6=yes
/*?comment the next line to?enable?the auto discovery of?local?aliases
? ?based on revers DNS on IPs?*/
auto_aliases=no
alias=xdty.org?# 增加alias,修改為你的域名
listen=udp:域名對應ip地址:6060???# CUSTOMIZE ME
disable_tcp=no
listen=tcp:域名對應ip地址:6060???# CUSTOMIZE ME?
disable_tls=yes
####### Modules Section ########
#set module path
mpath="/lib64/opensips/modules/"?# 增加一個斜杠
#### SIGNALING module
loadmodule?"signaling.so"
#### StateLess module
loadmodule?"sl.so"
#### Transaction Module
loadmodule?"tm.so"
modparam("tm",?"fr_timer",?5)
modparam("tm",?"fr_inv_timer",?30)
modparam("tm",?"restart_fr_on_each_reply",?0)
modparam("tm",?"onreply_avp_mode",?1)
#### Record Route Module
loadmodule?"rr.so"
/*?do?not append from tag to the RR?(no need?for?this script)?*/
modparam("rr",?"append_fromtag",?0)
#### MAX ForWarD module
loadmodule?"maxfwd.so"
#### SIP MSG OPerationS module
loadmodule?"sipmsgops.so"
#### FIFO Management Interface
loadmodule?"mi_fifo.so"
modparam("mi_fifo",?"fifo_name",?"/tmp/opensips_fifo")
modparam("mi_fifo",?"fifo_mode", 0666)
#### URI module
loadmodule?"uri.so"
modparam("uri",?"use_uri_table",?0)
#增加這一行,不然報錯
modparam("uri",?"db_url",?"mysql://opensips:opensipsrw@localhost/opensips")?
#### MYSQL module
loadmodule?"db_mysql.so"
#### 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
#### REGISTRAR module
loadmodule?"registrar.so"
modparam("registrar",?"tcp_persistent_flag",?"TCP_PERSISTENT")
modparam("registrar",?"received_avp",?"$avp(received_nh)")
/*?uncomment the next line not to allow?more?than?10?contacts per AOR?*/
#modparam("registrar", "max_contacts", 10)
#### 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",?"")
#### ALIAS module
loadmodule?"alias_db.so"
modparam("alias_db",?"db_url",
? ??"mysql://opensips:opensipsrw@localhost/opensips")?# CUSTOMIZE ME
? ??
#### DIALOG module
loadmodule?"dialog.so"
modparam("dialog",?"dlg_match_mode",?1)
modparam("dialog",?"default_timeout",?21600)??# 6 hours timeout
modparam("dialog",?"db_mode",?2)
modparam("dialog",?"db_url",
? ??"mysql://opensips:opensipsrw@localhost/opensips")?# CUSTOMIZE ME
#### ?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:22222")?# 修改端口
#增加下邊這一段
#### 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") vi?opensipsctlrc SIP_DOMAIN=xdty.org
DBENGINE=MYSQL
DBHOST=localhost
DBNAME=opensips
DB_PATH="/usr/local/etc/opensips/dbtext"
DBRWUSER=opensips
DBRWPW="opensipsrw"
DBROOTUSER="root"
USERCOL="username" opensipsdbctl create
opensipsctl domain add xdty.org
opensipsctl add?10000?123456
opensipsctl add?10001?123456 apt-get install?rtpproxy
vi?/etc/default/rtpproxy CONTROL_SOCK=udp:127.0.0.1:22222
# Additional options that are passed to the daemon.
EXTRA_OPTS=""
LISTEN_ADDR=你的域名對應ip地址
EXTRA_OPTS="-l?${LISTEN_ADDR}" killall?rtpproxy
/etc/init.d/rtpproxy start wget?http://download.ag-projects.com/agp-debian-gpg.key?
apt-key add?agp-debian-gpg.key
vi?/etc/apt/sources.list deb ? ?http://ag-projects.com/ubuntu precise main?
deb-src http://ag-projects.com/ubuntu precise main apt-get update
apt-get install mediaproxy-dispatcher mediaproxy-relay mediaproxy-web-sessions cd?/etc/mediaproxy/tls/
cp?/usr/share/doc/mediaproxy-common/tls/*?.
cd?..
vi?config.ini [Relay]
dispatchers = 106.186.23.149
passport = None
relay_ip = 106.186.23.149
port_range =?50000:60000
log_level = DEBUG
stream_timeout =?90
on_hold_timeout =?7200
reconnect_delay =?10
traffic_sampling_period =?15
[Dispatcher]
socket_path = dispatcher.sock
listen = 106.186.23.149
listen_management = 106.186.23.149
management_use_tls =?yes
passport = None
management_passport = None
log_level = DEBUG
relay_timeout =?5
[TLS]
certs_path = tls
verify_interval =?300
[Database]
[Radius]
[OpenSIPS]
socket_path =?/var/run/opensips/socket
max_connections =?10 media-dispatcher restart
media-relay restart touch?/var/log/opensips.log
chmod?777?/var/log/opensips.log
vi?/etc/rsyslog.d/opensips.conf local0.*?? ? ? ? ? ??/var/log/opensips.log vi?~/.vim/filetype.vim au BufNewfile,BufRead?/var/log/*?set?filetype=messages service rsyslog restart
opensipsctl start iptables?-I?INPUT?-p?tcp?--dport?6060?-j?ACCEPT
iptables?-I?INPUT?-p?udp?--dport?6060?-j?ACCEPT
iptables-save pear?install?MDB2#mysql
pear?install?log chown?www-data:www-data web?-R mysql?-Dopensips?-p<ocp_admin_privileges.mysql
mysql?-uroot?opensips
INSERT INTO ocp_admin_privileges?(username,password,ha1,available_tools,permissions)?values?('admin','admin',md5('admin:admin'),'all','all'); mysql?-Dopensips?-p?<?cdrs.mysql
mysql?-Dopensips?-p<opensips_cdrs.mysql vi?generate-cdrs_mysql.sh mysql?-Dopensips?-p?<?tables.mysql
vi?/etc/crontab
*/3?*?*?*?*?root?/var/www/opensips/cron_job/generate-cdrs_mysql.sh
*?*?*?*?*?root php?/var/www/opensips-cp/cron_job/get_opensips_stats.php?>?/dev/null
tar?xcf opensips-1.11.2_src.tar.gz
cd?opensips-1.11.2-tls/
make?menuconfig cd?/etc/opensips
osipsconfig mv?opensips_residential_2014-7-10_16:19:22.cfg opensips.cfg
vi?opensips.cfg debug=3
log_stderror=no
log_facility=LOG_LOCAL0
fork=yes
children=4
/*?uncomment the following lines to?enable?debugging?*/
#debug=6
#fork=no
#log_stderror=yes
/*?uncomment the next line to?enable?the auto temporary blacklisting of?
? ?not available destinations?(default disabled)?*/
#disable_dns_blacklist=no
/*?uncomment the next line to?enable?IPv6 lookup after IPv4 dns?
? ?lookup failures?(default disabled)?*/
#dns_try_ipv6=yes
/*?comment the next line to?enable?the auto discovery of?local?aliases
? ?based on revers DNS on IPs?*/
auto_aliases=no
alias=xdty.org?# 增加alias,修改為你的域名
listen=udp:域名對應ip地址:6060???# CUSTOMIZE ME
disable_tcp=no
listen=tcp:域名對應ip地址:6060???# CUSTOMIZE ME?
disable_tls=yes
####### Modules Section ########
#set module path
mpath="/lib64/opensips/modules/"?# 增加一個斜杠
#### SIGNALING module
loadmodule?"signaling.so"
#### StateLess module
loadmodule?"sl.so"
#### Transaction Module
loadmodule?"tm.so"
modparam("tm",?"fr_timer",?5)
modparam("tm",?"fr_inv_timer",?30)
modparam("tm",?"restart_fr_on_each_reply",?0)
modparam("tm",?"onreply_avp_mode",?1)
#### Record Route Module
loadmodule?"rr.so"
/*?do?not append from tag to the RR?(no need?for?this script)?*/
modparam("rr",?"append_fromtag",?0)
#### MAX ForWarD module
loadmodule?"maxfwd.so"
#### SIP MSG OPerationS module
loadmodule?"sipmsgops.so"
#### FIFO Management Interface
loadmodule?"mi_fifo.so"
modparam("mi_fifo",?"fifo_name",?"/tmp/opensips_fifo")
modparam("mi_fifo",?"fifo_mode", 0666)
#### URI module
loadmodule?"uri.so"
modparam("uri",?"use_uri_table",?0)
#增加這一行,不然報錯
modparam("uri",?"db_url",?"mysql://opensips:opensipsrw@localhost/opensips")?
#### MYSQL module
loadmodule?"db_mysql.so"
#### 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
#### REGISTRAR module
loadmodule?"registrar.so"
modparam("registrar",?"tcp_persistent_flag",?"TCP_PERSISTENT")
modparam("registrar",?"received_avp",?"$avp(received_nh)")
/*?uncomment the next line not to allow?more?than?10?contacts per AOR?*/
#modparam("registrar", "max_contacts", 10)
#### 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",?"")
#### ALIAS module
loadmodule?"alias_db.so"
modparam("alias_db",?"db_url",
? ??"mysql://opensips:opensipsrw@localhost/opensips")?# CUSTOMIZE ME
? ??
#### DIALOG module
loadmodule?"dialog.so"
modparam("dialog",?"dlg_match_mode",?1)
modparam("dialog",?"default_timeout",?21600)??# 6 hours timeout
modparam("dialog",?"db_mode",?2)
modparam("dialog",?"db_url",
? ??"mysql://opensips:opensipsrw@localhost/opensips")?# CUSTOMIZE ME
#### ?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:22222")?# 修改端口
#增加下邊這一段
#### 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") vi?opensipsctlrc SIP_DOMAIN=xdty.org
DBENGINE=MYSQL
DBHOST=localhost
DBNAME=opensips
DB_PATH="/usr/local/etc/opensips/dbtext"
DBRWUSER=opensips
DBRWPW="opensipsrw"
DBROOTUSER="root"
USERCOL="username" opensipsdbctl create
opensipsctl domain add xdty.org
opensipsctl add?10000?123456
opensipsctl add?10001?123456 apt-get install?rtpproxy
vi?/etc/default/rtpproxy CONTROL_SOCK=udp:127.0.0.1:22222
# Additional options that are passed to the daemon.
EXTRA_OPTS=""
LISTEN_ADDR=你的域名對應ip地址
EXTRA_OPTS="-l?${LISTEN_ADDR}" killall?rtpproxy
/etc/init.d/rtpproxy start wget?http://download.ag-projects.com/agp-debian-gpg.key?
apt-key add?agp-debian-gpg.key
vi?/etc/apt/sources.list deb ? ?http://ag-projects.com/ubuntu precise main?
deb-src http://ag-projects.com/ubuntu precise main apt-get update
apt-get install mediaproxy-dispatcher mediaproxy-relay mediaproxy-web-sessions cd?/etc/mediaproxy/tls/
cp?/usr/share/doc/mediaproxy-common/tls/*?.
cd?..
vi?config.ini [Relay]
dispatchers = 106.186.23.149
passport = None
relay_ip = 106.186.23.149
port_range =?50000:60000
log_level = DEBUG
stream_timeout =?90
on_hold_timeout =?7200
reconnect_delay =?10
traffic_sampling_period =?15
[Dispatcher]
socket_path = dispatcher.sock
listen = 106.186.23.149
listen_management = 106.186.23.149
management_use_tls =?yes
passport = None
management_passport = None
log_level = DEBUG
relay_timeout =?5
[TLS]
certs_path = tls
verify_interval =?300
[Database]
[Radius]
[OpenSIPS]
socket_path =?/var/run/opensips/socket
max_connections =?10 media-dispatcher restart
media-relay restart touch?/var/log/opensips.log
chmod?777?/var/log/opensips.log
vi?/etc/rsyslog.d/opensips.conf local0.*?? ? ? ? ? ??/var/log/opensips.log vi?~/.vim/filetype.vim au BufNewfile,BufRead?/var/log/*?set?filetype=messages service rsyslog restart
opensipsctl start iptables?-I?INPUT?-p?tcp?--dport?6060?-j?ACCEPT
iptables?-I?INPUT?-p?udp?--dport?6060?-j?ACCEPT
iptables-save pear?install?MDB2#mysql
pear?install?log chown?www-data:www-data web?-R mysql?-Dopensips?-p<ocp_admin_privileges.mysql
mysql?-uroot?opensips
INSERT INTO ocp_admin_privileges?(username,password,ha1,available_tools,permissions)?values?('admin','admin',md5('admin:admin'),'all','all'); mysql?-Dopensips?-p?<?cdrs.mysql
mysql?-Dopensips?-p<opensips_cdrs.mysql vi?generate-cdrs_mysql.sh mysql?-Dopensips?-p?<?tables.mysql
vi?/etc/crontab
*/3?*?*?*?*?root?/var/www/opensips/cron_job/generate-cdrs_mysql.sh
*?*?*?*?*?root php?/var/www/opensips-cp/cron_job/get_opensips_stats.php?>?/dev/null
Tags: mediaproxy opensips opensips web opensips-cp rtpproxy voip
@import url(http://www.cppblog.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css); posted on 2016-11-08 10:42?聶文龍?閱讀(6)?評論(0)??編輯?收藏?引用總結
以上是生活随笔為你收集整理的ubuntu12.04安装配置opensips,搭建voip服务器的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【前端面试题】02—59道CSS面试题(
- 下一篇: 硬件基础 —— 光耦