Asterisk 12 contains two SIP stacks: one, the original chan_sip SIP channel driver that has been present in all previous releases of Asterisk, and a new SIP stack that is based on pjproject. For background information on the decision to write a new SIP channel driver for Asterisk 12, please read the New SIP Channel Driver page.
Because the current release of pjproject cannot build shared object libraries, some changes were required in order to use it with Asterisk 12. As a result, the current versions of pjproject that can be downloaded from www.pjsip.org will not work with Asterisk 12.
The Asterisk 12 compatible version of pjproject is available on github, or - depending on your Linux distribution - available as a package. This wiki page provides detailed instructions on building and installing pjproject for Asterisk 12.
Building and Installing pjproject from Source
If you do not have git, install git on your local machine.
Checkout the Asterisk 12-compatible pjproject from the Asterisk github repo:
And that's it!
Building and Installing pjproject
Next we need to run the configure script, but first it is important to understand the options available:
Due to the information expressed in the warning above, building pjproject is highly dependent on your distribution of Linux as well as what third party libraries are already installed on your system. A number of configuration options are available to disable these libraries in pjproject and custom tailor it to your system. The table below outlines common ones that may be needed for a typical installation.
Library Configure option Notes libspeex shared objects
Make sure that the library development headers are accessible from pjproject. The CFLAGS and LDFLAGS environment variables may be used to set the include/lib paths. libsrtp shared objects
Make sure that the library development headers are accessible from pjproject. The CFLAGS and LDFLAGS environment variables may be used to set the include/lib paths. GSM codec
Make sure that the library development headers are accessible from pjproject. The CFLAGS and LDFLAGS environment variables may be used to set the include/lib paths. Disable sound
Let Asterisk perform sound manipulations. Disable resampling
Let Asterisk perform resample operations.
Disable video support in pjproject's media libraries. This is not used by Asterisk. Disable AMR --disable-opencore-amr Disable AMR codec support. This is not used by Asterisk
These are some of the more common options used to disable third party libraries in pjproject. However, other options may be needed depending on your system - see
for a full list of configure options you can pass to pjproject.
Now that you understand the pjproject configure options available, change directories to the pjproject source directory:
In the pjproject source directory, run the configure script (with the options you decided on, below is just a simple example):
Update shared library links.
Verify that pjproject has been installed in the target location by looking for, and finding the various pjproject modules:
Finally, verify that Asterisk detects the pjproject libraries. In your Asterisk 12 source directory:
- Browse to the Resource Modules category and verify that the
res_pjsipmodules are enabled:
- You're all done! Now, build and install Asterisk as your normally would.
Issues and Workarounds
After building and installing pjproject, Asterisk fails to detect any of the libraries - the various res_pjsip components cannot be selected in Asterisk's menuselect
Verify that Asterisk's config.log shows the following:
- Make sure you have
pkg-configinstalled on your system.
- pjproject will install the package config file in
/usr/lib/pkgconfig. Some distributions, notably Fedora, will instead look for the library in
/usr/lib64. Update your
PKG_CONFIG_PATHenvironment variable with
/usr/lib/pkgconfigand re-run Asterisk's
When building pjproject, errors about opencore_amr are displayed, e.g.:
You already have the AMR codec installed. Run
configure with the
--disable-opencore-amr option specified.
When building pjproject, linker errors referring to various video methods are displayed, e.g.:
configure with either or both
After building pjproject, the dump provided by
ldconfig -p doesn't display any libraries.
ldconfig to re-configure dynamic linker run-time bindings
pjproject/Asterisk fails to compile on your Raspberry Pi (raspbian) due to pjproject configure scripts not detecting endianness
configure produces errors:
Replace this code:
Then recompile. This workaround was taken from issue ASTERISK-23315
Uninstalling a Previous Version of pjproject
Typically, other versions of pjproject will be installed as static libraries. These libraries are not compatible with Asterisk and can confuse the build process for Asterisk 12. As such, any static libraries must be removed prior to installing the compatible version of pjproject.
pjproject provides an
uninstall make target that will remove previous installations. It can be called from the pjproject source directory like:
If you don't have an "uninstall" make target, you may need to fetch and merge the latest pjproject from https://github.com/asterisk/pjproject
Alternatively, the following should also remove all previously installed static libraries: