Wednesday, September 10, 2014

Asterisk Installation (CentOS 6.5)



ASTERISK INSTALLATION
Downloads of Asterisk are available at http://downloads.asterisk.org/pub/telephony/asterisk/. The currently supported versions of Asterisk will each have a symbolic link to their related release on this server, named asterisk-{version}-current.tar.gz. All releases ever made for the Asterisk project are available at http://downloads.asterisk.org/pub/telephony/asterisk/releases/.
The currently supported versions of Asterisk are documented on the Asterisk Versions page. It is highly recommended that you install one of the currently supported versions, as these versions continue to receive bug and security fixes.
Which version should I install?
Icon
·         If you want a rock solid communications framework, choose the latest Long Term Support (LTS) release. Currently, that is Asterisk 11.
·         If you want the latest cool features and capabilities, choose the latest release of Asterisk. If that is a Standardrelease, note that these releases may have larger changes made in them than LTS releases.
Unless otherwise noted, for the purposes of this section we will assume that Asterisk 11 is being installed.
Review Asterisk's System Requirements in order to determine what needs to be installed for the version of Asterisk you are installing. While Asterisk will look for any missing system requirements during compilation, it's often best to install these prior to configuring and compiling Asterisk.
Asterisk does come with a script, install_prereq, to aid in this process. If you'd like to use this script, download Asterisk first, then see Checking Asterisk Requirements for instructions on using this script to install prerequisites for your version of Asterisk.
On this Page
Downloading Asterisk
Browse to http://downloads.asterisk.org/pub/telephony/asterisk, select asterisk-11-current.tar.gz, and save the file on your file system.
You can also get the latest releases from the downloads page on asterisk.org.
Alternatively, you can uswget to retrieve the latest release:
[root@server:/usr/local/src]# wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz

--2014-04-15 15:36:45--  http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
Resolving downloads.asterisk.org (downloads.asterisk.org)... 76.164.171.238
Connecting to downloads.asterisk.org (downloads.asterisk.org)|76.164.171.238|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 34794750 (33M) [application/x-gzip]
Saving to: `asterisk-11-current.tar.gz'

100%[==============================================================================>] 34,794,750  6.82M/s   in 4.6s   

2014-04-15 15:36:49 (7.16 MB/s) - `asterisk-11-current.tar.gz' saved [34794750/34794750]
Other Projects
libpri
The libpri library allows Asterisk to communicate with ISDN connections.You'll only need this if you are going to use DAHDI with ISDN interface hardware (such as T1/E1/J1/BRI cards).
DAHDI
The DAHDI library allows Asterisk to communicate with analog and digital telephones and telephone lines, including connections to the Public Switched Telephone Network, or PSTN.
DAHDI stands for Digium Asterisk Hardware Device Interface, and is a set of drivers and utilities for a number of analog and digital telephony cards, such as those manufactured by Digium. The DAHDI drivers are independent of Asterisk, and can be used by other applications. DAHDI was previously called Zaptel, as it evolved from the Zapata Telephony Project.
The DAHDI code can be downloaded as individual pieces (dahdi-linux for the DAHDI drivers, and dahdi-tools for the DAHDI utilities. They can also be downloaded as a complete package called dahdi-linux-complete, which contains both the Linux drivers and the utilities.
You will only need to install DAHDI if you are going to utilize DAHDI compatible analog or digital telephony interface boards.
Why is DAHDI split into different pieces?
Icon
DAHDI has been split into two pieces (the Linux drivers and the tools) as third parties have begun porting the DAHDI drivers to other operating systems, such as FreeBSD. Eventually, we may have dahdi-linux, dahdi-freebsd, and so on.
Download Locations
Project
Location
Asterisk
libpri
dahdi-linux
dahdi-tools
dahdi-complete

When you download the source for libpri, DAHDI, and Asterisk you'll typically end up with files with a .tar.gz or .tgz file extension. These files are affectionately known as tarballs. The name comes from the tar Unix utility, which stands for tape archive. A tarball is a collection of other files combined into a single file for easy copying, and then often compressed with a utility such as GZip.
To extract the source code from the tarballs, we'll use the tar command. The commands below assume that you've downloaded the tarballs for libpri, DAHDI, and Asterisk to the /usr/local/src directory on a Linux machine. (You'll probably need to be logged in as the root user to be able to write to that directory.) We're also going to assume that you'll replace the letters X, Y, and Z with the actual version numbers from the tarballs you downloaded. Also please note that the command prompt may be slightly different on your system than what we show here. Don't worry, the commands should work just the same.
First, we'll change to the directory where we downloaded the source code:
[root@server ~]# cd /usr/local/src
Next, let's extract the source code from each tarball using the tar command. The -zxvf parameters to the tar command tell it what we want to do with the file. The z option tells the system to unzip the file before continuing, the x option tells it to extract the files from the tarball, the v option tells it to be verbose (write out the name of every file as it's being extracted, and the f option tells the tar command that we're extracting the file from a tarball file, and not from a tape.
[root@server src]# tar -zxvf libpri-1.X.Y.tar.gz

[root@server src]# tar -zxvf dahdi-linux-complete-2.X.Y+2.X.Y.tar.gz

[root@server src]# tar -zxvf asterisk-11-current.tar.gz
You should now notice that a new sub-directory was created for each of the tarballs, each containing the extracted files from the corresponding tarball. We can now compile and install each of the components.
Overview
Let's install DAHDI!
On Linux, we will use the DAHDI-linux-complete tarball, which contains the DAHDI Linux drivers, DAHDI tools, and board firmware files. Again, we're assuming that you've untarred the tarball in the /usr/local/src directory, and that you'll replace X and Y with the appropriate version numbers.
See What to Download? for more information on downloading the DAHDI tarballs.
Install DAHDI before libpri
Icon
libpri 1.4.13 and later source code depends on DAHDI include files. So, one must install DAHDI before installing libpri.
Don't need DAHDI?
Icon
 If you are not integrating with any traditional telephony equipment and you are not planning on using the MeetMe dialplan application, then you do not have to install DAHDI or libpri in order to use Asterisk.
On This Page

Starting with DAHDI-Linux-complete version 2.8.0+2.8.0, all files necessary to install DAHDI are available in the complete tarball. Therefore, all you need to do to install DAHDI is:
[root@server src]# cd dahdi-linux-complete-2.X.Y+2.X.Y

[root@server dahdi-linux-complete-2.X.Y+2.X.Y]# make

[root@server dahdi-linux-complete-2.X.Y+2.X.Y]# make install

[root@server dahdi-linux-complete-2.X.Y+2.X.Y]# make config

Have you installed DAHDI?
Icon
 Before you can build libpri, you'll need to Build and Install DAHDI.
As in the other build and install sections, we'll assume that you'll replace the letters X, Y, and Z with the actual version numbers from the tarballs you downloaded.
[root@server src]# cd libpri-1.X.Y

This command changes directories to the libpri source directory.
[root@server libpri-1.X.Y]# make

This command compiles the libpri source code into a system library.
[root@server libpri-1.X.Y]# make install

This command installs the libpri library into the proper system library directory

Building and Installing pjproject

Overview 

Asterisk 12 and later versions contain 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 earlier releases of pjproject cannot build shared object libraries, some changes were required in order to use it with Asterisk 12. As such, Asterisk requires pjproject version 2.2 or later. Alternatively, an Asterisk compatible version of pjproject is available on github, or - depending on your Linux distribution - available as a package.
Earlier versions of pjproject downloaded from www.pjsip.org will not work with Asterisk 12. 
Icon
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.
On this Page

Building and Installing pjproject from Source

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

Downloading pjproject

Obtaining pjproject from Teluu:

1.    Use wget to pull the latest version from www.pjsip.org. Note that the instructions assume that this is 2.2.1; for the latest version, refer to www.pjsip.org:
2.  # wget http://www.pjsip.org/release/2.2.1/pjproject-2.2.1.tar.bz2
3.   
# tar -xjvf pjproject-2.2.1.tar.bz2

Obtaining pjproject from the github repo:

1.    If you do not have git, install git on your local machine.
Icon
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 https://github.com/asterisk/pjproject pjproject
And that's it!

Building and Installing pjproject

The first step in building and installing pjproject is configuring it using configure. For Asterisk, this is arguably the most important step in this process. 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.
Additionally, Asterisk requires two options to be passed to configure:
·         --enable-shared - instruct pjproject to build shared object libraries. Asterisk will only use shared objects from pjproject.
·         --prefix - specify Asterisk's preferred location for shared object libraries. This will be dependent on your distribution of Linux; typically this is either /usr/lib for most systems or /usr/lib64 for 64-bit versions of Red-Hat based distributions.
Other common configure options needed for pjproject are listed below:
Library
Configure option
Notes
libspeexshared objects
--with-external-speex
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
--with-external-srtp
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
--with-external-gsm
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
--disable-sound
Let Asterisk perform sound manipulations.
Disable resampling
--disable-resample
Let Asterisk perform resample operations.
Disable video
--disable-video
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 configure --help for a full list of configure options you can pass to pjproject.

Enabling IPV6 Support
Icon
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
2.    In the pjproject source directory, run the configure script with the options needed for your system:
# ./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr
3.    Build pjproject:
4.  # make dep
5.  # make
6.    Install pjproject
# make install
7.    Update shared library links.
# ldconfig
8.    Verify that pjproject has been installed in the target location by looking for, and finding the various pjproject modules:
9.  # ldconfig -p | grep pj
10.        libpjsua.so (libc6,x86-64) => /usr/lib/libpjsua.so
11.        libpjsip.so (libc6,x86-64) => /usr/lib/libpjsip.so
12.        libpjsip-ua.so (libc6,x86-64) => /usr/lib/libpjsip-ua.so
13.        libpjsip-simple.so (libc6,x86-64) => /usr/lib/libpjsip-simple.so
14.        libpjnath.so (libc6,x86-64) => /usr/lib/libpjnath.so
15.        libpjmedia.so (libc6,x86-64) => /usr/lib/libpjmedia.so
16.        libpjmedia-videodev.so (libc6,x86-64) => /usr/lib/libpjmedia-videodev.so
17.        libpjmedia-codec.so (libc6,x86-64) => /usr/lib/libpjmedia-codec.so
18.        libpjmedia-audiodev.so (libc6,x86-64) => /usr/lib/libpjmedia-audiodev.so
19.        libpjlib-util.so (libc6,x86-64) => /usr/lib/libpjlib-util.so
        libpj.so (libc6,x86-64) => /usr/lib/libpj.so
20.  Finally, verify that Asterisk detects the pjproject libraries. In your Asterisk source directory:
21.# ./configure
# make menuselect
22.  Browse to the Resource Modules category and verify that the res_pjsip modules are enabled:
23.  You're all done!  Now, build and install Asterisk as your normally would.

Troubleshooting

Asterisk fails to detect pjproject libraries

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

Solution

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.

pjproject fails to build: errors related to opencore_amr

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

Solution

You already have the AMR codec installed. Run configure with the --disable-opencore-amr option specified.

pjproject fails to build: video linker errors

When building pjproject, linker errors referring to various video methods are displayed, e.g.:
/home/mjordan/projects/pjproject/pjmedia/lib/libpjmedia-videodev.so: undefined reference to `pjmedia_format_init_video'
/home/mjordan/projects/pjproject/pjmedia/lib/libpjmedia.so: undefined reference to `pjmedia_video_format_mgr_instance'
/home/mjordan/projects/pjproject/pjmedia/lib/libpjmedia-videodev.so: undefined reference to `pjmedia_format_get_video_format_detail'
/home/mjordan/projects/pjproject/pjmedia/lib/libpjmedia-videodev.so: undefined reference to `pjmedia_get_video_format_info'

Solution

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

ldconfig fails to display pjproject libraries

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

Solution

Run ldconfig to re-configure dynamic linker run-time bindings. This will need to be run with super user permissions.

pjproject fails to build on Raspberry Pi

pjproject/Asterisk fails to compile on your Raspberry Pi (raspbian) due to pjproject configure scripts not detecting endianness:
/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!"

Solution

1.    Edit /usr/include/pj/config.h (using the editor of your choice)
2.    Replace this code:
    /*
     * ARM, bi-endian, so raise error if endianness is not configured
     */
#   undef PJ_M_ARMV4
#   define PJ_M_ARMV4           1
#   define PJ_M_NAME            "armv4"
#   define PJ_HAS_PENTIUM       0
#   if !PJ_IS_LITTLE_ENDIAN && !PJ_IS_BIG_ENDIAN
#       error Endianness must be declared for this processor
#   endif
With this:
    /*
     * ARM, bi-endian, so raise error if endianness is not configured
     */
#   undef PJ_M_ARMV4
#   define PJ_M_ARMV4           1
#   define PJ_M_NAME            "armv4"
#   define PJ_HAS_PENTIUM       0
#   define PJ_IS_LITTLE_ENDIAN  1
#   define PJ_IS_BIG_ENDIAN     0
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 https://github.com/asterisk/pjproject
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

Configuring Asterisk
Now it's time to compile and install Asterisk. Let's change to the directory which contains the Asterisk source code.
[root@server]# cd /usr/local/src/asterisk-11.X.Y
Next, we'll run a command called ./configure, which will perform a number of checks on the operating system, and get the Asterisk code ready to compile on this particular server.
[root@server asterisk-11.X.Y]# ./configure
This will run for a couple of minutes, and warn you of any missing system libraries or other dependencies. Unless you've installed all of the System Requirements for your version of Asterisk, the configure script is likely to fail. If that happens, resolve the missing dependency manually, or use the install_prereq script to resolve all of the dependencies on your system.
Once a dependency is resolved, run configure again to make sure the missing dependency is fixed.
Icon
If you have many missing dependencies, you may find yourself running configure a lot. If that is the case, you'll do yourself a favour by checking the System Requirements or installing all dependencies via the install_prereq script.
On this Page
Upon successful completion of ./configure, you should see a message that looks similar to the one shown below. (Obviously, your host CPU type may be different than the below.)
                .$$$$$$$$$$$$$$$=..      
              .$7$7..        .7$$7:.    
            .$7$7..           .7$$7:.
          .$$:.                 ,$7.7
        .$7.     7$$$$           .$$77
     ..$$.       $$$$$            .$$$7
    ..7$   .?.   $$$$$   .?.       7$$$.
   $.$.   .$$$7. $$$$7 .7$$$.      .$$$.
 .777.   .$$$$$$77$$$77$$$$$7.      $$$,
 $$$~      .7$$$$$$$$$$$$$7.       .$$$.
.$$7          .7$$$$$$$7:          ?$$$.
$$$          ?7$$$$$$$$$$I        .$$$7
$$$       .7$$$$$$$$$$$$$$$$      :$$$.
$$$       $$$$$$7$$$$$$$$$$$$    .$$$.
$$$        $$$   7$$$7  .$$$    .$$$.
$$$$             $$$$7         .$$$.
7$$$7            7$$$$        7$$$
 $$$$$                        $$$
  $$$$7.                       $$  (TM)
   $$$$$$$.           .7$$$$$$  $$
     $$$$$$$$$$$$7$$$$$$$$$.$$$$$$
       $$$$$$$$$$$$$$$$.

configure: Package configured for: 
configure: OS type  : linux-gnu
configure: Host CPU : x86_64
configure: build-cpu:vendor:os: x86_64 : unknown : linux-gnu :
configure: host-cpu:vendor:os: x86_64 : unknown : linux-gnu :
Cached Data
Icon
The ./configure command caches certain data to speed things up if it's invoked multiple times. To clear all the cached data, you can use the following command to completely clear out any cached data from the Asterisk build system.
[root@server asterisk-11.X.Y]# make distclean
You can then re-run ./configure.
Using install_prereq
The install_prereq script is included with every release of Asterisk in the contrib/scripts subdirectory. The script has the following options:
·         test - print only the libraries to be installed.
·         install - install package dependencies only. Depending on your distribution of Linux, version of Asterisk, and capabilities you wish to use, this may be sufficient.
·         install-unpacakged - install dependencies that don't have packages but only have tarballs. You may need these dependencies for certain capabilities in Asterisk.

[root@server asterisk-11.X.Y]# cd contrib/scripts

[root@server asterisk-11.X.Y/contrib/scripts]# ./install_prereq install

[root@server asterisk-11.X.Y/contrib/scripts]# ./install_prereq install-unpackaged
Using Menuselect
The next step in the build process is to tell Asterisk which modules to compile and install, as well as set various compiler options. These settings are all controlled via a menu-driven system called Menuselect. To access the Menuselect system, type:
[root@server asterisk-11.X.Y]# make menuselect
Terminal Window
Icon
Your terminal window size must be at least eighty characters wide and twenty-seven lines high, or Menuselect will not work. Instead, you'll get an error message stating
Terminal must be at least 80 x 27.
The Menuselect menu should look like the screen-shot below. On the left-hand side, you have a list of categories, such asApplications, Channel Drivers, and PBX Modules. On the right-hand side, you'll see a list of modules that correspond with the select category. At the bottom of the screen you'll see two buttons. You can use the Tab key to cycle between the various sections, and press the Enter key to select or unselect a particular module. If you see [*] next to a module name, it signifies that the module has been selected. If you see *XXX next to a module name, it signifies that the select module cannot be built, as one of its dependencies is missing. In that case, you can look at the bottom of the screen for the line labeled Depends upon: for a description of the missing dependency.
On this Page
When you're first learning your way around Asterisk on a test system, you'll probably want to stick with the default settings in Menuselect. If you're building a production system, however, you may not wish to build all of the various modules, and instead only build the modules that your system is using.

When you are finished selecting the modules and options you'd like in Menuselect, press F12 to save and exit, or highlight the Save and Exit button and press enter.
Module Support Levels
Menuselect will also show the support level for a selected module or build option. The support level will always be one of coreextended, or deprecated. For more information on these support levels, see Asterisk Module Support States.
Menuselect Categories
Category
Description
Add-ons
Modules that link with libraries that have licensing restrictions beyond what is allowed via the GPLv2 and Asterisk's dual licensing model. See README-addons.txt, delivered with Asterisk, for more information.
Applications
Modules that provide call functionality to the system. An application might answer a call, play a sound prompt, hang up a call, and so forth.
Bridging Modules
Modules that provide various bridge mixing technologies and other bridge related functionality.
Call Detail Recording
Modules that provide Call Detail Record (CDR) drivers for various permanent storage backends.
Channel Event Logging
Modules that provide Channel Event Logging (CEL) drivers for various permanent storage backends.
Channel Drivers
Modules that provide communications with devices outside of Asterisk, and translate that particular signalling or protocol to the core.
CodecTranslators
Modules that provide encoding/decoding for audio or video. Typically codecs are used to encode media so that it takes less bandwidth.
Format Interpreters
Modules used to save media to disk in a particular file format, and to convert those files back to media streams on the network.
Dialplan Functions
Modules that are used to retrieve or set various settings on a call. A function might be used to set the Caller ID on an outbound call, for example.
PBX Modules
Modules that implement dialplan functionality or enhancements.
Resource Modules
Modules that provide additional resources to Asterisk. This can includes music on hold, calendar integration, database integration, various protocol stacks, etc.
Test Modules
Unit test modules. These are typically only available when Asterisk has:
·         Been configured with the --enable-dev-mode setting
·         The TEST_FRAMEWORK compilation option has been selected in Compiler Flags - Development
Compiler Flags - Development
Various compilation flags that alter Asterisk's behaviour. These flags are often useful in debugging Asterisk, or obtaining information for Asterisk developers.
Easier Debugging of Asterisk Crashes
Icon
As much as we may hate to admit it, Asterisk may sometimes have problems.
If you're finding that Asterisk is crashing on you, there's are settings under Compiler Flags - Development that are critical for developers attempting to assist you. For detailed instructions on enabling these settings, see Getting a Backtrace.
Voicemail Build Options
Compilation flags that enable different Voicemail (via app_voicemail) storage backends.
Utilities
Various utilities for Asterisk. These include Asterisk Database upgrade utilities, Asterisk monitoring utilities, and other potentially useful tools.
AGI Samples
Sample AGI applications.
ModuleEmbedding
Compilation flags to enable embedding of Asterisk dynamic modules into the Asterisk binary.
Core Sound Packages
Core sounds used by Asterisk. Different sound formats can be selected in this menu; when Asterisk is installed, these sounds will be downloaded and installed.
Music On Hold File Packages
Sample Music on Hold media used by Asterisk. Different formats can be selected in this menu; when Asterisk is installed, the various media samples will be downloaded and installed.
Extras Sound Packages
Extra sounds that can be used by Asterisk integrators. Different sound formats can be selected in this menu; when Asterisk is installed, these sounds will be downloaded and installed.
Controlling Menuselect
Options in Menuselect can be controlled from the command line. Menuselect can be built without invoking the user interface via the menuselect.makeoptstarget:
[root@server asterisk-11.X.Y]# make menuselect.makeopts
Available options can be viewed using the --help command line parameter:
[root@server asterisk-11.X.Y]# menuselect/menuselect --help

Some of the more common options are shown below.
Menuselect Output
Icon
 Asterisk expects all Menuselect options to be written to the menuselect.makeopts file. When enabling/disabling Menuselect options via the command line, your output should typically be to that file.
Listing Options
To list all options in Menuselect, use the --list-options command line parameter:
[root@server asterisk-11.X.Y]# menuselect/menuselect --list-options

To list only the categories, use the --category-list command line parameter:
[root@server asterisk-11.X.Y]# menuselect/menuselect --category-list
MENUSELECT_ADDONS
MENUSELECT_APPS
MENUSELECT_BRIDGES
MENUSELECT_CDR
MENUSELECT_CEL
MENUSELECT_CHANNELS
MENUSELECT_CODECS
MENUSELECT_FORMATS
MENUSELECT_FUNCS
MENUSELECT_PBX
MENUSELECT_RES
MENUSELECT_TESTS
MENUSELECT_CFLAGS
MENUSELECT_OPTS_app_voicemail
MENUSELECT_UTILS
MENUSELECT_AGIS
MENUSELECT_EMBED
MENUSELECT_CORE_SOUNDS
MENUSELECT_MOH
MENUSELECT_EXTRA_SOUNDS

To list the options in a category, use the --list-category command line parameter:
[root@server asterisk-11.X.Y]# menuselect/menuselect --list-category MENUSELECT_OPTS_app_voicemail
+ FILE_STORAGE
- ODBC_STORAGE
- IMAP_STORAGE
Enabling an Option
To enable an option in Menuselect, use the --enable command line parameter:
[root@server asterisk-11.X.Y]# menuselect/menuselect --enable IMAP_STORAGE menuselect.makeopts
Chaining Options
Icon
 Multiple options can be chained together:
[root@server asterisk-11.X.Y]# menuselect/menuselect --enable app_voicemail --enable IMAP_STORAGE menuselect.makeopts
Disabling an Option
To disable an option in Menuselect, use the --disable command line parameter:
[root@server asterisk-11.X.Y]# menuselect/menuselect --disable app_voicemail menuselect.makeopts
Enabling a Category
An entire category can be enabled in Menuselect using the --enable-category command line parameter:
[root@server asterisk-11.X.Y]# menuselect/menuselect --enable-category MENUSELECT_ADDONS menuselect.makeopts

Building and Installing Asterisk

Build and Install Instructions

Now we can compile and install Asterisk. To compile Asterisk, simply type make at the Linux command line.
[root@server asterisk-11.X.Y]# make
The compiling step will take several minutes, and you'll see the various file names scroll by as they are being compiled. Once Asterisk has finished compiling, you'll see a message that looks like:
+--------- Asterisk Build Complete ---------+
+ Asterisk has successfully been built, and +
+ can be installed by running:              +
+                                           +
+                make install               +
+-------------------------------------------+
+--------- Asterisk Build Complete ---------+
On this Page
As the message above suggests, our next step is to install the compiled Asterisk program and modules. To do this, use the make install command.
[root@server asterisk-11.X.Y]# make install
When finished, Asterisk will display the following warning:
+---- Asterisk Installation Complete -------+
+                                           +
+    YOU MUST READ THE SECURITY DOCUMENT    +
+                                           +
+ Asterisk has successfully been installed. +
+ If you would like to install the sample   +
+ configuration files (overwriting any      +
+ existing config files), run:              +
+                                           +
+                make samples               +
+                                           +
+-------------------------------------------+
+---- Asterisk Installation Complete -------+
Security Precautions
Icon
As the message above suggests, we very strongly recommend that you read the security documentation before continuing with your Asterisk installation. Failure to read and follow the security documentation can leave your system vulnerable to a number of security issues, including toll fraud.

Advanced Build and Install Options

Customizing the Build/Installation

In some environments, it may be necessary or useful to modify parts of the build or installation process. Some common scenarios are listed here

Passing compilation and linkage flags to gcc

Specific flags can be passed to gcc when Asterisk is configured, using the CFLAGS and LDFLAGS environment variables:
[root@server asterisk-11.X.Y]# ./configure CFLAGS=-pg LDFLAGS=-pg

Debugging compilation

To see all of the flags passed to gcc, build using the NOISY_BUILD setting set to YES:
[root@server asterisk-11.X.Y]# make NOISY_BUILD=yes

Building for non-native architectures

Generally, Asterisk attempts to optimize itself for the machine on which it is built on. On some virtual machines with virtual CPU architectures, the defaults chosen by Asterisk's compilation options will cause Asterisk to build but fail to run. To disable native architecture support, disable the BUILD_NATIVE option in menuselect:
[root@server asterisk-11.X.Y]# menuselect/menuselect --disable BUILD_NATIVE menuselect.makeopts
 
[root@server asterisk-11.X.Y]# make

Installing to a custom directory

While there are multiple ways to sandbox an instance of Asterisk, the preferred mechanism is to use the --prefix option with the configure script:
[root@server asterisk-11.X.Y]# ./configure --prefix=/usr/local/my_special_folder
Note that the default value for prefix is /usr/local.

Other Make Targets

Target
Description

Executing make with no target is equivalent to the all target.
all
Compiles everything everything selected through the configure and menuselect scripts.
full
This is equivalent to make or make all, save that it will perform a more thorough investigation of the source code for documentation. This is needed to generate AMI event documentation. Note that your system must have Python in order for this make target to succeed.
Version Notice
Icon
This build target is only available in Asterisk 11 and later versions.
install
Installs Asterisk, building Asterisk if it has not already been built. In general, this should be executed after Asterisk has successfully compiled.
uninstall
Removes Asterisk binaries, sounds, man pages, headers, modules and firmware builds from the system.
uninstall-all
Same as the uninstall target, but additionally removes configuration, spool directories and logs. All traces of Asterisk.
Icon
As just noted, this will remove all Asterisk configuration from your system. Do not execute uninstall-all unless you are sure that is what you want to do.
clean
Remove all files generated by make.
dist-clean
Remove pretty much all files generated by make and configure.
samples
Install all sample configuration files (.conf files) to /etc/asterisk/. Overwrites existing config files.
config
Install init scripts (startup scripts) on your system.
progdocs
Uses doxygen to locally generate HTML development documentation from the source code.  Generated in the doc/ subdirectory of the source; see doc/index.html.

·          
·         Created by Unknown User (malcolmd), last modified by Matt Jordan on Apr 16, 2014
Asterisk Sample Configs: not a sample PBX configuration
Icon
For many of the sample configuration files that make samples installs, the configuration contains more than just an example configuration. The sample configuration files historically were used predominately for documentation of available options. As such, they contain many examples of configuring Asterisk that may not be ideal for standard deployments.
While installing the sample configuration files may be a good starting point for some people, they should not be viewed as recommended configuration for an Asterisk system.

To install a set of sample configuration files for Asterisk, type:
[root@server asterisk-11.X.Y]# make samples
Any existing sample files which have been modified will be given a .old file extension. For example, if you had an existing file named extensions.conf, it would be renamed to extensions.conf.old and the sample dialplan would be installed as extensions.conf.



 Installing Initialization Scripts


Now that you have Asterisk compiled and installed, the last step is to install the initialization script, or initscript. This script starts Asterisk when your server starts, will monitor the Asterisk process in case anything bad happens to it, and can be used to stop or restart Asterisk as well. To install the initscript, use themake config command.
[root@server asterisk-11.X.Y]# make config
As your Asterisk system runs, it will generate logfiles. It is recommended to install the logrotation script in order to compress and rotate those files, to save disk space and to make searching them or cataloguing them easier. To do this, use the make install-logrotate command.
[root@server asterisk-11.X.Y]# make install-logrotate


Before continuing on, let's check a few things to make sure your system is in good working order. First, let's make sure the DAHDI drivers are loaded. You can use the lsmod under Linux to list all of the loaded kernel modules, and the grep command to filter the input and only show the modules that have dahdi in their name.
[root@server asterisk-11.X.Y]# lsmod | grep dahdi
If the command returns nothing, then DAHDI has not been started. Start DAHDI by running:
[root@server asterisk-11.X.Y]# /etc/init.d/dadhi start
Different Methods for Starting Initscripts
Icon
Many Linux distributions have different methods for starting initscripts. On most Red Hat based distributions (such as Red Hat Enterprise Linux, Fedora, and CentOS) you can run:
[root@server asterisk-11.X.Y]# service dahdi start
Distributions based on Debian (such as Ubuntu) have a similar command, though it's not commonly used:
[root@server asterisk-11.X.Y]# invoke-rc.d dahdi start
If you have DAHDI running, the output of lsmod | grep dahdi should look something like the output below. (The exact details may be different, depending on which DAHDI modules have been built, and so forth.)
[root@server asterisk-11.X.Y]# lsmod | grep dahdi
dahdi_transcode  7928 1 wctc4xxp
dahdi_voicebus  40464 2 wctdm24xxp,wcte12xp
dahdi          196544 12 wctdm24xxp,wcte11xp,wct1xxp,wcte12xp,wct4xxp
crc_ccitt        2096 1 dahdi
Now that DAHDI is running, you can run dahdi_hardware to list any DAHDI-compatible devices in your system. You can also run the dahdi_tool utility to show the various DAHDI-compatible devices, and their current state.
To check if Asterisk is running, you can use the Asterisk initscript.
[root@server asterisk-11.X.Y]# /etc/init.d/asterisk status
asterisk is stopped
To start Asterisk, we'll use the initscript again, this time giving it the start action:
[root@server asterisk-11.X.Y]# /etc/init.d/asterisk start
Starting asterisk:
When Asterisk starts, it runs as a background service (or daemon), so you typically won't see any response on the command line. We can check the status of Asterisk and see that it's running using the command below. (The process identifier, or pid, will obviously be different on your system.)
[root@server asterisk-11.X.Y]# /etc/init.d/asterisk status
asterisk (pid 32117) is running...
And there you have it! You've compiled and installed Asterisk, DAHDI, and libpri from source code.



Asterisk Packages

1. Introduction

Installing a binary distribution of Asterisk makes it easier to maintain your system. Using the package management tools that are included with your Linux distribution, you can install and update software without manually managing dependencies (libraries and utilities on which applications rely).
Currently Asterisk is available for automated binary installation using the YUM utility on CentOS 6 Linux and RedHat Enterprise Linux 6.

2. YUM (CentOS 6 / Red Hat Enterprise Linux 6)

2.1. Active Repositories

All YUM repositories for Asterisk and non-commercial modules/dependencies are available at http://packages.asterisk.org/.
Repository
Definition
Contents
asterisk-1.8
centos-asterisk-1.8
Asterisk 1.8
asterisk-1.8-certified
centos-asterisk-1.8-certified
Certified Asterisk 1.8
asterisk-11
centos-asterisk-11
Asterisk 11
asterisk-12
centos-asterisk-12
Asterisk 12
asterisk-current, asterisk-beta
centos-asterisk
Beta releases, Asterisk dependencies (including DAHDI), Asterisk sound packs
Icon
Some versions of Asterisk will have dependencies on packages that may not be typically available on all versions of CentOS/RHEL. Packages for these dependencies are available via the centos-asterisk repository; hence, it is always recommended to add the centos-asterisk repository definition.
All YUM repositories for DAHDI firmware and commercial modules are available at http://packages.digium.com/.

2.2. Adding the repository

There are two ways to add a repository to your system:
1.    Manually, by downloading/copying the appropriate centos-asterisk* repository definition to /etc/yum.repos.d
2.    Automatically via the asterisknow-version RPM. This RPM will automatically add all supported Asterisk repos to YUM, as well as the repos fromhttp://packages.digium.com for DAHDI firmware and commercial modules.
# rpm -Uvh http://packages.asterisk.org/centos/6/current/i386/RPMS/asterisknow-version-3.0.1-2_centos6.noarch.rpm
# yum update

2.3. Installing

2.3.1. Asterisk

Each major version of Asterisk has its own repository. Within the repository, there are many different packages available for Asterisk. Different packages will install Asterisk with different modules enabled, such as ODBC voicemail.
By default, the various Asterisk repositories are disabled. This allows you to have multiple Asterisk repository definitions installed on a single machine, and to choose which major version of Asterisk you'd like to install when running yum install.
Installing Asterisk 11
# yum install asterisk asterisk-configs --enablerepo=asterisk-11

2.3.2. DAHDI

Packages for DAHDI are supplied via the centos-asterisk repository.
Installing DAHDI
# yum install dahdi-linux dahdi-tools libpri
Icon
If you are installing from local files and not using the repos installed above then it's worth noting that the dahdi-firmware files - among others - are hosted at http://packages.digium.com due to licensing. You may need to install the repository definitions from that location to obtain all of the packages needed for DAHDI.

2.4. Upgrading

Upgrading can be done simply by running yum update:
# yum update

Historical Packaging Information

At one time, Asterisk packages were also available for Ubuntu. Currently, packages are not being made by the Asterisk project for this distribution. Information detailing the Ubuntu build environment has been moved onto this page for historical purposes.

Create a Build Environment

Install Ubuntu 10.04 (Lucid)

Enable Backports

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository "deb http://ca.archive.ubuntu.com/ubuntu/ $(lsb_release --short --codename)-backports main universe"

Upgrade Lucid to the latest release:

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get autoremove
$ sudo reboot

Install required software

$ sudo apt-get install build-essential pbuilder debian-archive-keyring ccache

pbuilder

$ sudo mkdir -p /var/cache/pbuilder/ccache
$ sudo mkdir -p /var/cache/pbuilder/hook.d
$ sudo vi /etc/pbuilder/pbuilderrc
/etc/pbuilder/pbuilderrc
export CCACHE_DIR="/var/cache/pbuilder/ccache"
export PATH="/usr/lib/ccache:${PATH}"
EXTRAPACKAGES="ccache"
BINDMOUNTS="${CCACHE_DIR}"

# Codenames for Debian suites according to their alias. Update these when
# needed.
UNSTABLE_CODENAME="sid"
TESTING_CODENAME="wheezy"
STABLE_CODENAME="squeeze"
OLDSTABLE_CODENAME="lenny"
STABLE_BACKPORTS_SUITE="$STABLE_CODENAME-backports"
  
# List of Debian suites.
DEBIAN_SUITES=($UNSTABLE_CODENAME $TESTING_CODENAME $STABLE_CODENAME $OLDSTABLE_CODENAME
    "unstable" "testing" "stable" "oldstable")
  
# List of Ubuntu suites. Update these when needed.
UBUNTU_SUITES=("oneiric" "natty" "maverick" "lucid")
  
# Mirrors to use. Update these to your preferred mirror.
DEBIAN_MIRROR="ftp.us.debian.org"
UBUNTU_MIRROR="mirrors.kernel.org"
  
# Optionally use the changelog of a package to determine the suite to use if
# none set.
if [ -z "${DIST}" ] && [ -r "debian/changelog" ]; then
    DIST=$(dpkg-parsechangelog | awk '/^Distribution: / {print $2}')
    # Use the unstable suite for certain suite values.
    if $(echo "experimental UNRELEASED" | grep -q $DIST); then
        DIST="$UNSTABLE_CODENAME"
    fi
fi
  
# Optionally set a default distribution if none is used. Note that you can set
# your own default (i.e. ${DIST:="unstable"}).
: ${DIST:="$(lsb_release --short --codename)"}
  
# Optionally change Debian release states in $DIST to their names.
case "$DIST" in
    unstable)
        DIST="$UNSTABLE_CODENAME"
        ;;
    testing)
        DIST="$TESTING_CODENAME"
        ;;
    stable)
        DIST="$STABLE_CODENAME"
        ;;
    oldstable)
        DIST="$OLDSTABLE_CODENAME"
        ;;
esac
  
# Optionally set the architecture to the host architecture if none set. Note
# that you can set your own default (i.e. ${ARCH:="i386"}).
: ${ARCH:="$(dpkg --print-architecture)"}
  
NAME="$DIST"
if [ -n "${ARCH}" ]; then
    NAME="$NAME-$ARCH"
    DEBOOTSTRAPOPTS=("--arch" "$ARCH" "${DEBOOTSTRAPOPTS[@]}")
fi

DEBBUILDOPTS="-b"
if [ "${ARCH}" == "i386" ]; then
    DEBBUILDOPTS="-B"
fi

BASETGZ="/var/cache/pbuilder/$NAME-base.tgz"
# Optionally, set BASEPATH (and not BASETGZ) if using cowbuilder
# BASEPATH="/var/cache/pbuilder/$NAME/base.cow/"
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/$NAME/result/"
APTCACHE="/var/cache/pbuilder/$NAME/aptcache/"
BUILDPLACE="/var/cache/pbuilder/build/"
  
if $(echo ${DEBIAN_SUITES[@]} | grep -q $DIST); then
    # Debian configuration
    MIRRORSITE="http://$DEBIAN_MIRROR/debian/"
    COMPONENTS="main contrib non-free"
    DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/debian-archive-keyring.gpg")
