Afelio™
Scalable Telephony Server for BSD and MacOS X
Afelio turns a BSD server or Macintosh computer into a private branch exchange telephone system (PBX) and multi-protocol voice over IP (VoIP) telephony server. In addition to VoIP telephony, Afelio provides many features usually found in proprietary PBX systems such as auto-attendant, call forwarding, call screening, call transfer, do-not-disturb (DND), interactive voice response (IVR), music-on-hold (MoH), voice conferencing, voicemail and others. Afelio is still work in progress. It is not based on Asterisk (a Linux PBX software).
Afelio Architecture
The Afelio telephony server consists of a core server for call control and one or more media/protocol servers, each one running as a separate process. The guiding principle is to keep the server core lean and clean and free of any direct network connections. Unix domain sockets are used to communicate with the core.
Communication between the server core and media/protocol server instances uses a version of the Woomera protocol amended to send media over domain sockets. For communication between admin utilities and the core a custom server control protocol will be used, also over domain sockets.
Architecture block diagram — the initial release will not implement all components shown.
Server Core Components
- Call Origination API
- Configuration Engine
- CDR Engine
- Data Dictionary
- Dialplan Engine
- Logger
- Media Channel Socket Interface
- Server Control
- Service Discovery
- Service Launcher
- Resource Loader
Loadable Server Core Modules
- ACD (Automatic Call Distribution)
- Autoattendant
- Cluster Interconnect
- Conference
- Music on Hold
- Privacy
- Scripting Engine
- Spooler
- Text-to-Speech
- Voicemail
Libraries used in the Server Core
- SpanDSP (digital signal processing)
- Sunrise DD (collections)
- Task (concurrency)
- Various codecs (GSM, Speex, etc)
Media Servers
- AppleModem FXO server (MacOS X only)
- Unicall HAL server (analog, R2)
- ISDN server (BRI, PRI)
- SS7 server (ITU, ANSI, TTC)
- H323 server
- MGCP server
- IAX server
- LTP server
- Proxy server
- SIP server
- XMPP Googletalk server
- Voice conferencing server
Control Agents
- CLI agent
- XML-RPC agent
- SOAP agent
- AstMgr agent
Platform Support
The following platforms will be supported by Afelio:
- Embedded BSD appliances
- FreeBSD servers
- NetBSD servers
- MacOS X client and server
- OpenBSD servers
Support for Solaris is planned at some point in the future.
Whilst Linux is not currently an official target platform, Afelio should build and run on
Linux.
Code Base, Build Environment, Releases
Afelio is being developed and tested on various BSD platforms and MacOS X. For BSD platforms a CMake based build system is being developed. On MacOS X, the build system is a native Xcode project. An initial release of Afelio was planned for Q2/2007 as a MacOS X port of Callweaver, which is an improved derivative of Asterisk. However, the objectives of the two projects have diverged and Afelio has become an independent project with its own architecture and code base, not containing any code from Asterisk nor Callweaver. In the process of redefining the Afelio project, release dates have slipped several times. Implementing all of the new architecture would take us well into 2008. However, since we aim to make an initial release before the end of 2007, it has been decided to reduce the feature set and functionality of the initial release to the absolute minimum, then add to that in subsequent releases. For a list of components deemed necessary in the initial release please refer to the Afelio roadmap.
Highlights
- focus on integration into BSD and MacOS X environments
- architecture designed for scalability, reliability and security
- software timers — no dependencies on Digium hardware
- CMake/Xcode build systems — universal binaries on MacOS X
Aqua GUI Integration
Any further work on the integrated PBX management GUI application for MacOS X "Macsterisk" is directed at migration to Afelio. Click here for more detail about Macsterisk.
Licensed On-hold Music
Sunrise has licensed royalty-free music for inclusion with Afelio as on-hold music. This music does not require any performance license to be played to callers over the telephone. However, the license is for non-commercial use only. When used as a business PBX, a one-time royalty-free license (per business) will need to be purchased from the publishing company.
The following royalty-free music is included with Afelio:
- Beethoven, Symphony No.3 "Eroica", complete
- Mozart, Serenade "Eine Kleine Nachtmusik", complete
- Mussorgsky/Korsakov, "A Night on the Bare Mountain"
- Sarasate, "Zigeunerweisen", complete
- Vivaldi, Concerto "The Four Seasons", complete
- 2 modern instrumental tracks (synthesizer/techno)
Property List based Configuration
Afelio uses a confguration engine which verifies that configuration data is correct before accepting it as input. The NeXT property list format is used for all configuration files. It is a hierarchic format which allows arbitrary key names and nested data structures, but unlike XML it is very intuitive and thus human readable and editable.
For more details, refer to the sample master configuration file
Support for Apple's USB Modems
A media server for the Motorola SM56 modem used by Apple in recent Macs and in the external Apple USB modem is now under development. The media server will provide a socket based interface to Apple's modem driver software in full-duplex mode. This will allow the use of the SM56 modem to make and receive telephone calls on Macintosh computers running Afelio.
Support for PCI Telephony Interface Cards
The following PCI telephony interface cards will be supported on BSD systems running Afelio:
- Cologne Chip HFC series based PCI and miniPCI interface cards for Basic Rate ISDN (BRI)
- Sangoma A200/400 series PCI and PCIe interface cards for analog telephony (FXO/FXS)
- Sangoma A500 series PCI and PCIe interface cards for Basic Rate ISDN (BRI)
- Sangoma A100 series T1/E1/J1 PCI/PCIe interface cards for Primary Rate ISDN (PRI)
- Sangoma A100 series T1/E1/J1 PCI/PCIe interface cards for Signaling System 7 (SS7)
Afelio Roadmap
Afelio development is mostly carried by volunteered work and sponsorships. It is therefore not always possible to give a time line or priorities for individual work units. Work units listed below are divided into three groups: pre-release, post-release and long-term.
Work units to be completed for the initial release
Core system components
- Core daemon with resource loader, launcher, signal handlers, logger
- Configuration engine with lexer and parser for property lists
- Data dictionary with custom data type abstraction layer API
- Configurable asynchronous call bridge with call origination API
- Universal parameter-driven dial plan engine without scripting capability
- Media channel socket interface with woomera client
- Basic server control interface
- Basic CDR engine
Loadable core modules
- Music on Hold module
- Spooler module (for automated tests)
Media servers
- Integrate OPAL woomera server for H323, SIP and IAX
- Media channel socket interface server for use as a generic template
- Unicall woomera server (allowed to slip past initial release)
Control utilities and agents
- afelioctl utility
- Basic functionality CLI agent (allowed to slip past initial release)
GUI components
- Web GUI for master configuration (allowed to slip past initial release)
- System preference pane for Afelio (MacOS X only, allowed to slip past initial release)
National numbering plans
- Australia, Benelux, Brazil, France, Germany, Japan, Norway, UK
- NANPA subset covering the United States and Canada
Voice prompts and on-hold music
- Record voice prompts in American, Australian and British English
- Incorporate licensed portfolio of on-hold music

