Building on FreeBSD

The FreeBSD port for sipXecs 3.10 is not yet finished. This page is work in progress. If you want to experiment with it you will find links to download a draft FreeBSD port for sipXecs 3.10. Mike Durian provided the original port of sipXecs 3.6 on FreeBSD that is available in the FreeBSD ports collection under net/sipx.... No port has been done so far for sipXecs 3.8. The port for sipXecs 3.10 is derived from that but because there are lots of new features since sipXecs release 3.6, the port is quite different. In addition, many of the patches necessary to port 3.6 were incorporated into the sipXecs code base and are therefore no longer needed.

The following was done using FreeBSD 6.2 installed from CD on i386 hardware.

Progress of the FreeBSD port activity is tracked in XECS-108. The most current FreeBSD port is attached to this issue.

Installation of FreeBSD 6.2

I picked a simple CD based install of a developer system. I gave the system a fixed IP address and registered the hostname with the local DNS server.

After installation:

pkg_add -r nano
pkg_add -r cvsup-without-gui

Update the ports collection:

Edit the file /usr/share/examples/cvsup/ports-supfile and replace CHANGE_THIS.FreeBSD.org to one of the FreeBSD mirror servers. Then run:

/usr/local/bin/cvsup -L 2 -h cvsup.FreeBSD.org /usr/share/examples/cvsup/ports-supfile

Building sipXecs 3.9.7 using a developer port

Release 3.9.7 is the developer release I used for this port. Once stable it will be called release 3.10.

cd /usr/ports/net/sipxpbx-devel
make install

This will take some time (measured in hours) as it pulls in and builds all of sipXecs and all its dependencies. The Java source files have to be manually copied to /usr/ports/distfiles as per the instructions in the error message that appears if they are not there.

If you see a gemNotFound Exception for the gem file-tail start the build again. This somehow never loads from rubyforge on first attempt.

Add the following lines to /etc/rc.conf:

postgresql_enable="YES"
apache2_enable="YES"
sipxpbx_enable="YES"
apache2_flags="-DSSL"
snmpd_enable="YES"
snmpd_flags="-a"
snmpd_conffile="/etc/snmpd.conf"
mrtg_daemon_enable="YES"

Update /usr/local/etc/apache2/httpd.conf:

User sipxchange
Group sipxchange

DocumentRoot /usr/local/www/sipX/doc

The <Directory > instance should match:
           ###<Directory "/usr/local/www">
           <Directory "/usr/local/www/sipX/doc">

Replace the standard ssl.conf file with the one for sipXecs:

<IfModule mod_ssl.c>
    ## Include /usr/local/etc/apache2/ssl.conf
    Include /usr/local/etc/sipxpbx/httpd-sipxchange-common-ssl.conf
</IfModule>

Add this line at the end:
Include /usr/local/etc/sipxpbx/httpd-sipxchange-common.conf

Update /usr/local/etc/odbcinst.ini

PostgreSQL
Description = PostgreSQL driver
Driver = /usr/local/lib/libodbcpsql.so
Setup = /usr/local/lib/libodbcpsqlS.so
FileUsage = 1
Threading = 2

Update /boot/loader.conf

kern.ipc.shmmax=134217728
kern.ipc.shmall=65536
kern.ipc.semmni=40
kern.ipc.semmns=240
kern.ipc.semume=40
kern.ipc.semmnu=120

IMPORTANT: The changes above to /boot/loader.conf are required to provide sufficient resources to the IMDB (in-memory DB) used by sipXecs. After making these changes reboot the system so that they take effect.

Generate certificate:

mkdir sslkeys
cd sslkeys
/usr/local/bin/ssl-cert/gen-ssl-keys.sh
/usr/local/bin/ssl-cert/install-cert.sh

Edit /etc/hosts file: (Using a fixed IP address amd hostname bsd)

127.0.0.1               localhost
192.168.1.130           bsd.example.com bsd
192.168.1.130           bsd.example.com.

Start sipXecs:

/usr/local/etc/rc.d/sipxpbx start

bsd# /usr/local/etc/rc.d/sipxpbx start

Checking TLS/SSL configuration:success
Check whether postgresql starts automatically after reboot.
Initializing configuration database...
Checking Apache configuration:success
Checking hostname is fully qualified:success
Checking localhost address configured:success
Checking localhost name is not shared:success
Checking /tmp directory has correct permissions:success
Checking watchdog:success
Checking keepalive:success
Checking sipXproxy:success
Checking sipXvxml:success
Checking sipregistrar:success
Checking sipstatus:success
Checking sipxacd:success
Checking sipxcallresolver:success
Checking sipxconfig-agent:success
Checking sipxconfig:success
Checking sipxpage:success
Checking sipxpark:success
Checking sipxpresence:success
Checking sipxrls:success

Starting sipXpbx:
Starting watchdog: success
 Waiting for keepalive to start: 20 19 18 17 16
success


bsd# /usr/local/etc/rc.d/sipxpbx status

Checking watchdog: success
Checking keepalive: success
Checking sipXproxy: success
Checking sipXvxml: success
Checking sipregistrar: success
Checking sipstatus: success
Checking sipxacd: success
Checking sipxcallresolver: success
Checking sipxconfig-agent: success
Checking sipxconfig: success
Checking sipxpage: success
Checking sipxpark: success
Checking sipxpresence: success
Checking sipxrls: success

Start Apache:

bsd# /usr/local/etc/rc.d/apache2 start
Performing sanity check on apache2 configuration:
Syntax OK
Starting apache2.

Testing sipXconfig standalone:

su - sipxchange
/usr/local/bin/sipxconfig.sh

sipXconfig should now start with all error output directed to the console. Wait for about 1 minute and if no errors are printed navigate your browser to:

http://<hostname>:8443/sipxconfig/app

Resetting brute-force:
This will wipe out the Postgres DB initialization and allow you to start over:

/usr/local/etc/rc.d/sipxpbx stop
/usr/local/etc/rc.d/postgresql stop
rm -rf ~pgsql/data/*
/usr/loca/etc/rc.d/sipxpbx start

Additional Troubleshooting:
There is a lot of information about troubleshooting on this Wiki. A good starting point is Troubleshooting.

Retrieving profiles for Phones

sipXconfig generates configuration profiles for supported phones and gateways. They can be retried via FTP. The user's sipx home directory is set to the tftproot directory where sipXconfig deposits profiles. Therefore, phones need to be configured to retrieve profiles from the sipXecs server using the username sipx and the corresponding password.

Conclusion

The FreeBSD port for sipXecs 3.9 is now done and works. We will update it to 3.10 once the 3.10 release is out.