opensips source code installation and configuration tips
- 2020-05-06 12:08:29
- OfStack
1. Source code download
1.1 opensips source package download
The latest opensips download location: http: / / opensips org/pub/opensips/latest/src/
All versions of opensips download location: http: / / opensips org/pub/opensips/
1.2 opensips dependency package download
Source code installation software to pay attention to check README, INSTALL, and other files, these files have very important instructions and installation information.
In the INSTALL file is a description of the packages that opensips depends on. The following packages are missing:
1) bison or yacc (Berkley yacc)
2) flex
3) libncurses5 - dev and m4
Lack of what package you can choose to install online or download the source code package installation.
$apt-cache search xxxx search package
$apt-get install xxxxx install package
./configure, make, sudo make install general steps for source code installation
1.2.1 bison
The installation of bison relies on m4, which is a macro processor that copies input to output while expanding macros.
m4 download address is: ftp: / / ftp gnu. org/gnu/m4 /
GNU http: / / www gnu. org/introduction to bison software bison /.
download the source code package address: http: / / ftp gnu. org/gnu/bison/
installing bison is simple:./configure, make, sudo make install
1.2.2 flex
search linux flex using google, not baidu!
flex is the fastest lexical analyzer. flex: The Fast Lexical Analyzer, url: http: / / flex sourceforge. net/
The following link explains the process of installing flex on an ubuntu system. flex also relies on the m4 macro processing package, as above.
http://www.geeksww.com/tutorials/operating_systems/linux/installation/installing_flex_fast_lexical_analyzer_ubuntu_linux.php
After selecting a version to download, unzip the installation./configure, make, sudo make install
The above is the package missing when I installed opensips. If there is any package missing, it will be prompted. Just download and install it.
2. opensips installs
2.1 install
The INSTALL file contains instructions for installing opensips:
Easiest installation:
$make all
$sudo make install
Note: if you used the prefix option during the installation, you must also use the prefix option in the previous compilation and use the directory
Same thing. If this is not followed, then opensips will not find the default configuration file, which means that opensips will be in the wrong
Look for configuration files in the directory. The default configuration file directory has been hard-coded into opensips because of the build phase.
The default installation location is /usr/local, and the installation directory is specified if prefix is used.
1) an example of an error: make allmake prefix=/ install 2) correct usage: make prefix=/ allmake prefix=/ install 2.2 uninstall method (personal thought)
If opensips is installed under /usr/local, the location of the files associated with opensips is shown below: / usr/local/etc/opensips/usr/local sbin/opensips * / usr/local/lib/opensips right now if you want to install the opensips/under the root directory, you will need to uninstall opensips, above method is to delete files in the directory. 2.3 post-installation directory structure
opensips after installation:
The executable commands in /sbin/ are as follows: opensips, opensipsctl , opensipsdbctl , opensipsunix
The configuration files in /etc/opensips/ are opensips.cfg, opensipsctlrc and osipsconsolerc
/lib/opensips/ has two directories: modules/ and opensipsctl/. modules/ is the module currently supported by opensips,
opensipsctl/ is the file to be used by the /sbin startup command.
3.opensips starts
3.1 opensips command starts
sudo opensips3.2 opensipsctl command starts
Start opensips command: $sudo opensipsctl start
If the following error occurs:
INFO: Starting OpenSIPS:
ERROR: PID file var/run/opensips pid does not exist - OpenSIPS start failed
You can check the system log for the cause of the failure:
$tail � n 20 / var log/syslog
1) error: ERROR: core: daemonize: unable to create pid file var/run/opensips pid: Permission denied
Solution: this problem is the permission problem, add sudo before the command.
2) error 2: ERROR: core: main: loading config file (/ usr local etc/opensips/opensips cfg) : No such file or directory
Analysis: the problem is that the startup profile cannot be found. Analysis revealed that opensips read the default configuration file from /usr/local/ because
Made the error in section 2.1 and used the default path /usr/local/ at compile time and the prefix=/ option at install time, resulting in the configuration file not being found.
Solution: make clean, make prefix=/ all, sudo make prefix=/ install
4.opensips configuration file
The configuration files for opensips are in /etc/opensips/, opensips.cfg, opensipsctlrc, osipsconsolerc.
The opensips.cfg file is mainly used for the configuration of the opensips startup. The configuration of all application functions is described in this file. The configuration file is mainly
Three parts:
The first part of is a global variable, such as
listen=udp:127.0.0.1:5060
disable_tcp=yes
disable_tls=yes et al.
The second part of is mainly used to load modules and set corresponding parameters, such as
loadmodule "db_mysql.so"
loadmodule "auth.so"
loadmodule "auth_db.so"
modparam("auth", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password"), etc.
The third part of is mainly about routing policies and functional applications, such as
route[relay] {
# for INVITEs enable some additional helper routes
if (is_method("INVITE")) {
t_on_branch("per_branch_ops");
t_on_reply("handle_nat");
t_on_failure("missed_call");
}
...
}
The opensipsctlrc file contains information about the database configuration.