当前位置: 首页 > 工具软件 > OpenSIPS > 使用案例 >

OpenSIP3.2系列之二(用opensips-cli创建数据库)

赫连宏伯
2023-12-01
  • 创建mysql数据库


    编辑/etc/opensips/opensips-cli.cfg

    [default]
    #log_level: DEBUG
    log_level: INFO
    prompt_name: opensips-cli
    prompt_intro: Welcome to OpenSIPS Command Line Interface!
    prompt_emptyline_repeat_cmd: False
    history_file: ~/.opensips-cli.history
    history_file_size: 1000
    output_type: pretty-print
    communication_type: fifo
    fifo_file: /tmp/opensips_fifo
    
    database_schema_path: /usr/share/opensips/mysql
    database_admin_url: mysql://root@localhost
    database_url: mysql://opensips:opensipsrw@localhost
    database_name: opensips
    database_modules: ALL
    database_force_drop: true


    运行 opensips-cli -x database create

也可以手工创建:

mysql>
drop database opensips;
create database opensips;
drop user opensips;
create user 'opensips' identified by 'opensipsrw';
GRANT ALL ON opensips.* to 'opensips'@'%';
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/standard-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/acc-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/alias_db-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/auth_db-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/avpops-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/clusterer-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/dialog-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/dialplan-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/dispatcher-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/domain-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/drouting-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/group-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/load_balancer-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/msilo-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/permissions-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/rtpproxy-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/rtpengine-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/speeddial-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/tls_mgm-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/usrloc-create.sql

mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/b2b-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/b2b_sca-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/call_center-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/carrierroute-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/closeddial-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/domainpolicy-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/emergency-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/fraud_detection-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/freeswitch_scripting-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/imc-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/presence-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/registrant-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/rls-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/smpp-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/tracer-create.sql
mysql -uopensips -popensipsrw opensips < /usr/share/opensips/mysql/userblacklist-create.sql
  • 创建postgres数据库:

需要安装python3-psycopg2

/etc/opensips/opensips-cli.cfg调整为:

[default]
log_level: DEBUG
prompt_name: opensips-cli
prompt_intro: Welcome to OpenSIPS Command Line Interface!
prompt_emptyline_repeat_cmd: False
history_file: ~/.opensips-cli.history
history_file_size: 1000
output_type: pretty-print
communication_type: fifo
fifo_file: /tmp/opensips_fifo

database_schema_path: /usr/share/opensips/postgres
database_admin_url: postgres://postgres@localhost
database_url: postgres://opensips:opensipsrw@localhost
database_name: opensips
database_modules: ALL
  • 创建sqlite数据库:
rm opensips.sqlite
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/standard-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/acc-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/alias_db-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/auth_db-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/avpops-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/clusterer-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/dialog-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/dialplan-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/dispatcher-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/domain-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/drouting-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/group-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/load_balancer-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/msilo-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/permissions-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/rtpproxy-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/rtpengine-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/speeddial-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/tls_mgm-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/usrloc-create.sql

sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/b2b-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/b2b_sca-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/call_center-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/carrierroute-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/closeddial-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/domainpolicy-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/emergency-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/fraud_detection-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/freeswitch_scripting-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/imc-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/presence-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/registrant-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/rls-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/smpp-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/tracer-create.sql
sqlite3 opensips.sqlite < /usr/share/opensips/sqlite/userblacklist-create.sql

 类似资料: