ubuntu 9.10 openser sip server

1,  安装 apt-get install openser

    root@louis-laptop:/home/louis# /etc/init.d/openser restart
Restarting openser: openserListening on
             udp: 127.0.0.1 [127.0.0.1]:5060
             udp: 172.27.1.18 [172.27.1.18]:5060
             tcp: 127.0.0.1 [127.0.0.1]:5060
             tcp: 172.27.1.18 [172.27.1.18]:5060
Aliases:
             tcp: louis-laptop.local:5060
             tcp: localhost:5060
             udp: louis-laptop.local:5060
             udp: localhost:5060

2,创建 openser数据库结构
root @louis-laptop:/home/louis# openserdbctl create
ERROR: could not load the script in /usr/lib/ openser/openserctl/openserdbctl.mysql for database engine MYSQL
ERROR: database engine not loaded - tried 'MYSQL'
默认是MYSQL
接下来排错,发现这个文件夹下面是脚本用的是openserdbctl.dbtext
root @louis-laptop:/usr/lib/ openser/openserctl# ls
openserctl.base     openserctl.dbtext  openserctl.sqlbase   openserdbctl.base
openserctl.ctlbase  openserctl.fifo    openserctl.unixsock  openserdbctl.dbtext
gedit /etc/ openser/openserctlrc
改成DBENGINE=DBTEXT

重新创建 openser数据库结构
root @louis-laptop:/usr/lib/ openser/openserctl# openserdbctl create
INFO: creating DBTEXT tables at: /usr/local/etc/ openser/dbtext ...
Install presence related tables? (y/n): y
INFO: creating DBTEXT presence tables at: /usr/local/etc/ openser/dbtext ...
Install tables for imc cpl siptrace domainpolicy carrierroute? (y/n): y
INFO: creating DBTEXT extra tables at: /usr/local/etc/ openser/dbtext ...

后来发现enigne还是要用MYSQL,cat -n /etc/ openser/ openser.cfg排错,最终发现竟是没有安装 openser-mysql-module,我倒...

再次重新创建 openser数据库结构,这里你要输入MYSQL的root的密码,之前你安装SQL的时候要设置的。
root @louis-laptop:/usr/local/etc/ openser/dbtext# openserdbctl create
MySQL password for root:
INFO: test server charset
INFO: creating database openser ...
INFO: Core OpenSER tables succesfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into openser ...
INFO: Presence tables succesfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute? (y/n): y
INFO: creating extra tables into openser ...
INFO: Extra tables succesfully created.

3,修改 openser.cfg支持mysql  
gedit /etc/ openser/ openser.cfg
     Uncomment the line for MySQL DB support:
     loadmodule “mysql.so”
     Uncomment the following lines for MySQL based authentication support:
     loadmodule “auth.so”
     loadmodule “auth_db.so”
     modparam("auth", "calculate_ha1", yes)
     modparam("auth_db", "password_column", "password")
     if (!www_authorize("sip.org", "subscriber")) {
          www_challenge("sip.org", "0");
          break;
     };
     Change the two sip.org instances in the above config, to your domain, or
     realm. In our case, the server’s IP address. (172.27.1.18)
     Uncomment the following line to enable DB persistency for location entries:
     modparam("usrloc", "db_mode", 2)
     And comment the following line:
     modparam("usrloc", "db_mode", 0)
gedit /etc/ openser/openserctlrc, uncomment the following lines:
     SIP_DOMAIN = SERVER_IP_ADDRESS (ip here,172.27.1.18)
     DBENGINE = MYSQL
     DBHOST = localhost

启动 openser /etc/init.d/ openser restart
用eyebeam发现注册不上,抓包发现ICMP port unreachable,发现sip server 端口5060竟然没有开启。

打开log排错 log_stderror=yes
root @louis-laptop:/home/louis#Feb  8 22:23:12 [11278] ERROR:mysql:db_mysql_new_connection: drivererror: Access denied for user ' openser' @' localhost' (using password:YES)
修改 openser.cfg,
modparam("usrloc", "db_url", "mysql://username:password @localhost/ openser")
username和password在mysql中创建
mysql -u root -p 登录mysql
mysql>insert into mysql. user (host, user,password)
->values ('%','username',password('password')); 用password()函数加密密码
mysql>flush privileges; 重载MySQL授权表
测试刚建立的username,password是否可以使用
mysql -u username -p

4,重新启动 openser /etc/init.d/ openser restart
发现sip端口已经打开
root @louis-laptop:/home/louis# netstat -au|grep "sip"
udp        0      0 louis-laptop.local:sip  *:*                               
udp        0      0 localhost:sip           *:*   

5,Add users to database
There are several methods to do this:
Method1: use openserctl on the command line:
#openserctl add username password Authorization_ user_name(email) @sipdomain
Following are some examples:
     #openserctl add 100 100 100 @localhost
     #openserctl add 101 101 101 @localhost

 Method2: add users directly into the MySql DB into the table subscriber.
  For example:
进入mysql
insert into subscriber (username, domain, password, email_address)
values ("username"," localhost","topsecret","username @localhost");

用刚创建的username,password在eyebeam上注册...OK...打电话...OK







http://cache.baidu.com/c?m=9d78d513d99010fe0facd5690d678131450fd7352bd7a14122948448e2231a160771e3ca7a60475892923c7001de5e5ae8e73603695e71e4c592d50b9bafd56871877d72365e914061ce04f196017e807cc71cacf259beadf045c3f08f86c854248b0e5f3d97f0fc0b5d4bd76cf61232e0a0984f144810cdb7763aa1&p=882a9245899c5dee0caec7710a51&user=baidu&fm=sc&query=Access+denied+for+user+%27openser%27%40%27localhost%27&qid=dd73a9080d620dca&p1=2


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值