login | register
Tue 02 of Dec, 2008 [13:17 UTC]

voip-info.org

Building Asterisk on MacOSX

Created by: STS,Last modification on Tue 01 of Jan, 2008 [20:00 UTC] by purecanesugar

Getting MacOSX Developer tools

If you want to build Asterisk yourself, you will need to get CVS and GCC installed on your Mac. To do this you must install Apple's Xcode Tools on your system. The Xcode Tools are part of the MacOSX Panther installation CD set and they are also on the Tiger installation DVD. However, you can also download them from Apple's Xcode Tools Download site. Note: On MacOSX "Jaguar" (ver 10.2) these tools were called Apple Developer Tools.

Cookbook for Asterisk 1.2.1 on Panther or Tiger

I have just installed and/or upgraded Asterisk 1.0.7 to Asterisk 1.2.1 (currently the latest version) on both Panther and Tiger. The installation "from scratch" was trivially easy. But in addition, I'm running a production Asterisk home-based system with some 25 trunking and peering relationship and many stations and a very complicated dialplan, and the upgrade was not particularly painful. Rather than replacing all of this much older information, I've written a completely new page Cookbook for Installing or Upgrading Asterisk 1.2.1 on Mac OSX Panther and Tiger

Upgrading Bison

After you have installed Xcode or Developer Tools, you will need to upgrade bison. Bison 1.75 is recommended.
  • Download Bison 1.75 - Download link
  • Open a new shell window in Terminal
  • Assuming your bison package was downloaded and extracted to a folder named Downloads inside your home folder, do the following...
  • cd ~/Downloads/bison-1.75
  • ./configure (or "./configure --prefix=/usr" ... see below)
  • make
  • sudo make install
  • Verify the installation with the following command ...
  • bison --version
  • it should show something like "bison (GNU Bison) 1.75"
If you dont get the right version, it means that your path probably includes /usr/bin before /usr/local/bin, and you are getting the (older) version that is in /usr/bin. You can avoid this by using the "--prefix" option to configure (above) and it will replace your older version of bison in /usr/bin/bison.

Follow the build instructions

You are now ready to build Asterisk following the instructions on the Asterisk download page. This no longer goes anywhere pertinent, someone needs to fix it.

In the meantime, I found these:


Starting Asterisk automatically during system startup


There are two methods through which software can be started automatically during system startup:
  • Startup Items (available on MacOS X versions 10.2, 10.3 and 10.4)
  • Launchd Service (available on MacOS X version 10.4 only)

Using Startup Items


When using the Asterisk build and/or Asterisk Launcher from Sunrise Ltd., a startup item for Asterisk will automatically be installed and it can be enabled and disabled using Asterisk Launcher. Since these tools are meant to work at least on the current and the previous MacOS X version, launchd will not be used before the release of MacOS X 10.5.

Using launchd (on Mac OS X 10.4 only)


