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.
|Android Candy: Intercoms||Apr 23, 2015|
|"No Reboot" Kernel Patching - And Why You Should Care||Apr 22, 2015|
|Return of the Mac||Apr 20, 2015|
|DevOps: Better Than the Sum of Its Parts||Apr 20, 2015|
|Play for Me, Jarvis||Apr 16, 2015|
|Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites||Apr 15, 2015|
- Tips for Optimizing Linux Memory Usage
- "No Reboot" Kernel Patching - And Why You Should Care
- DevOps: Better Than the Sum of Its Parts
- Return of the Mac
- Android Candy: Intercoms
- Drupageddon: SQL Injection, Database Abstraction and Hundreds of Thousands of Web Sites
- Non-Linux FOSS: .NET?
- Play for Me, Jarvis
- Designing Foils with XFLR5