基于opensips mysql数据库用户管理

来源:互联网 发布:惩罚男朋友的招数知乎 编辑:程序博客网 时间:2024/05/17 07:15
aliyun配置 :https://yq.aliyun.com/articles/44437

OpenSIPS VOIP 服务器

1.源码安装,见上一篇。修改配置选项后重新编译

   make all include_modules="db_mysql"

   sudo make install include_modules="db_mysql"

2.修改配置:

    vi /usr/local/etc/opensips/opensipsctlrc

    解除DBENGIN=MySQL这句话的注释。

3.安装mysql

sudo apt-get install mysql-server mysql-client libmysqlclient-dev

     安装过程中会提示输入密码,输入并记住。安装完成后,

     mysql -u root -p

     Enter password:

4. 创建opensips数据库

  cd /usr/local/sbin

  ./opensipsdbctl create

  MySQL password for root:
  INFO: test server charset
  INFO: creating database opensips ...
  INFO: Core OpenSIPS tables succesfully created.

  Install presence related tables? (y/n): y
  INFO: creating presence tables./opensipsctl stop into opensips ...
  INFO: Presence tables succesfully created.

  Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist? (y/n): y
  INFO: creating extra tables into opensips ...
  INFO: Extra tables succesfully created.

  ./opensipsctl stop

  ./opensipsctl start

  INFO: Starting OpenSIPS :


/usr/local/lib/opensips/opensipsctl/opensipsdbctl.mysql

 /usr/local/share/opensips/dbtext/opensips/

6.添加用户

创建测试用户:

opensipsctl add 101 101

如果创建用户时提示“ERROR: domain unknown: use usernames with domain or set default domain in SIP_DOMAIN”,可修改opensipsctlrc文件将SIP_DOMAIN设为本机域名或IP地址。

7.   查看在线用户:
  /usr/local/opensips/sbin/opensipsctl online
  删除或修改用户
  /usr/local/opensips/sbin/opensipsctl rm
  /usr/local/opensips/sbin/opensipsctl passwd


ppeix@rd:~/opensips-1.8.2-tls$ sudo opensipsdbctl -h
MySQL password for root:
/usr/local/sbin/opensipsdbctl $Revision: 3997 $

usage: opensipsdbctl create <db name or db_path, optional> .....(creates a new database)
       opensipsdbctl drop <db name or db_path, optional> .......(!entirely deletes tables!)
       opensipsdbctl reinit <db name or db_path, optional> .....(!entirely deletes and than re-creates tables!)
       opensipsdbctl backup <file> .................................(dumps current database to file)
       opensipsdbctl restore <file> ................................(restores tables from a file)
       opensipsdbctl copy <new_db> .................................(creates a new db from an existing one)
       opensipsdbctl migrate <old_db> <new_db> .....................(migrates DB from 1.6.4 to 1.7)
       opensipsdbctl presence ......................................(adds the presence related tables)
       opensipsdbctl extra .........................................(adds the extra tables)

       if you want to manipulate database as other database user than
       root, want to change database name from default value "opensips",
       or want to use other values for users and password, edit the
       "config vars" section of the command opensipsdbctl.



0 0
原创粉丝点击