Friday, October 1, 2010

Building Asterisk on MacOSX

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


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)

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.
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.asteriskat a Terminal prompt. Disabled Label com.asterisk.org.asterisk ProgramArguments /usr/local/asterisk/sbin/asterisk -f UserName asterisk GroupName asterisk OnDemand ServiceDescription Asterisk PBXN.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 sizeheight 60 80# Enable multi-user modemultiuser on# List all the users who should have access to the console hereacladd barneyacladd jeffacladd joeNext, alter the asterisk.plist file by changing the ProgramArguments section to read
ProgramArguments /usr/bin/screen -D -m -c /usr/local/asterisk/etc/screenrc /usr/local/asterisk/sbin/asterisk -vcThis 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. 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

No comments:

Post a Comment