Skip to end of metadata
Go to start of metadata


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 will not work with Asterisk 12.  


Asterisk 11 uses an embedded pjproject for the ICE, STUN and TURN libraries in its RTP engine for WebSockets support. Therefore you do not need to follow the instructions here for Asterisk 11.
Asterisk 12
dynamically links to pjproject.


If you have previously installed a version of pjproject, you must remove that version of pjproject prior to building and installing the Asterisk 12 compatible version of pjproject. See Uninstalling pjproject for more information.


The Asterisk development team is currently working with Teluu, the makers of pjproject, to push changes upstream so that one day a special version of pjproject won't be required for 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

Downloading pjproject

  1. If you do not have git, install git on your local machine.


    Downloading and installing git is beyond the scope of these instructions, but for Debian/Ubuntu systems, it should be as simple as:

    apt-get install git

    And for RedHat/CentOS systems:

    yum install git
  2. Checkout the Asterisk 12-compatible pjproject from the Asterisk github repo:

    # git clone pjproject

    And that's it!

Building and Installing pjproject

  1. Next we need to run the configure script, but first it is important to understand the options available:


    pjproject embeds a number of third party libraries which can conflict with versions of those libraries that may already be installed on your system. Asterisk will not use the embedded third party libraries within pjproject. As an example, if you are going to build the res_srtp module in Asterisk, then you must specify "--with-external-srtp" when configuring pjproject to point to an external srtp library.

    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.

    LibraryConfigure optionNotes
    libspeex shared objects--with-external-speexMake 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--with-external-srtpMake 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--with-external-gsmMake 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--disable-soundLet Asterisk perform sound manipulations.
    Disable resampling--disable-resample

    Let Asterisk perform resample operations.

    Disable video--disable-videoDisable video support in pjproject's media libraries. This is not used by Asterisk.
    Disable AMR--disable-opencore-amrDisable 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 configure --help for a full list of configure options you can pass to pjproject.


    You must specify --enable-shared in order to build the shared objects for Asterisk. --prefix should be set to the base path of the lib directory where the shared objects will be installed.

    If running on a 64-bit Red Hat distribution (e.g. Fedora, CentOS), then you will also need to add --libdir=/usr/lib64

    Enabling IPV6 Support


    IPv6 support in pjproject is, by default, disabled. To enable it, add CFLAGS='-DPJ_HAS_IPV6=1' to your ./configure command.


    1. Now that you understand the pjproject configure options available, change directories to the pjproject source directory:

      # cd pjproject

      In the pjproject source directory, run the configure script (with the options you decided on, below is just a simple example):

      # ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
  2. Build pjproject:

    # make dep
    # make
  3. Install pjproject

    # make install
  4. Update shared library links.

    # ldconfig
  5. Verify that pjproject has been installed in the target location by looking for, and finding the various pjproject modules:

    # ldconfig -p | grep pj (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/ (libc6,x86-64) => /usr/lib/
  6. Finally, verify that Asterisk detects the pjproject libraries. In your Asterisk 12 source directory:

    # ./configure
    # make menuselect
  7. Browse to the Resource Modules category and verify that the res_pjsip modules are enabled:
  8. 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:

configure:23029: checking for PJPROJECT
configure:23036: $PKG_CONFIG --exists --print-errors "libpjproject"
Package libpjproject was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpjproject.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpjproject' found
  1. Make sure you have pkg-config installed on your system.
  2. 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_PATH environment variable with /usr/lib/pkgconfig and re-run Asterisk's configure script.


When building pjproject, errors about opencore_amr are displayed, e.g.:

output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x60): multiple definition of `pjmedia_codec_amrnb_framelenbits'
output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x60): first defined here
output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x80): multiple definition of `pjmedia_codec_amrnb_framelen'
output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x80): first defined here
output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x20): multiple definition of `pjmedia_codec_amrwb_framelenbits'
output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x20): first defined here
output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x40): multiple definition of `pjmedia_codec_amrwb_framelen'
output/pjmedia-codec-x86_64-unknown-linux-gnu/opencore_amr.o:(.rodata+0x40): first defined here

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.:

/home/mjordan/projects/pjproject/pjmedia/lib/ undefined reference to `pjmedia_format_init_video'
/home/mjordan/projects/pjproject/pjmedia/lib/ undefined reference to `pjmedia_video_format_mgr_instance'
/home/mjordan/projects/pjproject/pjmedia/lib/ undefined reference to `pjmedia_format_get_video_format_detail'
/home/mjordan/projects/pjproject/pjmedia/lib/ undefined reference to `pjmedia_get_video_format_info'

Run configure with either or both --disable-video or --disable-v4l2


After building pjproject, the dump provided by ldconfig -p doesn't display any libraries.


Run 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:


/usr/include/pj/config.h:243:6: error: #error Endianness must be declared for this processor
In file included from /usr/include/pj/types.h:33:0,
                 from /usr/include/pjsip/sip_config.h:27,
                 from /usr/include/pjsip/sip_types.h:34,
                 from /usr/include/pjsip.h:24,
                 from conftest.c:290:
/usr/include/pj/config.h:1161:4: error: #error "PJ_IS_LITTLE_ENDIAN is not defined!"
/usr/include/pj/config.h:1165:4: error: #error "PJ_IS_BIG_ENDIAN is not defined!"

Edit /usr/include/pj/config.h
Replace this code:


With this:

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:

# make uninstall

If you don't have an "uninstall" make target, you may need to fetch and merge the latest pjproject from

Alternatively, the following should also remove all previously installed static libraries:

# rm -f /usr/lib/libpj*.a /usr/lib/libmilenage*.a /usr/lib/pkgconfig/libpjproject.pc
  • No labels