1 MySQL Support
1.1 MySQL Module support
When installed by default, the MySQL module is not included.
The OPENSIPSCTLRC file contains information about the configuration of the database, and to allow Opensips to support the MySQL database, when compiling the installation
Must support the MySQL module. The method is as follows:
(1) Modify the makefile.conf in the Opensips, remove the db_mysql in the Exclude_modules, and in the Include_modules
Add Db_mysql, and then recompile the installation. You can do this by adding supported modules.
(2) The compile-time designation, make include_modules= "Db_mysql" modules prefix=/.
Before compiling the installation, you need to install the MySQL development package, or compile it. The method is as follows:
$sudo apt-get Install Libmysqlclient-dev.
2.2 Installing MySQL
Use the sudo opensipsdbctl create database before you make sure that MySQL is installed. The installation method is as follows:
$sudo apt-get Install Mysql-server mysql-client
During installation, you are prompted to enter the MySQL root password. Use the following command to test whether MySQL is installed successfully
$sudo mysql-p Enter the root password you just set
The MySQL URL format is as follows:
Mysql://username:password@domain/dbname
2.3 Creating the Opensips Database
Create a database using the sudo opensipsdbctl create command, which requires you to enter the password for the MySQL database root.
Is the password you entered in the previous step. Then there are additional tables for you to choose whether to create and then opensips the database to create success.
/sbin/opensipsdbctl is a shell script that opens the code to read it to know how to create a database is a process. First of all
It will include the/ETC/OPENSIPS/OPENSIPSCTLRC configuration file, and then create the database based on this profile, and also involve
opensipsdbctl.base files and opensipsdbctl.mysql files in/lib/opensips/opensipsctl.
You can go to the Opensips database to see what tables, user authentication to use the Subscriber table.
2 User authentication Configuration
The previous section has explained how to let opensips support MySQL database, user authentication is done on the basis of the previous section.
The main work in this section is the modification of the Opensips configuration file, including Opensips.cfg and OPENSIPSCTLRC files. In the configuration file opensips.cfg
To modify global variables, load db_mysql.so, auth.so, and auth_db.so dynamic libraries, configure appropriate parameters, and modify routing policies, while configuring the file
Some parameters also need to be modified in OPENSIPSCTLRC.
The configuration file opensips.cfg is as follows:
Http://www.jb51.net/article/35752.htm
Configuration of the process of looking at a lot of information on the Internet, usually the profile check can pass, but always can not run opensips, the information is deeply suspicious, do not know
Have they ever really practiced!
Finally decided to read the official instructions, such as opensips MySQL installation in English PDF, opensips source code package install files.
The install file only describes the configuration code to be added to the opensips.cfg file, without detailing where to add the statements, and
There seems to be a mistake, you can't use break, but exit. Opensips MySQL installation in the English PDF describes the specific location, but also to
According to their own actual situation to configure.
After the configuration is complete, verify that the configuration file syntax is correct, and the commands are as follows:
$sudo Opensips–c
Check to start opensips after passing, command as follows:
$sudo Opensipsctl Start
If an error occurs at startup, check the system log for specific reasons, and then pin the cause to resolve the problem.
$vim/var/log/syslog
3 Test
To add a SIP User:
Syntax: Opensipsctl add <username> <password>
Opensipsctl Add alice@192.168.139.121 123456
Opensipsctl Add bob@192.168.139.121 123456
Then download the SIP Client for testing!