Blogs on System Administration, Scripting, System Monitoring, Cloud Computing & Virtualizaton, VoIP Systems, SMS Systems and Web Applications Development.

Configuring OpenSIPS database


Introduction

This article is to provide step by step to configure OpenSIPS database after OpenSIPS Installation.

Description

In this article, we are installing OpenSIPS version 2.1.0 in Centos OS. So change your settings as per your OS.

Methodology

Following is the step by step guide for installing OpenSIPS.

Step # 1

Create User and Database for OpenSIPS:
CREATE DATABASE `opensips`;
CREATE USER 'opensips'@'%' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON `opensips`.* TO 'opensips'@'%';
FLUSH PRIVILEGES;
DROP DATABASE `opensips`;

Step # 2

Edit opensipsctlrc file for database information:
$ vi /etc/opensips/opensipsctlrc
 
Edit following parameters for connection with MySQL Database created in previous step:
DBENGINE = MYSQL
DBHOST = localhost
DBNAME = opensips
DBRWUSER = opensips
DBRWPW = ""
MYSQL_ENGINE = "MyISAM"
DBROOTUSER = "root"
USERCOL = "username"
ETCDIR = etc/

Step # 3

Create database and tables for OpenSIPS:
$ opensipsdbctl create
MySQL password for opensips2:
 
INFO: test server charset
INFO: creating database opensips ...
INFO: Using table engine MyISAM.
INFO: Core OpenSIPS tables successfully created.
Install presence related tables? (y/n): y
INFO: creating presence tables into opensips ...
INFO: Presence tables successfully created.
Install tables for imc cpl siptrace domainpolicy carrierroute userblacklist b2b cachedb_sql registrant call_center fraud_detection? (y/n): y
INFO: creating extra tables into opensips ...
INFO: Extra tables successfully created.

Step # 4

Verifying OpenSIPS database:
$ mysql -u opensips -p opensips
Enter password:
 
mysql> show tables;
+---------------------+
| Tables_in_opensips |
+---------------------+
| acc            |
| active_watchers    |
| address            |
| aliases            |
| b2b_entities       |
| b2b_logic          |
| cachedb            |
| carrierfailureroute|
| carrierroute       |
| cc_agents          |
| cc_calls           |
| cc_cdrs            |
| cc_flows           |
| cpl                |
| dbaliases          |
| dialog             |
| dialplan           |
| dispatcher         |
| domain             |
| domainpolicy       |
| dr_carriers        |
| dr_gateways        |
| dr_groups          |
| dr_partitions      |
| dr_rules           |
| fraud_detection    |
| globalblacklist    |
| grp                |
| imc_members        |
| imc_rooms          |
| load_balancer      |
| location           |
| missed_calls       |
| pdt                |
| presentity         |
| pua                |
| re_grp             |
| registrant         |
| rls_presentity     |
| rls_watchers       |
| route_tree         |
| rtpproxy_sockets   |
| silo               |
| sip_trace          |
| speed_dial         |
| subscriber         |
| uri                |
| userblacklist      |
| usr_preferences    |
| version            |
| watchers           |
| xcap               |
+---------------------+
52 rows in set (0.00 sec)

Step # 5

In order to load MySQL module in opensips.cfg file:
loadmodule "db_mysql.so"

In order to add db_url parameter for other Modules:
modparam("", "db_url", "mysql://opensips:@localhost/opensips")

0 comments:

Post a Comment

Please Enter your Comments Here.