Asterisk FreeBSD

Status 2009-08-21

Asterisk on a FreeBSD server


Asterisk compiles and runs on a FreeBSD systems. FreeBSD support has been maturing since the spring of 2004. If you are a first time user of Asterisk on FreeBSD it is STRONGLY suggested that you install Asterisk from the FreeBSD ports or packages collection.

Asterisk 1.4.25 is now available via the ports or packages. The FreeBSD port automatically includes the Zaptel driver, and H323 support. If you build the port from source, you can use the WITHOUT_H323 and WITHOUT_ZAPTEL knobs to disable these things.

The (slightly obsolete) port of 1.6.0.9 version is available also. But Asterisk 1.6 doesn't support the Zaptel and there is no support for DAHDI hardware in FreeBSD - so forget MeetMe. No G.729 codec available also.

No support for 1.6.1.x at all (althought sources may be compilable even without support from port collection).

Hardware support for some Digium devices is ongoing through the Project: zaptel drivers for FreeBSD.

However, there's no support for ISDN channels (modem channel - ISDN4Linux or CAPI). Also, Zaptel -> Dahdi transition is not reflected so no luck with Asterisk 1.6

If you are lookinig for support for Asterisk on FreeBSD you should try the Asterisk Mailing Lists. There is a FreeBSD specific list you might be interested in.

Project website


Visit the Google hosted project website, if you are interested in helping or contributing to the FreeBSD port of Asterisk etc: http://code.google.com/p/asterisk-bsd/ but such project seems to be effectively dead.

Installation

Installing from the Ports collection.

This or the packages is the preferred method of installation if you want to install the latest stable release.
  • Use CVSup to update your ports to the most current version. See the FreeBSD Handbook for Using CVSup.


# cd /usr/ports/net/asterisk/
# make install
# cd /usr/ports/misc/zaptel/
# make install




Create new zaptel.conf /usr/local/etc/zaptel.conf


/usr/local/etc/rc.d/zaptel start
ztcfg




Installing from the Packages System.

See the FreeBSD Handbook for Using the Packages System.

# pkg_add -rv asterisk
# pkg_add -rv zaptel


Running the latest development version of Asterisk

Nothing in this section is required if you just installed Asterisk from the port as described above.

You want to work with the CVS HEAD code. One of the best way to keep up to date with Asterisk is with CVSUP. CVSUP, while not included in the base install of any version of FreeBSD, is the best way to keep up to date with FreeBSD kerel, releases, ports and now Asterisk.

If you don't have the cvsup binary already installed do this as root

pkg_add -r cvsup-without-gui


Create an asterisk-sup file. Here is a sample


host# cat /usr/local/etc/asterisk-sup

*default host=cvs.digium.com
*default base=/root/asterisk
*default release=cvs tag=.
*default delete use-rel-suffix
asterisk


Make sure you have compiled and installed the Project: zaptel drivers for FreeBSD.

Note on directories
Also, Asterisk installs configuration files in /etc/asterisk, instead of the FreeBSD standard /usr/local/etc/asterisk. You can change this manually in the Makefile, as well as other directories.
Remember to check /usr/local/etc/asterisk.conf after the install.

Changes to /root/asterisk/Makefile to make the install more BSD like.



--- Makefile Thu Mar 24 22:55:44 2005
+++ Makefile~ Mon Mar 21 19:35:45 2005
@@ -120,17 +120,17 @@
# Don't use together with -DBUSYDETECT_TONEONLY
BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE

-ASTLIBDIR=$(INSTALL_PREFIX)/usr/local/lib/asterisk
+ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
-ASTETCDIR=$(INSTALL_PREFIX)/usr/local/etc/asterisk
+ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
-ASTHEADERDIR=$(INSTALL_PREFIX)/usr/local/include/asterisk
+ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
-ASTBINDIR=$(INSTALL_PREFIX)/usr/local/bin
-ASTSBINDIR=$(INSTALL_PREFIX)/usr/local/sbin
+ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
+ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
-ASTMANDIR=$(INSTALL_PREFIX)/usr/local/share/man
+ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man

MODULES_DIR=$(ASTLIBDIR)/modules
AGI_DIR=$(ASTVARLIBDIR)/agi-bin


gmake

Use 'gmake' not 'make'. FreeBSD 'make' is BSD make, but Linux 'make' is GNU make. Since we can't have two 'make' programs with the same name, the GNU make on FreeBSD is called 'gmake'. FreeBSD uses magical functionality only available in BSD make, including features which make the ports framework and "make world" possible. If you don't have GNU make, install it from ports or packages.

startup

You will want to borrow the startup script from the FreeBSD port version of Asterisk.


cp /usr/ports/net/asterisk/files/asterisk.sh /usr/local/etc/rc.d
chmod 755 /usr/local/etc/rc.d/asterisk.sh


To activate it edit your /etc/rc.conf file and add this line.

asterisk_enable="YES"


CPU 99.9 % used by Asterisk?

The current version runs amok on a FreeBSD system, occuping all your CPU cycles. To get Asterisk back to a normal level, you have to disable the problematic module in Asterisk config modules.conf with this statement:
noload => pbx_wilcalu.so

When shutting Asterisk, likely mpg123 will refuse to stop, and will enter a tight loop eating up the CPU. You will need to "kill -9" it. mpg123 causes problems on all OSes, including Linux. It is best to avoid using mpg123, and use rawplayer.c on pre-processed sound files. If you dont need MOH, just comment out the lines in its config file and there are no problems.

If you start Asterisk up, and mpg123 is specified in musiconhold.conf, and you don't have mpg123, expect Asterisk to thrash around, eating up CPU time trying to re-exec the missing mpg123. If you comment everything out of musiconhold.conf, you disable the MOH, and any associated mpg123 issues too.

The Monitor application tries to invoke soxmix when mixing the two legs into one. This fails with the default rc.d/asterisk.sh since /usr/local/bin is not in the path.

Everything else seems to work

VoiceMail, IAX connections, SIP connectivity, codecs - everything seems to work.
Please help testing this configuration!

FreeBSD VOIP software


See Also



Asterisk | Asterisk Operating Systems
Status 2009-08-21

Asterisk on a FreeBSD server


Asterisk compiles and runs on a FreeBSD systems. FreeBSD support has been maturing since the spring of 2004. If you are a first time user of Asterisk on FreeBSD it is STRONGLY suggested that you install Asterisk from the FreeBSD ports or packages collection.

Asterisk 1.4.25 is now available via the ports or packages. The FreeBSD port automatically includes the Zaptel driver, and H323 support. If you build the port from source, you can use the WITHOUT_H323 and WITHOUT_ZAPTEL knobs to disable these things.

The (slightly obsolete) port of 1.6.0.9 version is available also. But Asterisk 1.6 doesn't support the Zaptel and there is no support for DAHDI hardware in FreeBSD - so forget MeetMe. No G.729 codec available also.

No support for 1.6.1.x at all (althought sources may be compilable even without support from port collection).

Hardware support for some Digium devices is ongoing through the Project: zaptel drivers for FreeBSD.

However, there's no support for ISDN channels (modem channel - ISDN4Linux or CAPI). Also, Zaptel -> Dahdi transition is not reflected so no luck with Asterisk 1.6

If you are lookinig for support for Asterisk on FreeBSD you should try the Asterisk Mailing Lists. There is a FreeBSD specific list you might be interested in.

Project website


Visit the Google hosted project website, if you are interested in helping or contributing to the FreeBSD port of Asterisk etc: http://code.google.com/p/asterisk-bsd/ but such project seems to be effectively dead.

Installation

Installing from the Ports collection.

This or the packages is the preferred method of installation if you want to install the latest stable release.
  • Use CVSup to update your ports to the most current version. See the FreeBSD Handbook for Using CVSup.


# cd /usr/ports/net/asterisk/
# make install
# cd /usr/ports/misc/zaptel/
# make install




Create new zaptel.conf /usr/local/etc/zaptel.conf


/usr/local/etc/rc.d/zaptel start
ztcfg




Installing from the Packages System.

See the FreeBSD Handbook for Using the Packages System.

# pkg_add -rv asterisk
# pkg_add -rv zaptel


Running the latest development version of Asterisk

Nothing in this section is required if you just installed Asterisk from the port as described above.

You want to work with the CVS HEAD code. One of the best way to keep up to date with Asterisk is with CVSUP. CVSUP, while not included in the base install of any version of FreeBSD, is the best way to keep up to date with FreeBSD kerel, releases, ports and now Asterisk.

If you don't have the cvsup binary already installed do this as root

pkg_add -r cvsup-without-gui


Create an asterisk-sup file. Here is a sample


host# cat /usr/local/etc/asterisk-sup