elif $(echo ${UBUNTU_SUITES[@]} | grep -q $DIST); then
    # Ubuntu configuration
    MIRRORSITE="http://$UBUNTU_MIRROR/ubuntu/"
    COMPONENTS="main universe"
    DEBOOTSTRAPOPTS=("${DEBOOTSTRAPOPTS[@]}" "--keyring=/usr/share/keyrings/ubuntu-archive-keyring.gpg")
else
    echo "Unknown distribution: $DIST"
    exit 1
fi

Debian

$ for x in unstable testing stable; do for y in i386 amd64; do sudo DIST=${x} ARCH=${y} pbuilder create; done; done

Ubuntu

$ for x in lucid maverick natty; do for y in i386 amd64; do sudo DIST=${x} ARCH=${y} pbuilder create; done; done

svn-buildpackage

$ vi ~/.svn-buildpackage.conf
svn-builder=debuild
svn-noautodch

quilt

$ vi ~/.quiltrc
QUILT_PATCHES="debian/patches"

QUILT_PATCH_OPTS="--unified-reject-files"
QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
QUILT_DIFF_OPTS="--show-c-function"
QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"

devscripts

$ vi ~/.devscripts
DEBCHANGE_RELEASE_HEURISTIC=changelog
DEBCHANGE_MULTIMAINT_MERGE=yes
DEBCHANGE_MAINTTRAILER=no
DEBUILD_ROOTCMD=fakeroot
DEBUILD_LINTIAN=yes
DEBUILD_LINDA=yes
DEFAULT_DEBRELEASE_DEBS_DIR=../build-area/
USCAN_DESTDIR=../tarballs
$ vi ~/.bashrc
export DEBFULLNAME='Paul Belanger'
export DEBEMAIL='pabelanger@digium.com'
export GPGKEY=8C3B0FA6
export EDITOR=vi

