How to install and configure opensips source code

Source: Internet
Author: User

1. Download source code

1.1 opensips source code 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 dependent package download

For source code Installation Software, check README, INSTALL, and other files. These files contain important instructions and installation information.

The INSTALL file contains descriptions of the software packages that opensips depends on. Here, only the following software packages are missing:

1) bison or yacc (Berkley yacc)

2) flex

3) libncurses5-dev and m4

You can choose to install the software package online or download the source code package.

$ Apt-cache search xxxx search package

$ Apt-get install xxxxx installation package

./Configure, make, sudo make install General steps for source code Installation

1.2.1 bison

Bison's installation depends on m4. m4 is a macro processor that copies the input to the output and expands the macro.
M4: ftp://ftp.gnu.org/gnu/m4/
Introduction to bison in GNU http://www.gnu.org/software/bison.
Download 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. Do not use baidu!

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

The following link describes how to install flex in ubuntu. Flex also relies on the m4 macro Processing Package.

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

Select a version to download, decompress and install,./configure, make, sudo make install

The above is the package that is missing when I install opensips. If any package is missing, you will be prompted to download and install it.

2. opensips Installation

2.1 installation

INSTALL opensips:

The simplest installation method:

$ Make all

$ Sudo make install

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

The same is true. Otherwise, opensips cannot find the default configuration file. That is to say, opensips will be wrong.

Directory to find the configuration file. During the compilation phase, the default configuration file directory has been hardcoded into opensips.

The default installation path is/usr/local, and the installation directory is specified when prefix is used.

1) An incorrect example: make all make prefix =/install 2) correct usage: make prefix =/all make prefix =/install 2.2 uninstall method (my personal thoughts)

If you install opensips in/usr/local, the file location related to opensips is as follows: /usr/local/etc/opensips/usr/local/sbin/opensips */usr/local/lib/opensips if you want to install opensips in the root directory /, you need to uninstall opensips by deleting the files in the preceding directory. 2.3 directory structure after installation

File directory after opensips installation:

The executable commands in/sbin/include opensips, opensipsctl, opensipsdbctl, and opensipsunix.

The configuration files in/etc/opensips/include: opensips. cfg, opensipsctlrc, and osipsconsolerc.

The library files in/lib/opensips/are: 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 startup

3.1 opensips command start

$ Sudo opensips3.2 opensipsctl command to start

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 view the system logs to check the cause of the failure:

$ Tail-n 20/var/log/syslog

1) ERROR 1: ERROR: core: daemonize: unable to create pid file/var/run/opensips. pid: Permission denied

Solution: This is the permission issue. Add sudo to the command.

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

Analysis: the startup configuration file cannot be found. After analysis, we found that opensips reads the default configuration file from/usr/local/because

The default path/usr/local/is used during compilation, and prefix =/option is used during installation, which leads to the failure to find the configuration file.

Solution: make clean, make prefix =/all, sudo make prefix =/install re-compile and install, and then start opensips.

4. opensips configuration file

The configuration files of opensips are in/etc/opensips/, including opensips. cfg, opensipsctlrc, and osipsconsolerc.

The opensips. cfg file is mainly used for opensips STARTUP configuration. All application function configurations are described in this file. This configuration file is mainly composed

It consists of three parts:

The first part is global variables, such:

Listen = udp: 127.0.0.1: 5060

Disable_tcp = yes

Disable_tls = yes.

The second part is mainly used to load modules and set relevant parameters, such:

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 focuses on routing policies and functional applications, such:

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 the database configuration information.

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.