Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1386854
  • 博文数量: 140
  • 博客积分: 8518
  • 博客等级: 中将
  • 技术积分: 1822
  • 用 户 组: 普通用户
  • 注册时间: 2005-03-01 22:23
个人简介

嘿嘿!

文章分类
文章存档

2016年(2)

2015年(5)

2014年(6)

2013年(11)

2012年(11)

2011年(3)

2010年(4)

2009年(4)

2008年(8)

2007年(23)

2006年(26)

2005年(37)

分类: 系统运维

2006-12-05 15:14:52

    要加入mysql数据库得支持,必须在启动前配置openser连接数据库的设置。配置清单如下:
1:首先要将mysql.so支持加上,如果看到openser-1.1.0/lib/openser/modules 里面没有mysql.so文件,那么说明你的openser此时没有数据库的支持。因此需要将此编译进去,方法:
   cd /home/bob/download/openser-1.1.0-tls/modules/mysql
   
  编译mysql.so需要mysql的dev包,从代码中可以看到mysql.h头文件,那么如果是redhat的话寻找该devel包并安装上,如果是ubuntu的话也是如此。
2:编译成功后将此文件copy到编译好的openser的modules文件中。并修改openser.cfg文件,将
#loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/mysql.so"的#去掉。
3:修改openser连接数据库配置。
4:这里面需要修改两个文件,我将配置清单打出来,避免有人走弯路.(红色的我修改过的)
  (1):修改etc/opeser.cfg文件
#
# $Id: openser.cfg,v 1.6 2006/02/15 18:23:46 bogdan_iancu Exp $
#
# simple quick-start config script
#
# ----------- global configuration parameters ------------------------
debug=3            # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no    # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
check_via=no    # (cmd. line: -v)
dns=yes          # (cmd. line: -r)
rev_dns=yes      # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/openser_fifo"
#
# uncomment the following lines for TLS support
#disable_tls = 0
#listen = tls:your_IP:5061
#tls_verify = 1
#tls_require_certificate = 0
#tls_method = TLSv1
#tls_certificate = "/home/bob/tools/openser-1.1.0//etc/openser/tls/user/user-cert.pem"
#tls_private_key = "/home/bob/tools/openser-1.1.0//etc/openser/tls/user/user-privkey.pem"
#tls_ca_list = "/home/bob/tools/openser-1.1.0//etc/openser/tls/user/user-calist.pem"
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/mysql.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/sl.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/tm.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/rr.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/maxfwd.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/usrloc.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/registrar.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/textops.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/auth.so"
loadmodule "/home/bob/tools/openser-1.1.0//lib/openser/modules/auth_db.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
modparam("usrloc", "db_mode",   0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
modparam("usrloc", "db_mode", 2)
# -- auth params --
# Uncomment if you are using auth module
#
modparam("auth_db", "calculate_ha1", yes)
#
# If you set "calculate_ha1" parameter to yes (which true in this config),
# uncomment also the following parameter)
#
modparam("auth_db", "password_column", "password")
# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
# -------------------------  request routing logic -------------------
# main routing logic
route{
        # initial sanity checks -- messages with
        # max_forwards==0, or excessively long requests
        if (!mf_process_maxfwd_header("10")) {
                sl_send_reply("483","Too Many Hops");
                exit;
        };
        if (msg:len >=  2048 ) {
                sl_send_reply("513", "Message too big");
                exit;
        };
        # we record-route all messages -- to make sure that
        # subsequent messages will go through our proxy; that's
        # particularly good if upstream and downstream entities
        # use different transport protocol
        if (!method=="REGISTER")
                record_route();
        # subsequent messages withing a dialog should take the
        # path determined by record-routing
        if (loose_route()) {
                # mark routing logic in request
                append_hf("P-hint: rr-enforced\r\n");
                route(1);
        };
        if (!uri==myself) {
                # mark routing logic in request
                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");
                #       exit;
                #} else if(uri=~"@tls_domain2.net") {
                #       t_relay("tls:domain2.net");
                #       exit;
                #}
                route(1);
        };
        # if the request is for other domain use UsrLoc
        # (in case, it does not work, use the following command
        # with proper names and addresses in it)
        if (uri==myself) {
                if (method=="REGISTER") {
                        # Uncomment this if you want to use digest authentication
                        if (!www_authorize("openser.org", "subscriber")) {
                                www_challenge("openser.org", "0");
                                exit;
                        };
                        save("location");
                        exit;
                };
                lookup("aliases");
                if (!uri==myself) {
                        append_hf("P-hint: outbound alias\r\n");
                        route(1);
                };
                # native SIP destinations are handled using our USRLOC DB
                if (!lookup("location")) {
                        sl_send_reply("404", "Not Found");
                        exit;
                };
                append_hf("P-hint: usrloc applied\r\n");
        };
        route(1);
}

route[1] {
        # send it out now; use stateful forwarding as it works reliably
        # even for UDP2TCP
        if (!t_relay()) {
                sl_reply_error();
        };
        exit;
}
 
(2):修改etc/openserctlrc文件,该配置是跟配置跟数据库结合的文件,清单如下
  # $Id: openserctlrc,v 1.2 2006/07/05 19:37:20 miconda Exp $
#
# openser control tool resource file
#
# here you can set variables used in the openserctl
## your SIP domain
 SIP_DOMAIN=openser.org
## database type: MYSQL or PGSQL, by defaulte none is loaded
 DBENGINE=MYSQL
## database host
 DBHOST=localhost
## database name
 DBNAME=openser
## database read/write user
 DBRWUSER=openser
 DBRWPW=openserrw                       #(该设置文件没有,需要自行添加)
## database read only user
# DBROUSER=openserro
## password for database read only user
# DBROPW=openserro
## database super user
 DBROOTUSER="root"
## type of aliases used: DB - database aliases; UL - usrloc aliases
## - default: none
#ALIASES_TYPE="DB"
## control engine: FIFO or UNIXSOCK
## - default FIFO
# CTLENGINE="FIFO"
## path to FIFO file
# OSER_FIFO="FIFO"
## check ACL names; default on (1); off (0)
# VERIFY_ACL=1
## ACL names - if VERIFY_ACL is set, only the ACL names from below list
## are accepted
# ACL_GROUPS="local ld int voicemail free-pstn"
## verbose - debug purposes - default '0'
# VERBOSE=1
阅读(5170) | 评论(4) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-02-07 16:48:28

能给一注释吗?比如说流程是怎么走.

chinaunix网友2008-01-24 10:58:16

thank you, it's helpful.