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.
|Speed Up Your Web Site with Varnish||Jun 19, 2013|
|Non-Linux FOSS: libnotify, OS X Style||Jun 18, 2013|
|Containers—Not Virtual Machines—Are the Future Cloud||Jun 17, 2013|
|Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer||Jun 12, 2013|
|Weechat, Irssi's Little Brother||Jun 11, 2013|
|One Tail Just Isn't Enough||Jun 07, 2013|
- Speed Up Your Web Site with Varnish
- Containers—Not Virtual Machines—Are the Future Cloud
- Linux Systems Administrator
- Lock-Free Multi-Producer Multi-Consumer Queue on Ring Buffer
- Non-Linux FOSS: libnotify, OS X Style
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- RSS Feeds
- Reply to comment | Linux Journal
4 min 8 sec ago
- Reply to comment | Linux Journal
4 hours 3 min ago
- Yeah, user namespaces are
5 hours 20 min ago
- Cari Uang
8 hours 51 min ago
- user namespaces
11 hours 44 min ago
12 hours 10 min ago
- One advantage with VMs
14 hours 39 min ago
- about info
15 hours 12 min ago
15 hours 13 min ago
15 hours 14 min ago