Work units to be worked on soon after the initial release
Core system components
- Add service discovery and enhance resource loader and service launcher
- Add infrastructure needed for scriptablity of dialpan engine
- Enhance server control interface
- Enhance CDR engine
Loadable core modules
- Add a scripting engine by embedding Steve Dekorte's Io language
- ACD, Autoattendant, Conference, Privacy, Voicemail
- Text-to-Speech using Cepstral and Mactintalk (on MacOS X)
Media servers
- Media channel socket interface server for ISDN (I4B)
- Media channel socket interface server for the Googletalk VoIP protocol
- Media channel socket interface server for the Lightweight Telephony Protocol (LTP)
- Media channel socket proxy server for remote connections
- Media channel socket interface server for the Apple USB modem (MacOS X only)
- Large capacity voice conferencing server, probably integrating OpenMCU
Control utilities and agents
- Enhance CLI agent
- XML-RPC agent
- AstMgr agent using AMI protocol for compatibility with utilites written for Asterisk
GUI components
- Fully featured web GUI for OS independent Afelio management
- GUI language support for English, Spanish and Japanese
- Migration of the Bonjour based desktop dialer on MacOS X
- Migration of the Asterisk Assistants to Afelio on MacOS X
- Cocoa based GUI application for Afelio management on MacOS X
National numbering plans
- Add numbering plans for most of Asia, Europe, Latin America
- Eventually, other countries and territories as per demand
Voice prompts and on-hold music
- Record prompts in Japanese, Spanish and Portuguese
- Eventually, record prompts in other languages as per demand
- Add royalty free Jazz to Music-on-Hold portfolio (donations needed)
Miscellaneous
- Modification of the build system such that fax features and the resulting dependency on the libTIFF library are strictly optional when configuring and building the SpanDSP library

