OSX Howto

How To Build CallWeaver On Mac OS X

This process has been tested on OS X 10.5.2 (Leopard) on Intel Core2 Duo. It installs everything into /usr/local/callweaver.

Here’s the short version.

  1. Set up the callweaver user and group
  2. Build and install tiff.
  3. Build and install readline.
  4. Build and install speex.
  5. Build and install spandsp.
  6. Build and install CallWeaver.
  7. Add sound files

User Setup

The following script creates a user and a group named callweaver. This is the user that the process will run as. Copy the following script to a file named usersetup.sh and then run it as root. “dscl” is the OS X 10.5 command line script to manage the local directory service. For earlier versions of OS X, “niutil” should be used.

usersetup.sh:

dscl . -create /Groups/callweaver
dscl . -create /Groups/callweaver PrimaryGroupID 1000
dscl . -create /Groups/callweaver RealName "CallWeaver" 
dscl . -create /Groups/callweaver Password '*'
dscl . -create /Users/callweaver
dscl . -create /Users/callweaver UserShell /bin/bash
dscl . -create /Users/callweaver RealName "CallWeaver" 
dscl . -create /Users/callweaver UniqueID 1000
dscl . -create /Users/callweaver PrimaryGroupID 1000
dscl . -create /Users/callweaver Password '*'
dscl . -append /Groups/callweaver GroupMembership callweaver

Run it like this.

% sudo sh usersetup.sh

Setup target directory

% mkdir -p /usr/local/callweaver

Installing Tiff

Get tiff-3.8.2 and save it to ~/Download.

% mkdir ~/Download/src
% cd ~/Download/src
% tar zvxf ../tiff-3.8.2.tar.gz
% cd tiff-3.8.2
% ./configure --prefix=/usr/local/callweaver CFLAGS=-I/usr/local/callweaver/include LDFLAGS=-L/usr/local/callweaver/lib
% make
% sudo make install

Installing Readline

Go to http://tiswww.case.edu/php/chet/readline/rltop.html and download “readline-5.2” and save it to ~/Download.

% mkdir ~/Download/src
% cd ~/Download/src
% tar zvxf ../readline-5.2.tar.gz
% cd readline-5.2

edit readline-5.2/support/shobj-conf using vi or some other favourite editor

change line 142 from darwin8*) to darwin89*)
change line 171 from darwin[ 78]*) to darwin[ 789]*) - note remove whitespace between brackets
% ./configure --prefix=/usr/local/callweaver CFLAGS=-I/usr/local/callweaver/include LDFLAGS=-L/usr/local/callweaver/lib
% make
% sudo make install

Installing Speex

Get speex1.2beta2 and save it to ~/Download.

% tar zvxf ../speex-1.2beta2.tar.gz
% cd speex-1.2beta2
% ./configure --prefix=/usr/local/callweaver CFLAGS=-I/usr/local/callweaver/include LDFLAGS=-L/usr/local/callweaver/lib
% make
% sudo make install

Installing Spandsp

Get spandsp-0.0.5 and save it to ~/Download.

% tar zvxf ../spandsp-0.0.5pre3.tgz
% cd spandsp-0.0.5
% ./configure --prefix=/usr/local/callweaver CFLAGS="-I/usr/local/callweaver/include -O2" LDFLAGS=-L/usr/local/callweaver/lib
% make
% sudo make install

Installing CallWeaver

Get the Callweaver 1.2.0.1 release and save it to ~/Download.

% cd ~/Download/src
% tar zvxf ../callweaver-1.2.0.1.tgz
% cd callweaver-1.2.0.1
% ./configure --prefix=/usr/local/callweaver CFLAGS=-I/usr/local/callweaver/include LDFLAGS=-L/usr/local/callweaver/lib
% make
% sudo make install

Adding the Sounds

Download the sound files and copy them to the /usr/local/callweaver/share/callweaver/sounds directory. They are not included in the source code package.

Running CallWeaver

Manual Startup

First, try starting the server from the command line.

% sudo /usr/local/callweaver/libexec/callweaver -v

You can now connect with the console.

% sudo /usr/local/callweaver/libexec/callweaver -rvvv

To stop callweaver from the console, give it the ‘stop now’ command.

Automatic Startup

If you want CallWeaver to start automatically on reboot, copy the following file into /Library/LaunchDaemons (for OS X 10.4 or later).

/Library/LaunchDaemons/org.callweaver.CallWeaver.plist:

<?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>org.callweaver.CallWeaver</string>
    <key>OnDemand</key>
    <false/>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/callweaver/libexec/callweaver</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Next time you reboot, it will run automatically. To launch it for the first time, load the file and start it with launchctl.

% sudo launchctl load /Library/LaunchDaemons/org.callweaver.CallWeaver.plist
% sudo launchctl start org.callweaver.CallWeaver

If you want callweaver to stay stopped, edit org.callweaver.CallWeaver.plist and change “Disabled” from “false” to “true”. Then reload the file with launchctl.