On Mac OS X 10.4 and later, you may manually install a launchd service to start Asterisk. To do this, put the text below in a file called /Library/LaunchDaemons/org.asterisk.asterisk.plist, create a user and group called asterisk (if you don't do this, Asterisk is running as root; this is undesirable because a bug in Asterisk could then provide hackers with root access to your machine), then do the following
  $ sudo launchctl
  launchd% load /Library/LaunchDaemons
  launchd% start org.asterisk.asterisk
at a Terminal prompt.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Disabled</key>
        <false/>
        <key>Label</key>
        <string>com.asterisk.org.asterisk</string>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/asterisk/sbin/asterisk</string>
                <string>-f</string>
        </array>
        <key>UserName</key>
        <string>asterisk</string>
        <key>GroupName</key>
        <string>asterisk</string>
        <key>OnDemand</key>
        <false/>
        <key>ServiceDescription</key>
        <string>Asterisk PBX</string>
</dict>
</plist>
N.B. In this example, Asterisk is installed in /usr/local/asterisk. If you built Asterisk from scratch and didn't change the Makefile, this is probably not where it is, so you will have to change the line in the ProgramArguments section to match your installation.

It it also sometimes useful to configure things so that the Asterisk console is redirected using screen; to do that, create a file called screenrc in some directory on your system (in this example, we put it in /usr/local/asterisk/etc/screenrc, but you can put it in any convenient location). Then in the file, write the following:
#
# screenrc file used for Asterisk console
#

# Screen size
height 60 80

# Enable multi-user mode
multiuser on

# List all the users who should have access to the console here
acladd barney
acladd jeff
acladd joe
Next, alter the asterisk.plist file by changing the ProgramArguments section to read
        <key>ProgramArguments</key>
        <array>
                <string>/usr/bin/screen</string>
                <string>-D</string>
                <string>-m</string>
                <string>-c</string>
                <string>/usr/local/asterisk/etc/screenrc</string>
                <string>/usr/local/asterisk/sbin/asterisk</string>
                <string>-vc</string>
This will automatically start Asterisk inside a screen session; if you are one of the users listed in the acladd commands at the end of the screenrc file, you can connect to Asterisk's console by entering
  $ screen -r asterisk/
at a shell prompt. The benefit of using screen is that you can see the recent messages output by Asterisk on the console, whereas connecting using Asterisk's own built-in support will create a new console.

How you can contribute to this Wiki

  • Please add your comments on how you were able to get Asterisk installed, stating the versions for both Asterisk and MacOSX.

Asterisk | Asterisk MacOSX Support

Comments

Comments Filter
222

333Re: Using StartupItems instead of launchctl

by purecanesugar, Tuesday 01 of January, 2008 [23:07:46 UTC]
You should probably use /Library/StartupItems instead of /System/Library/StartupItems in the aststart.sh script, since the /System folder is meant to be only the Apple stuff that comes with Mac OS X.
222

333Using StartupItems instead of launchctl

by troykelly, Wednesday 20 of December, 2006 [05:55:46 UTC]
I have had to use StartupItems over launchctl because they honor dependencies. Asterisk was always trying to start before MySQL with the setup from the article above.

create a file call aststart.sh
put the content below in it...
then chmod 750 ./aststart.sh
and then run it by typing ./aststart.sh
NOTE This startup script assumes many things, most important of which is that you are not running asterisk as root. If you are - you will need to modify the resulting files.

======ASTSTART.SH======
#!/bin/bash
mkdir -p /System/Library/StartupItems/Asterisk
cd /System/Library/StartupItems/Asterisk
curl -O http://purpleoranges.com/asterisk/osx/asterisk_startup.txt
curl -O http://purpleoranges.com/asterisk/osx/startupparameters_plist.txt
mv /System/Library/StartupItems/Asterisk/asterisk_startup.txt /System/Library/StartupItems/Asterisk/Asterisk
mv /System/Library/StartupItems/Asterisk/startupparameters_plist.txt /System/Library/StartupItems/Asterisk/StartupParameters.plist
chmod 755 /System/Library/StartupItems/Asterisk/Asterisk
chmod 644 /System/Library/StartupItems/Asterisk/StartupParameters.plist
echo -------------
echo You will need to edit /etc/hostconfig and add the line
echo ASTERISK=-YES-
echo if you want Asterisk to automatically start at boot.
echo
echo Please note, this will start asterisk using the user "asterisk"
echo \ and the group "asterisk". If your system is not set-up to work
echo \ like that - then you will need to modify the files in
echo \ /System/Library/StartupItems/Asterisk
echo \ to match your configuration.
echo

222

333OS X Users

by tyl3rb1ck, Saturday 14 of October, 2006 [23:40:35 UTC]
Hi can anyone explain how to create the user and group 'asterisk' in os X without it adding a full user account to the machine - if i make it in the Account pref pane i get a home folder etc, and cant figure netinfo.

222

333Re: OSX intel

by dbudic, Monday 24 of April, 2006 [21:54:37 UTC]
Got it, remember to compile and install "format_mp3" from the asterisk-addons package for your moh needs...
222

333OSX intel

by dbudic, Monday 24 of April, 2006 [17:25:34 UTC]
Yes, it works on OSX on an intel mac with 10.4.6, but:

1) wav and wav49 seem busted, use gsm for your vm and announcements
2) Still having trouble with moh, but I recall reading some stuff about it working and can't find it again, so I'm still hopeful...
222

333Macintel ?

by jcc, Sunday 05 of March, 2006 [23:44:42 UTC]
What about MacIntel ?
Is there anybody who tried ?