Long-term and low-priority work units
Core system components
- Add a socket based interface to software codecs, ie. AMR, G723, G729
Loadable core modules
- Cluster interconnect for automatic failover
Media servers
- Unified ISDN server for both BRI and PRI
- SS7 signaling and media server
- Dedicated SIP server using Sofia SIP
- Dedicated IAX server, probably building a new IAX stack
Control utilities and agents
- SOAP agent
Coding Practises
Although most Afelio contributors will have previously been working on Asterisk code, strictest avoidance of Asterisk coding practises is necessary in order to ensure reliability and maintainability of the Afelio code base. Persons who have been working on Asterisk code but did not find anything wrong with it are probably unfit to work on Afelio without retraining.
Project coding standards
- Use of comments which are authoritative over code by describing intent
- Names of identifiers must always be self explanatory, without any exceptions
- The most appropriate algorithms and data structures for the task at hand must always be chosen instead of naive and simplistic introductory text book examples (DOH!)
- Avoid pthreads where possible in favour of coroutines and lock-free algorithms
- Design and use of proper APIs, enforcing the principle of information hiding through strict data encapsulation and opaque pointers where all data must always be encapsulated
- Every function must always be documented within the code, describing pre-, post- and error-conditions before coding of the function can commence
- Before any code submissions for new components can be accepted a proper architecture and design document must first be submitted and accepted through peer review
- Use network interface names instead of IP addresses in configuration
- Linux-style dependency trees are undesirable, the fewer dependencies the better
- Sacrifice functionality if need be, but don't sacrifice quality
Licensing
All software components developed by Sunrise for Afelio are licensed under the Sunrise Open Source License which is an MIT style license. Contributions of replacement code can only be accepted if they are either licensed under this license or an MIT style license or the revised 3-clause BSD license.
However, some of the components which make up the Afelio project link to GPL licensed libraries which means that the restrictions of the GPL license terms will apply to such components as a whole, even if individual parts are licensed under less restrictive license terms. Amendments and bug fixes to such GPL licensed portions may be contributed under GPL terms, but replacements for such portions may not be contributed under GPL terms.
Afelio FAQ
Frequently Asked Questions about Afelio.
Comparison of Afelio, Asterisk and Callweaver
Toolchain
| Afelio | Asterisk ∙ Callweaver | |
|---|---|---|
| revision control | CVS, migration to CVSnt planned | SVN |
| compilers | C99 | C99, bison, m4 |
| build system | CMake, Xcode on MacOS X | GNU autotools (YIKES!) |
| packaging | BSD ports, Iceberg on MacOS X | not integrated, up to individual maintainers |
Switching core
| Afelio | Asterisk ∙ Callweaver | |
|---|---|---|
| concurrency | mixed use of pthreads, coroutines and lock-free algorithms, minimal use of mutex locks | pthreads, race conditions and livelocks due to overzealous use of mutex locks |
| internal storage |
lock-free hash table with built-in reference counting |
singly linked lists, whole-list mutex locks, no memory management |
| configuration system | integrity checking of configuration data using recursive descent parser for property list configuration files based on formal grammar | configuration data read without checking, using guesser instead of parser, INI derived configuration files, no formal grammar |
| timing reference | kernel based timers | Asterisk requires Digium hardware,
Callweaver uses kernel based timers |
| digital signal processing | uses SpanDSP library | Asterisk uses homegrown DSP code,
Callweaver uses SpanDSP library |
| dialplan engine |
efficient parameter driven dialplan engine implemented in C, optional scripting engine using embedded actor based OO scripting language, see www.iolanguage.com | archaic dialplan engine using a naively implemented and very inefficient homegrown scripting engine, no tokenizing, no syntax check on load, errors abort phone calls |
| call origination | API firmly integrated into switching core, call bridge uses coroutines for scalability | no API, instead calls are bridged using a loadable dialplan engine utility, doesn't scale |
| remote control & monitoring | remote control and monitoring system based on scalable client-agent-server architecture | remote control and monitoring system doesn't scale, represents bottleneck, client requests can seriously disrupt phone calls |
| protocol/driver interfaces | all protocol stacks and driver interfaces run as dedicated processes, separate from the switching core, IPC via domain sockets | protocol stacks and driver interfaces are required inside switching core, doesn't scale, exposes core to network, difficult to maintain | security | switching core is never exposed to network, predetermined loadable components can only provide implementations of delegates which are firm part of the core API, configuration data is always checked | single-daemon approach exposes switching core to network, loadable modules can inject code bypassing the switching core, configuration data is not checked, malicious data input leads to vulnerabilities |
External components 1
| Afelio | Asterisk ∙ Callweaver | |
|---|---|---|
| command line utility | separate CLI utility, rpc based protocol between client utility and server, no CLI input processing in the core | CLI input processing inside switching core, CLI requests can seriously disrupt phone calls, CLI problems can take down server |
| media servers | dedicated daemons for protocols and driver interfaces, managed by switching core, using woomera over domain sockets for signaling and media | protocol stacks and driver interfaces are required inside switching core, but a woomera plugin module is available through which media servers can be utilised |
| remote control & monitoring agents | dedicated daemons for remote control and monitoring, managed by switching core, using rpc based protocol over domain sockets between agents and core | remote control and monitoring interfaces are required inside switching core, switching core incorporates IP-socket server, in addition Asterisk core embeds http server |
| GUI | web GUI, native Cocoa GUI on MacOS X | recent versions of Asterisk have a web GUI, no GUI for Callweaver |
Project focus and philosophy
| Afelio | Asterisk | Callweaver | |
|---|---|---|---|
| OS focus | BSD centric | Linux centric | Linux centric |
| development focus | scalability, reliability, security | features, features, features | fax over IP, patches |
| philosophy | code correctness, as simple as possible, not any simpler | sell more Digium hardware, worshipping Digium's CTO | corporate involvement is evil, worshipping the GPL |
Project organisation
| Afelio | Asterisk | Callweaver | |
|---|---|---|---|
| form of organisation | company sponsored project | company sponsored project | informal, loosely knit cooperative of individuals |
| legal representation | Sunrise Telephone Systems | Digium | none |
| project management | Sunrise Telephone Systems | Digium appointed council | no management, direction determined by happenstance |
| governance | guidelines | by council | none, cozy anarchy |
Methodologies
| Afelio | Asterisk | Callweaver | |
|---|---|---|---|
| documenting design | mandatory | up to each individual | up to each individual |
| design approval | by peer review | by appointed council | no approval required |
| data encapsulation | mandatory | never used | never used |
| abstraction | mandatory | frowned upon | desired but seldomly used |
Licensing
| Afelio | Asterisk | Callweaver | |
|---|---|---|---|
| release license |
Sunrise Open Source License an MIT style license |
Dual licensing: GPL and Digium proprietary |
GNU General Public License aka GPL |
| contributions | require SOSL, MIT or revised 3-clause BSD licensing | require rights to be assigned to Digium | require GPL or GPL compatible licensing |
1 components which are external to the switching core according to the Afelio model
Mailing Lists
- Afelio developer's mailing list
- BSD Telephony mailing list (coming soon)
- Macintosh Telephony mailing list
Source Code Repository
Web Viewer
CVS Login
cvs -d :pserver:username@repo.afelio.org:/Public/CVS login
Screenshots
Work in Progress — Xcode Build Environment
