A PBX connects a number of private extensions through a trunk line or lines to the public phone system, routing outbound and incoming calls and providing features such as voicemail and teleconferencing.
IP-PBXs work with VoIP telephones and trunks to provide these voice services on an IP-based data network. IP-PBXs can also mix IP and traditional telephony--for example, routing an incoming analog call from the PSTN to a VoIP telephone, or trunking a call /P>from an analog phone over the Internet.
By combining the Analog Devices Blackfin, open hardware, Asterisk, Oslec and uClinux, an extremely low-cost yet powerful IP-PBX reference design has been developed and put into production. The IP04 is being produced commercially and is also being adopted by a number of equipment suppliers as the engine for their IP-PBX products.
Asterisk is a very powerful and popular open-source software application that implements an IP-PBX function on several hardware platforms. Many Asterisk IP-PBXs are based on an X86 PC plus PCI card for the analog ports. The Open Telephony Project is taking advantage of Asterisk software to build a high-quality IP-PBX.
The IP04 is just such an open-hardware IP-PBX design. It uses a four-port IP-PBX that runs Asterisk and uClinux on a Blackfin processor. When power is applied, the Blackfin boot ROM starts reading from the 256-kbit SPI flash chip. The program it loads is called u-boot, a powerful boot loader that has been ported to the Blackfin. U-boot has a command line interface that lets you load other programs from flash or via Ethernet. In normal operation, it automatically loads and executes the uClinux kernel.
A 256-Mbit NAND flash chip is used as the main storage for the IP04. NAND flash has the advantages of high density and low cost. It's the same hardware that is used in MP3 players, so prices have plummeted in recent years. However, the Blackfin boot ROM can't read the NAND flash directly, which is why the SPI flash chip and u-boot are needed to support the startup process. Compared with many embedded Linux systems, the IP04 requires a lot of flash storage (around 16 Mbits minimum) to store the Asterisk executable and audio prompts.
After booting, the kernel runs out of SDRAM, and the NAND flash is mapped to the root file system. We also use a portion of the SDRAM for temporary files (e.g., /tmp).
The IP04 runs Asterisk and the uClinux operating system. Asterisk was relatively easy to port to the Blackfin, thanks to the similarities of uClinux to the Linux OS and the maturity of the Blackfin gcc tool chain. We used the Astfin build system, which is a system of nested makefiles and patches that simplifies the complex build process required for the IP04. Some changes to Asterisk were necessary to account for the lack of FPU and MMU on the Blackfin--for example, porting of DTMF routines from floating point to fixed point. The standard Asterisk PCI card FXS/FXO port device drivers were ported to the Blackfin. Because of the richness of the Blackfin's peripherals (e.g., TDM serial and SPI ports), the device drivers are actually simpler than their PCI equivalents.
The four analog ports can be flexibly configured using single-port FXS/FXO modules. The IP04 autodetects the module type when it powers up, and helpful LEDs indicate the flavor (FXS or FXO) of each port.
Use of the IP04 is similar to any other Asterisk box. You can telnet in, modify config files or even use the new Asterisk GUI. Setting up the IP04 is easier than a X86 PC-based Asterisk system: You don't need to install Asterisk or even Linux. The IP04 comes preloaded with Asterisk and uClinux. Plug it in, and in a few seconds you can make calls. With the IP04, you get dial tone out of the box.
The Blackfin is a great choice for embedded telephony applications such as an IP-PBX, for a number of reasons. The problem with most embedded processors is that they are not very powerful. The Blackfin is a powerful host processor combined with a DSP. It can run uClinux, Asterisk and G729 on the same processor at the same time. A standard 500-MHz Blackfin runs at around 1,000 DSP-Mips, which is plenty for voice codecs, echo cancellation, etc.
Second, a lot of development effort and hardware cost (for such items as PCI bridge chips and glue logic) are usually required to interface telephony hardware to the host processor (typically a PC). The Blackfin dramatically simplifies connection to telephony hardware because of its rich selection of built-in peripherals, such as serial ports, SPI and DMA controllers, which are all tightly integrated with the core processor.
In addition, the Blackfin chips are a good value. It is possible to build an IP-PBX, including analog or E1/T1 line interfaces, for less than $100.
Finally, there is an open-source community that has developed around open hardware (for example, the family of Analog Devices Stamp boards) and software (Blackfin ports of uClinux and the gcc tool chain). This article describes how the use of open hardware and software for the IP04 project has dramatically reduced development time.
The IP04 is an open-hardware project. The Blackfin portion of the design is based on the BlackfinOne DSP motherboard and the FXO/FXS interfaces derived from Silicon Labs reference designs. The use of open-hardware techniques helped bring the design together quickly and with minimal effort.
The specific benefit of open hardware is lower R&D costs. Indeed, this has been the experience with the IP04 project. We have developed a leading-edge IP-PBX design with a modest investment of effort, simply by working together with other open-hardware and -software developers.
Bug counts have been very low and development cycles very fast thanks to the reuse of existing open-hardware modules. The IP04 was booting uClinux and making phone calls using Asterisk one week after the solder had cooled on the first prototype. This is practically unheard of in hardware development.
The IP04 reached production three months later, and the design has proved to be reliable and stable.
A common perception is that "if the hardware design is open, people will just copy it and put you out of business." However, a business is much more than just the product design--you need support, capital, manufacturing, service and relationships with customers. Many companies use open-source software (such as embedded Linux) in their commercial products; open hardware is an extension of that concept.
Similar tools and techniques to open software are used for open-hardware development. For example, the team uses SVN to store and share schematic and PCB files, as well as the software components of the IP04. Skype and e-mail were used to coordinate hardware development and debugging. Blog posts, instead of the traditional engineering logbook, have been used to document IP04 development.
Open hardware also opens up exciting new business models. For example, developing countries could build ad- vanced telephone systems for cost. This is more attractive than buying technol- ogy from a first-world, profit-oriented business that must charge a 70 percent markup to cover overhead.
The open-hardware model is used in the One Laptop per Child project. A $100 laptop is possible if you remove the overhead, use community input and sponsorship for R&D, and build volume.
A solar-powered $100 IP-PBX for the developing world is also possible. Such a device could bring telephony to remote villages using Wi-Fi links for trunking.
Another benefit is that the hardware can be built locally in developing countries (remember, the hardware design is free), thereby overcoming import tariff problems and supporting local industry. Combining these elements means lots of people getting connected cheaply. That is a very good thing for the world.
The Open Source Line Echo Canceler (Oslec) is high-quality echo-cancellation software designed for Asterisk. Echo cancellation is a vexing problem, and to date no acceptable solutions have been available for open-source PBX software such as Asterisk. Instead, developers have had to rely on expensive proprietary echo cancellation, such as hardware DSPs with proprietary firmware. Oslec is the first open-source high-quality echo canceler, providing a missing piece in the open-source telephony tool kit.
Oslec uses a "dual path" design with two parallel FIR filters, for foreground and background. The background filter adapts continuously to the incoming speech using the NLMS algorithm. This way, no sensing of double-talk is required, thus overcoming a common weakness in traditional, single-path echo cancelers. The foreground filter is used to filter the signal and remove the echo.
When the algorithm senses that the background filter coefficients are superior, they are copied to the foreground filter. Nonlinear processing based on a center clipper removes residual echo and faithfully represents background.
Oslec started life as a prototype single-path algorithm in the open-source Spandsp library. The Spandsp library contained a set of industry-standard G.168 tests that could be used for rigorous testing of echo cancelers. Those tests were used to evaluate several candidate algorithms. After some experimentation, the dual-path algorithm was chosen.
A key part of Oslec's development was an "open" process. Early versions were released to a set of alpha testers around the world. The testers connected Oslec to real-world Asterisk systems and made phone calls over the PSTN network.
Utilities in Oslec captured the input and output signals, which were e-mailed back to the author for evaluation. The test signals were employed to expose bugs and thereby improve the algorithm.
The test samples that were collected highlighted problems with real-world signals such as dc offsets in A/D converter signals and the low-frequency energy present when soft phones are connected to PSTN networks. The open alpha testing ex- posed several real-world conditions that were not covered by the industry-standard G.168 tests, especially some edge conditions where Intenet Protocol tele- phony meets the PSTN.
The use of existing open-source resources, an advisory group of DSP professionals linked by e-mail, and the open development method resulted in rapid development with modest effort--approximately two person-months. Some other teams have invested up to 10 person-years for similar results.
Oslec cancels echo on tails up to 32 milliseconds, sufficient for FXS and FXO analog interfaces. It is distributed with the G.168 test code to aid further development and cross compiles for both X86 and Blackfin targets. In its current (partially optimized) form, it requires around 20 Mips/channel on an X86 and around 30 Mips/channel on the Blackfin. With further optimization of the NLMS functions, around 5 Mips/channel are possible using the Blackfin's dual-MAC architecture. Since the beta release in June 2007, hundreds of people have downloaded and tested Oslec on X86 Asterisk platforms. It is being used with analog (FXS/FXO), E1/T1 and BRI-ISDN applications.
Oslec has also been used on the Blackfin in several hundred IP04 production units. The DSP capability of the Blackfin allows several channels of high-quality echo cancellation at zero hardware cost. We are working on ex- panding the IP04 to greater densities, as well as USB and WAN/LAN Ethernet routing functionality. There are also efforts to develop open-hardware Primary Rate (E1/T1) and BRI-ISDN hardware.
Assembled and tested IP04s are available for around $450 from the Free Telephony Project Store.
David Rowe (firstname.lastname@example.org) has 20 years of experience in DSP-based telephony. He has held executive posts in the satcom industry and has been an entrepreneur. He holds a PhD in DSP theory.
See related charts