Updating an Ubuntu Package

New upstream release

Checkout source

$ mkdir -p ~/digium
$ cd ~/digium
$ svn http://blah.org/svn/blah

Upstream tarball

$ uscan --verbose

Update the changelog file

$ dch -e

Update patches

$ while quilt push; do quilt refresh; done

Release package

$ dch -r

Build package source

$ svn-buildpackage -S

Compile package

$ dput ppa:pabelanger/testing ../build-area/*.changes

rebuildd

Introduction

Getting started

sudo apt-get install rebuildd reprepro apache2

reprepro

$ sudo adduser --system --shell /bin/bash --gecos 'Reprepro Daemon' --group --disabled-password reprepro
$ sudo su reprepro

$ cd ~
$ mkdir bin conf incoming
$ vi ~/conf/distributions
distributions
Suite: lucid-proposed
Version: 10.04
Codename: lucid-proposed
Architectures: i386 amd64 source
Components: main
SignWith: yes
Log: logfile
  --changes ~/bin/build_sources
$ vi ~/conf/incoming
incoming
Name: incoming
IncomingDir: incoming
Allow: lucid-proposed
Cleanup: on_deny on_error
TempDir: tmp
$ vi ~/conf/apache.conf
apache.conf
Alias /debian /home/reprepro/
<Directory /home/reprepro>
        Options +Indexes
        AllowOverride None
        order allow,deny
        allow from all
</Directory>
$ vi ~/bin/build_sources

#!/bin/bash
  
action=$1
release=$2
package=$3
version=$4
changes_file=$5
  
# Only care about packages being added
if [ "$action" != "accepted" ]
then
    exit 0
fi
  
# Only care about source packages
echo $changes_file | grep -q _source.changes
if [ $? = 1 ]
then
    exit 0
fi
  
# Kick off the job
echo "$package $version 1 $release"  | sudo rebuildd-job add
$ reprepro -V -b . createsymlinks
$ reprepro -V -b . processincoming incoming

$ exit

rebuildd

$ sudo vi /etc/default/rebuildd
START_REBUILDD=1
START_REBUILDD_HTTPD=1
DISTS="lucid"

Working with Source Packages


$ sudo apt-get build-dep asterisk
$ DEB_BUILD_OPTIONS="debug" apt-get -b source asterisk


Asterisk on (Open)Solaris

·          
·         Created by Ben Klang, last modified by Malcolm Davenport on Feb 24, 2011

Asterisk on Solaris 10 and OpenSolaris

On this page
·         Digium's Support Status
·         Build Notes
·         Prerequisites
·         LDAP dependencies
·         Makefile layouts
·         FAX support with SpanDSP
·         Gotchas
·         Runtime issues
·         Build issues

Digium's Support Status

According to the README file from 1.6.2: "Asterisk has also been 'ported' and reportedly runs properly on other operating systems as well, including Sun Solaris, Apple's Mac OS X, Cygwin, and the BSD variants." Digium's developers have also been doing a good job of addressing build and run-time issues encountered with Asterisk on Solaris.

Build Notes

Prerequisites

The following packages are recommend for building Asterisk 1.6 and later on OpenSolaris:
·         SUNWlibm (math library)
·         gcc-dev (compiler and several dependencies)
·         SUNWflexlex (GNU flex)
·         SUNWggrp (GNU grep)
·         SUNWgsed (GNU sed)
·         SUNWdoxygen (optional; needed for "make progdocs")
·         SUNWopenldap (optional; needed for res_config_ldap; see below)
·         SUNWgnu-coreutils (optional; provides GNU install; see below)
Caution: installing SUNW gnu packages will change the default application run when the user types 'sed' and 'grep' from /usr/bin/sed to /usr/gnu/bin/sed. Just be aware of this change, as there are differences between the Sun and GNU versions of these utilities.

LDAP dependencies

Because OpenSolaris ships by default with Sun's LDAP libraries, you must install the SUNWopenldap package to provide OpenLDAP libraries. Because of namespace conflicts, the standard LDAP detection will not work.
There are two possible solutions:
1.    Port res_config_ldap to use only the RFC-specified API. This should allow it to link against Sun's LDAP libraries.
·         The problem is centered around the use of the OpenLDAP-specific ldap_initialize() call.
2.    Change the detection routines in configure to use OpenSolaris' layout of OpenLDAP.
·         This seems doubtful simply because the filesystem layout of SUNWopenldap is so non-standard.
Despite the above two possibilities, there is a workaround to make Asterisk compile with res_config_ldap.
·         Modify the "configure" script, changing all instances of "-lldap" to "-lldap-2.4".
·         At the time of this writing there are only 4 instances. This alone will make configure properly detect LDAP availability. But it will not compile.
·         When running make, specify the use of the OpenLDAP headers like this:
·         "make LDAP_INCLUDE=-I/usr/include/openldap"

Makefile layouts

This has been fixed in Asterisk 1.8 and is no longer an issue.
In Asterisk 1.6 the Makefile overrides any usage of --prefix. I suspect the assumptions are from back before configure provided the ability to set the installation prefix. Regardless, if you are building on OpenSolaris, be aware of this behavior of the Makefile!
If you want to alter the install locations you will need to hand-edit the Makefile. Search for the string "SunOS" to find the following section:
# Define standard directories for various platforms
# These apply if they are not redefined in asterisk.conf
ifeq ($(OSARCH),SunOS)
  ASTETCDIR=/etc/asterisk
  ASTLIBDIR=/opt/asterisk/lib
  ASTVARLIBDIR=/var/opt/asterisk
  ASTDBDIR=$(ASTVARLIBDIR)
  ASTKEYDIR=$(ASTVARLIBDIR)
  ASTSPOOLDIR=/var/spool/asterisk
  ASTLOGDIR=/var/log/asterisk
  ASTHEADERDIR=/opt/asterisk/include/asterisk
  ASTBINDIR=/opt/asterisk/bin
  ASTSBINDIR=/opt/asterisk/sbin
  ASTVARRUNDIR=/var/run/asterisk
  ASTMANDIR=/opt/asterisk/man
else
Note that, despite the comment, these definitions have build-time and run-time implications. Make sure you make these changes BEFORE you build!

FAX support with SpanDSP

I have been able to get this to work reliably, including T.38 FAX over SIP. If you are running Asterisk 1.6 note Ticket 16342 if you do not install SpanDSP to the default locations (/usr/include and /usr/lib).
There is one build issue with SpanDSP that I need to document (FIXME)

Gotchas

Runtime issues

·         WAV and WAV49 files are not written correctly (see Ticket 16610)
·         32-bit binaries on Solaris are limited to 255 file descriptors by default. (see http://developers.sun.com/solaris/articles/stdio_256.html)

Build issues

·         bootstrap.sh does not correctly detect OpenSolaris build tools (see Ticket 16341)
·         Console documentation is not properly loaded at startup (see Ticket 16688)
·         Solaris sed does not properly create AEL parser files (see Ticket 16696; workaround is to install GNU sed with SUNWgsed)
·         Asterisk's provided install script, install-sh, is not properly referenced in the makeopts file that is generated during the build. One workaround is to install GNU install from the SUNWgnu-coreutils package. (See Ticket 16781)
Finally, Solaris memory allocation seems far more sensitive than Linux. This has resulted in the discovery of several previously unknown bugs related to uninitialized variables that Linux handled silently. Note that this means, until these bugs are found and fixed, you may get segfaults.
At the time of this writing I have had a server up and running reasonably stable. However, there are large sections of Asterisk's codebase I do not use and likely contain more of these uninitialized variable problems and associated potential segfaults.


Easy Way to Handle Android Notifications

Android Notifications Android Toast class provides a handy way to show users alerts but problem is that these alerts are not persist...