Opensips安装声名
luyued 发布于 2011-04-15 08:41 浏览 N 次运用de情况:
(其他版本也能够,安装时关于新手,建义软件包全数安装,制止前期有很多若干器械都没有。制止补安装时会泛起连锁的题目问题,这个很省事)
VMware虚拟情况下的Red hat enterprise linux
版本:
Opensips-1.4.3(民方网站http://www.opensips.org/)
前期预备:
LINUX基本指令的熟习
Mysql:我们选用的数据库,运用系统自带的mysql就能够,属意安装系统时选上mysql安装包。
mysql一些指令:
show databases;
show tables;
use opensips;
select * from subscribers;
drop;
create;
and so on;
Opensips的安装:
1、 民方网站http://www.opensips.org/的download中下载opensips软件包
2、 编译:
3、安装之前更改makefile:
tar zxvf opensips-1.4.3-tls_src.tar.gz
cd opensips-1.4.3-tls
4、 安装
删除Makefile中的exclude_modules 的db-mysql ,为了使opensips支持mysql。
make all
默许安装途径/usr/local下
make install
5、 建立opensips的数据库
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, or DBTEXT, by default none is loaded
vi /usr/local/opensips/etc/opensips/opensipsctlrc 把mysql的相关的注释往掉
# If you want to setup a database with opensipsdbctl, you must at least specify
DBENGINE=MYSQL
# this parameter.
## database host
## database name (for ORACLE this is TNS name)
DBHOST=localhost
DBNAME=opensips
DB_PATH="/usr/local/etc/opensips/dbtext"
# database path used by dbtext or db_berkeley
## database read/write user
DBRWUSER=opensips
## database read only user
DBROUSER=opensipsro
DBRWPW="opensipsrw"
## password for database read/write user
DBROPW=opensipsro
## password for database read only user
# user name column
USERCOL="username"
DBROOTUSER="root"
## database super user (for ORACLE this is 'scheme-creator' user)
实施opensips/sbin/下的opensipsdbctl
./opensipsdbctl create (天生opensips数据库)
5.opensips的运转
opensips/sbin/下的opensipsctl start来启动opensips
ps -efw opensips 搜检应当曾经运转了。
opensips/sbin/下的opensipsctl stop来终止opensips
到此完成了opensips的安装。
Opensips.cfg文档的配置
1、 实现注册,认证功用
debug=4
fork=yes
log_stderror=yes # (cmd line: -E)
port=5060
children=4
dns=no
rev_dns=no
# ------------------ module loading ----------------------------------
#set module path
mpath="/usr/local/lib/opensips/modules/"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "db_mysql.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "uri_db.so"
loadmodule "mi_fifo.so"
loadmodule "auth.so"
# ----------------- setting module-specific parameters ---------------
loadmodule "auth_db.so"
# -- mi_fifo params --
# -- usrloc params --
modparam("mi_fifo","fifo_name","/tmp/opensips_fifo")
# modparam("usrloc", "db_mode", 0)
# for persistent storage and comment the previous line
# Uncomment this if you want to use SQL database
modparam("usrloc", "db_mode", 2)
modparam("auth_db", "calculate_ha1", yes)
modparam("rr", "enable_full_lr", 1)
modparam("auth_db", "password_column", "password")
# ------------------------- request routing logic -------------------
# main routing logic
route{
# max_forwards==0, or excessively long requests
sl_send_reply("483","Too Many Hops");
if (!mf_process_maxfwd_header("10"))
# initial sanity checks -- messages with
{
exit;
};
if (msg:len > max_len )
{
if (method!="REGISTER")
sl_send_reply("513", "Message too big");
exit;
};
早乙女露依合集{
record_route();
}
if (loose_route())
append_hf("P-hint: rr-enforced\r\n");
# mark routing logic in request
{
route(1);
exit;
};
if (uri!=myimmolation)
{
append_hf("P-hint: outbound\r\n");
# if you have some interdomain connections via TLS
# if(uri=~"@tls_domain1.net") {
# t_relay("tls:domain1.net");
#} else if(uri=~"@tls_domain2.net") {
# exit;
# t_relay("tls:domain2.net");
# if the request is for other domain use UsrLoc
# exit;
#}
route(1);
exit;
};
# (in case, it does not work, use the following command
# with proper names and addresses in it)
if (uri==myimmolation)
# Uncomment this if you want to use digest authentication
# if (!www_authorize("","subscriber")) {
if (method=="REGISTER")
{
{
# www_challenge("", "0");
#route(2);
save("location");
# exit;
#};
exit;
};
#---------added from book
if (!proxy_authorize("","subscriber"))
consume_credentials();
proxy_challenge("","0");
{
exit;
};
#---------add end
append_hf("P-hint: outbound alias\r\n");
lookup("aliases");
if (uri!=myimmolation)
{
route(1);
exit;
};
# native SIP destinations are handled using our USRLOC DB
sl_send_reply("404", "User Not Found");
if (!lookup("location"))
{
exit;
};
append_hf("P-hint: usrloc applied\r\n");
};
route(1);
}
# send it out now; use stateful forwarding as it works
route[1] {
# reliably even for UDP2TCP
sl_reply_error();
if (!t_relay()) {
#route[2] {
};
#exit;
}
# ------------------------------------------------------------------------
#sl_reply_error();
# REGISTER Message Handler
# ------------------------------------------------------------------------
#if (!save("location")) {
#};
#}
为实现注册和认证功用,除配置好opensips.cfg,还需改动opensipsctl中的一些地方,纪录如下:
## path to FIFO file
默许文档中为:
OSIPS_FIFO="FIFO" (途径错误)
OSIPS_FIFO="/tmp/opensips_fifo"
改为:
运转:
Service mysqld start
1、运转mysql:
opensipsctl restart
2、开启opensips:
3、configure two users accounts.(花样:opensipsctl add user password)
opensipsctl add 1001 1001
opensipsctl add 1002 1002
注:opensipsctl rm -------remove users
opensipsctl passwd-----change a password
4、 用已有效户和密码注册两个sip softphone(我用的X-lite和eyebeam)
5、 搜检可否注册胜利
opensipsctl ul show
6、 搜检可否在线
opensipsctl online
注:两个sip softphone注册必需运用数据库中已有的用户名和密码,否则将不能经由历程认证。
7、make a call from one phone to the other。
Powered byZoundry Raven
小学健美操爱好小组活动计划
夫妻俩对暗号 逮住“借钱”骗子
- 07-01· 埃古RI&G:中国第三代休闲
- 07-01· 潇洒男士 Perry Ellis闲适生
- 07-01· 全明星阵容点亮CFDA颁奖红
- 07-01· 第十届中国休闲服装博览
- 07-01· tough jeans挎包 - 淘宝网商城
- 07-01· 钱包英语英文T开头的钱包
- 07-01· Toughjeans-散发着青春的活力
- 07-01· 平湖服装以“外”养“内
- 07-01· 护理液 海昌隐形眼镜护理
- 07-01· 潮流趋势 Red Carter 08春夏迈
- 07-01· 【中国服装面料行业投资
- 07-01· [转载]少年户外-2009中国户
- 07-01· 衡阳4s 衡阳nokia5320 nokia5
- 07-01· 挽春踏青 欢享夏风组图
- 07-01· Linux的硬链接(Hard Link)与
- 07-01· 共享精美边框和代码
- 07-01· Skyscraper Annual 航模比赛_
- 07-01· 小池一夫天涯孤客日文版
- 07-01· 绿竹与青萝
- 07-01· 四川水田惊现2亿年前生物