To use Asterisk with Adhearsion you must be using Asterisk version 1.8.4 or later. If you do not know which version to pick, we strongly recommend choosing a Long Term Support, or "LTS", release. LTS releases are supported by Digium for a much longer period of time and are appropriate for production deployment. At the time of this writing Asterisk 1.8 is the current LTS release and the next LTS release, Asterisk 11, is in beta.
For many platforms the easiest way to install Asterisk is to use the packages provided by your operating system or distribution. At the time of this writing, the following Linux distributions provide a suitable version of Asterisk for use with Adhearsion 2.0:
In addition to the vendor-provided packages above, Digium provides packages for several common distributions:
If you are not able to obtain packages for your operating system, Asterisk can be compiled on many additional platforms, including FreeBSD, Mac OSX and even Solaris. Please see the Asterisk installation documentation for further information.
It is necessary to configure an AMI user by which Adhearsion can connect to Asterisk. This can be done in /etc/asterisk/manager.conf
, and a sample configuration is provided below:
[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
[myuser]
secret = mypassword
read = all
write = all
eventfilter = !Event: RTCP*
eventfilter = !Variable: RTPAUDIOQOS*
Note that the user needs acess to all AMI events and actions. Also, we have setup an event filter here to prevent sending Adhearsion RTCP and QOS events. This is optional, but recommended, because while Asterisk generates a great number of these events Adhearsion cannot normally do anything useful with them. Thus, we can improve Adhearsion's performance by not sending it these events in the first place.
To process calls with Adhearsion they must be routed through AsyncAGI. Add the following contexts your /etc/asterisk/extensions.conf
:
[adhearsion]
exten => _X.,1,AGI(agi:async)
[adhearsion-redirect]
exten => 1,1,AGI(agi:async)
This will route all calls that hit the "adhearsion" context to your Adhearsion application. To get calls into the "adhearsion" context, you should configure your SIP peers or Dahdi or other channels to have "context=adhearsion" in their configuration. Please consult the Asterisk documentation for more information on setting up peers and channels.
As always the full list of configuration options can be viewed, along with a description and their default values, by typing rake config:show
in your application directory. There are a few configuration options that are particularly important:
:asterisk
config.punchblock.media_engine
appropriately. Common values for use with Asterisk are :unimrcp
or :swift
.Note that as described in our Deployment Best Practices, we recommend NOT storing the AMI username and password in the config/adhearsion.rb file. Instead these should be stored in environment variables (notably: AHN_PUNCHBLOCK_USERNAME
and AHN_PUNCHBLOCK_PASSWORD
) that are loaded by the process prior to launching.
If you need help configuring Asterisk there are several resources available: