Opensips source code installation and configuration technique method _linux

Source: Internet
Author: User
Tags auth system log

1. Source code Download

1.1 Opensips Source Package download

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 Pack download

The source code installation software should be careful to view files such as Readme,install, which have important instructions and installation information.

In the install file, there are only a few packages that are missing from the description of the package that Opensips relies on:

1) Bison or YACC (Berkley YACC)

2) Flex

3) Libncurses5-dev and M4

What packages are missing are available for online installation or download source code package installation.

$APT-cache Search XXXX Package

$apt-get Install xxxxx installation package

./configure,make,sudo make install general steps for source code installation

1.2.1 Bison

Bison installation relies on M4, M4 is a macro processor that copies input to the output while expanding the macro.
M4 Download address is: ftp://ftp.gnu.org/gnu/m4/
Introduction to Bison in the GNU http://www.gnu.org/software/bison/.
Download source code package address: http://ftp.gnu.org/gnu/bison/
Installation bison is simple:./configure,make,sudo make Install

1.2.2 Flex

Use Google to search Linux flex, do not use baidu!

Flex is the fastest lexical analyzer. Flex:the Fast lexical Analyzer, url: http://flex.sourceforge.net/

The following links illustrate the specific process of installing flex in an Ubuntu system. Flex also relies on M4 macro processing packages, ditto.

Http://www.geeksww.com/tutorials/operating_systems/linux/installation/installing_flex_fast_lexical_analyzer_ ubuntu_linux.php

After selecting a version download, unzip the installation,./configure,make,sudo make Install

The above is the process that I install opensips the missing package, if still lack what package will prompt, download installs can.

2. Opensips Installation

2.1 Installation

The install file contains instructions on Opensips installation:

The simplest way to install:

$make All

$sudo make Install

Note: If the prefix option is used during installation, you must also use the prefix option in the previous compilation, and the directory used

is the same. If this is not done, it will cause opensips to not find the default profile, which means that opensips will be in the wrong

Directory to find the configuration file. Because of the compile phase, the default profile directory has been hard-coded into opensips.

The default installation location is/usr/local and prefix is used to specify the installation directory.

1) An error example: Make-All-prefix=/install 2) correct usage: Make prefix=/all make prefix=/Install 2.2 Uninstall method (personal idea)

If you install opensips under/usr/local, the location of the Opensips-related files is as follows:/usr/local/etc/opensips/usr/local/sbin/opensips*/usr/local/ Lib/opensips at this point if you want to install opensips in the root directory/, you will need to uninstall Opensips by deleting the files in the above directory. 2.3 Post-installation directory structure

Opensips file directory 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

The library files in/lib/opensips/are: modules/and opensipsctl/two directories. Modules/is the module supported by the current opensips,

opensipsctl/is the file to be used by the start command in/sbin.

3.opensips Boot

3.1 opensips Command start

$sudo opensips3.2 opensipsctl Command started

Start opensips command: $sudo opensipsctl start

If an error occurs:

Info:starting opensips:

Error:pid File/var/run/opensips.pid does not exist--opensips start failed

You can view the system log to check the cause of the failure:

$tail –n 20/var/log/syslog

1) Error One: ERROR:core:daemonize:unable to create PID File/var/run/opensips.pid:permission denied

Workaround: This problem is a permission issue, plus sudo before the command.

2 Error Two: ERROR:core:main:loading config file (/usr/local/etc/opensips/opensips.cfg): No such file or directory

Analysis: The problem is that the startup configuration file is not found. The analysis found that opensips read the default profile from/usr/local/because

The error in section 2.1 is made, the default path/usr/local/is used at compile time, and the prefix=/option is used at installation, which causes the configuration file to not be found.

Workaround: Make-clean, make-prefix=/all, sudo-make prefix=/install recompile the installation, and then start Opensips.

4.opensips configuration file

Opensips's configuration files are in/etc/opensips/, Opensips.cfg, OPENSIPSCTLRC, and Osipsconsolerc respectively.

Opensips.cfg files are primarily used for opensips-initiated configurations, and all of the configuration of the application features are described in this file. The configuration file is primarily composed of

Composed of three parts:

The first part is a global variable, such as:

listen=udp:127.0.0.1:5060

Disable_tcp=yes

Disable_tls=yes and so on.

The second part 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") and so on.

The third part is mainly routing strategy and function application, 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 configuration of the database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.