Installing Asterisk and Adhearsion on OSX Snow Leopard

Alex Egg,

This page will guide you though the process needed to get Asterisk/Adhearsion installed on Mac OS X Snow Leopard.



I am using the Homebrew package manager for OS X (  ). (As of the publishing of this page) We need to update the brew asterisk recipe to create some asterisk config files:

brew edit asterisk

And then add system "make samples" after the system "make install" line. Save the file then run install command to build and install asterisk.

brew install asterisk

(if you see erros about sqlite, just uninstall it and then install asterisk and reinstall sqlite)

Build by hand

Optionally to install it yourself. Assuming you have your mac setup to build projects, the build is simple - just do this:

sudo make install
make samples

This worked w/o problem on my Snow Leopard (10.6.6) system.

Start Asterisk

Let’s check if the install was successful but starting asterisk. 

$ sudo asterisk
Mac OS X detected.  Use 'launchctl load /Library/LaunchDaemon/org.asterisk.asterisk.plist'.
NOTICE[78929]: cdr.c:1449 do_reload: CDR simple logging enabled.
NOTICE[78929]: loader.c:999 load_modules: 141 modules will be loaded.
NOTICE[78929]: res_odbc.c:235 load_odbc_config: Adding ENV var: INFORMIXSERVER=my_special_database
NOTICE[78929]: res_odbc.c:235 load_odbc_config: Adding ENV var: INFORMIXDIR=/opt/informix
NOTICE[78929]: res_odbc.c:737 load_module: res_odbc loaded.
WARNING[78929]: res_smdi.c:1364 load_module: No SMDI interfaces are available to listen on, not starting SMDI listener.
NOTICE[78929]: pbx_ael.c:4516 pbx_load_module: Starting AEL load process.
NOTICE[78929]: pbx_ael.c:4523 pbx_load_module: AEL load process: calculated config file name '/usr/etc/asterisk/extensions.ael'.
NOTICE[78929]: pbx_ael.c:4531 pbx_load_module: AEL load process: parsed config file name '/usr/etc/asterisk/extensions.ael'.
NOTICE[78929]: pbx_ael.c:4534 pbx_load_module: AEL load process: checked config file name '/usr/etc/asterisk/extensions.ael'.
NOTICE[78929]: pbx_ael.c:4540 pbx_load_module: AEL load process: compiled config file name '/usr/etc/asterisk/extensions.ael'.
NOTICE[78929]: pbx_ael.c:4543 pbx_load_module: AEL load process: merged config file name '/usr/etc/asterisk/extensions.ael'.
NOTICE[78929]: pbx_ael.c:4546 pbx_load_module: AEL load process: verified config file name '/usr/etc/asterisk/extensions.ael'.
NOTICE[78929]: config.c:1278 ast_config_engine_register: Registered Config Engine odbc
ERROR[78929]: res_config_pgsql.c:813 pgsql_reconnect: Postgresql RealTime: Failed to connect database server asterisk on Check debug for more info.
WARNING[78929]: res_config_pgsql.c:636 load_module: Postgresql RealTime: Couldn't establish connection. Check debug.
NOTICE[78929]: config.c:1278 ast_config_engine_register: Registered Config Engine pgsql
The above is sample output from my system - it was able to start. Now let's move on to configure and test our installation.


Configure Asterisk

Worked without a hitch. Now I just need to get it going. In order to use asterisk I suggest you download X-Lite soft phone.

Now add this to the /usr/etc/asterisk/sip.conf - this is the account we will use to connect to asterisk w/ the soft phone. The username is phone1 and the password is pass. Also pay attention to the context directive. This is a reference to the extensions.conf file.


Then install the x-lite soft phone software and in Pref > accs add a user w/ those creds. x-lite should then be able to connect w/ asterisk and youre done w/ the asterisk install on osx snow leopard.

Add this to your extensions.conf file to test the system.

extension 8888 play 'hello-world'

Then in the soft phone when you call 8888 the asterisk system will play a hello world sound clip

The next step would be to install adhearsion gem.


Install Adhearsion

Adhearsion is a convenient Asterisk biding for ruby. At the time writing this the lib has issues with ruby 1.9 ( I am working on patching this) so we must use ruby 1.8. Install is simple:

gem install adhearsion

Create an adhearsion project:

adh create adh_project

Let’s test the system w/ a default adhearsion program called simeon. We first must route a call from asterisk to adhearsion by adding this directive to the extensions.conf file:

exten =&gt; 8000,1,AGI(agi://</div>

Then call 8000 on your soft phone and there you have it ruby is talking to the phone!

Thanks to the ruby to phone network bridge asterisk we now can do some cool things like call real phones.

&nbsp; <script type="text/javascript"><!-- google_ad_client = "ca-pub-3516463588465612"; /* test unit */ google_ad_slot = "6759898634"; google_ad_width = 125; google_ad_height = 125; //--> </script><script type="text/javascript" src=""> </script><div id="disqus_thread">
&nbsp;</div> <script type="text/javascript"> /** * var disqus_identifier; [Optional but recommended: Define a unique identifier (e.g. post id or slug) for this thread] */ (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = ''; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script>

Permalink: installing-asterisk-on-osx

Tags: asterisk, adhearsion, robodialer, ruby, freepbx, pbx

Last edited by Alex Egg, 2011-06-10 15:54:48
View Revision History