Combine uClinux and Asterisk on a Card
Expect and Embedded Systems
Expect is an extension to Tcl that lets you automate console sessions. I have found it to be very valuable for automating common steps in embedded systems work.
There are a couple of annoying problems with embedded system development:
On a regular desktop system, you compile code and then run it on the same machine. With an embedded system, you compile it on a host PC and then download to the host system—for example, using FTP or TFTP. This extra step becomes tedious and can lead to silly mistakes, like forgetting to download the latest version.
A lot of embedded development work involves device driver work, which can mean frequent crashes. During the development phase, embedded systems commonly use RAM-based filesystems, so a system crash or reset means you lose everything and must download all your software and config files all over again.
Expect lets you automate all this. For example, here is some Expect code to transfer a file via FTP to the target system:
#!/usr/local/bin/expect -f set tarball [lindex $argv 0] set target [lindex $argv 1] send "ftp $target\r" expect "): " send "root\r" expect "Password:" send "uClinux\r" expect "ftp> " send "cd /var/tmp\r" expect "ftp> " send "put $tarball\r" expect "ftp> " send "quit\r"
It's as easy to write as it looks. In only a few minutes, you can automate common tasks. To run the script, simply type:
$ ./download tarball.tar.gz target
where target is the hostname of the target system.
You even can use it to set up configuration files for you (Asterisk has a million of these):
spawn telnet $target send "cd /var/tmp/ipkg/asterisk\r" expect "> " send "cp -a etc/* /etc\r" expect "> " send "exit\r"
This example starts a Telnet session on the target and copies a bunch of files to /etc.
Expect can save you a lot of time in embedded systems work, closing the distance between embedded and regular desktop development.
The configuration files for Asterisk are the same as for x86 Asterisk. Some useful files are:
/etc/zaptel.conf: Zaptel driver configuration
/etc/asterisk/zapata.conf: more Zaptel configuration.
/etc/asterisk/extensions.conf: sets up dial plan for PBX.
/etc/asterisk/sip.conf: SIP phone configuration.
These files can be edited with vi on the Blackfin, but remember that any configurations will be lost when the board is powered down or reset. Permanent changes can be stored on the SD card.
So, there you have the basic steps for building your own embedded Asterisk PBX. Kits containing the daughterboards and modules are available from the author. We are working on further development—for example, custom Blackfin hardware designed specifically for telephony work and other line interface cards, such as BRI-ISDN. It's an exciting project, with the novel feature of open hardware development.
Free Telephony Project: www.rowetel.com/ucasterisk/index.html
Blackfin uClinux Site: blackfin.uclinux.org
Building an Embedded Asterisk PBX, Part 1: www.rowetel.com/blog/?p=15
Building an Embedded Asterisk PBX, Part 2: www.rowetel.com/blog/?p=16
Optimizing code for the Blackfin: www.rowetel.com/blog/?p=5
gEDA Open EDA Tools: www.geda.seul.org
David Rowe has 20 years of experience in the development of DSP-based telephony and sat-com hardware/software. David has a wide mix of skills including software, hardware and project management, and a PhD in DSP theory. He has held executive-level positions in the sat-com industry ( www.dspace.com.au) and has built and successfully exited a small business ( www.voicetronix.com). However, he has decided he is better at debugging machines than people, so he currently chooses to hack telephony hardware and software full time.
- Download "Linux Management with Red Hat Satellite: Measuring Business Impact and ROI"
- July 2016 Issue of Linux Journal
- Tibbo Technology's Tibbo Project System
- Client-Side Performance
- Sony Settles in Linux Battle
- Peppermint 7 Released
- Libarchive Security Flaw Discovered
- Profiles and RC Files
- Git 2.9 Released
- Snappy Moves to New Platforms