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.
|PasswordPing Ltd.'s Exposed Password and Credentials API Service||Apr 28, 2017|
|Graph Any Data with Cacti!||Apr 27, 2017|
|Be Kind, Buffer!||Apr 26, 2017|
|Preparing Data for Machine Learning||Apr 25, 2017|
|openHAB||Apr 24, 2017|
|Omesh Tickoo and Ravi Iyer's Making Sense of Sensors (Apress)||Apr 21, 2017|
- Graph Any Data with Cacti!
- Teradici's Cloud Access Platform: "Plug & Play" Cloud for the Enterprise
- The Weather Outside Is Frightful (Or Is It?)
- Simple Server Hardening
- Understanding Firewalld in Multi-Zone Configurations
- Gordon H. Williams' Making Things Smart (Maker Media, Inc.)
- Server Technology's HDOT Alt-Phase Switched POPS PDU
- IGEL Universal Desktop Converter
- A Switch for Your RPi