*default host=cvs.digium.com
*default base=/root/asterisk
*default release=cvs tag=.
*default delete use-rel-suffix
asterisk


Make sure you have compiled and installed the Project: zaptel drivers for FreeBSD.

Note on directories
Also, Asterisk installs configuration files in /etc/asterisk, instead of the FreeBSD standard /usr/local/etc/asterisk. You can change this manually in the Makefile, as well as other directories.
Remember to check /usr/local/etc/asterisk.conf after the install.

Changes to /root/asterisk/Makefile to make the install more BSD like.



--- Makefile Thu Mar 24 22:55:44 2005
+++ Makefile~ Mon Mar 21 19:35:45 2005
@@ -120,17 +120,17 @@
# Don't use together with -DBUSYDETECT_TONEONLY
BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE

-ASTLIBDIR=$(INSTALL_PREFIX)/usr/local/lib/asterisk
+ASTLIBDIR=$(INSTALL_PREFIX)/usr/lib/asterisk
ASTVARLIBDIR=$(INSTALL_PREFIX)/var/lib/asterisk
-ASTETCDIR=$(INSTALL_PREFIX)/usr/local/etc/asterisk
+ASTETCDIR=$(INSTALL_PREFIX)/etc/asterisk
ASTSPOOLDIR=$(INSTALL_PREFIX)/var/spool/asterisk
ASTLOGDIR=$(INSTALL_PREFIX)/var/log/asterisk
-ASTHEADERDIR=$(INSTALL_PREFIX)/usr/local/include/asterisk
+ASTHEADERDIR=$(INSTALL_PREFIX)/usr/include/asterisk
ASTCONFPATH=$(ASTETCDIR)/asterisk.conf
-ASTBINDIR=$(INSTALL_PREFIX)/usr/local/bin
-ASTSBINDIR=$(INSTALL_PREFIX)/usr/local/sbin
+ASTBINDIR=$(INSTALL_PREFIX)/usr/bin
+ASTSBINDIR=$(INSTALL_PREFIX)/usr/sbin
ASTVARRUNDIR=$(INSTALL_PREFIX)/var/run
-ASTMANDIR=$(INSTALL_PREFIX)/usr/local/share/man
+ASTMANDIR=$(INSTALL_PREFIX)/usr/share/man

MODULES_DIR=$(ASTLIBDIR)/modules
AGI_DIR=$(ASTVARLIBDIR)/agi-bin


gmake

Use 'gmake' not 'make'. FreeBSD 'make' is BSD make, but Linux 'make' is GNU make. Since we can't have two 'make' programs with the same name, the GNU make on FreeBSD is called 'gmake'. FreeBSD uses magical functionality only available in BSD make, including features which make the ports framework and "make world" possible. If you don't have GNU make, install it from ports or packages.

startup

You will want to borrow the startup script from the FreeBSD port version of Asterisk.


cp /usr/ports/net/asterisk/files/asterisk.sh /usr/local/etc/rc.d
chmod 755 /usr/local/etc/rc.d/asterisk.sh


To activate it edit your /etc/rc.conf file and add this line.

asterisk_enable="YES"


CPU 99.9 % used by Asterisk?

The current version runs amok on a FreeBSD system, occuping all your CPU cycles. To get Asterisk back to a normal level, you have to disable the problematic module in Asterisk config modules.conf with this statement:
noload => pbx_wilcalu.so

When shutting Asterisk, likely mpg123 will refuse to stop, and will enter a tight loop eating up the CPU. You will need to "kill -9" it. mpg123 causes problems on all OSes, including Linux. It is best to avoid using mpg123, and use rawplayer.c on pre-processed sound files. If you dont need MOH, just comment out the lines in its config file and there are no problems.

If you start Asterisk up, and mpg123 is specified in musiconhold.conf, and you don't have mpg123, expect Asterisk to thrash around, eating up CPU time trying to re-exec the missing mpg123. If you comment everything out of musiconhold.conf, you disable the MOH, and any associated mpg123 issues too.

The Monitor application tries to invoke soxmix when mixing the two legs into one. This fails with the default rc.d/asterisk.sh since /usr/local/bin is not in the path.

Everything else seems to work

VoiceMail, IAX connections, SIP connectivity, codecs - everything seems to work.
Please help testing this configuration!

FreeBSD VOIP software


See Also



Asterisk | Asterisk Operating Systems
Created by: oej, Last modification: Fri 21 of Aug, 2009 (11:22 UTC) by dlukes
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+