29th
The Asterisk File Transfer Protocol
Dial (212) 796-0729 ext. 160 to access the Asterisk File Transfer Protocol Server!
Today as my contribution to 5in5, I created a prototype method for transferring files via an Asterisk VoIP PBX. The inspiration came from my early computing days using a an audio cassette recorder to store applications for my first personal computer, a TI-99/4a. Programs were stored on audio cassettes, and were literally transferred to RAM via an audio signal over a 1/8” jack. If you didn’t plug in the jack but instead listened to the files through the cassette player’s speaker, they had an eery digital quality (a lot like a fax machine). So, I decided to recreate this experience over the telephone. If you have an acoustic coupler attached to your computer, you could potentially download files from the system at a blistering 300 baud!
For demonstration purposes, the A-FTP server transmits this file…an 8Kb jpeg image (which takes 3 minutes and 29 seconds to play):

I decided to use the “Kanas City standard” (http://en.wikipedia.org/wiki/Kansas_City_standard) for audio frequency-shift keying of digital files. This standard was established in 1975 at a symposium in Kansas City to provide an alternative storage solution to expensive floppy drives. (I’m not sure whether the TI-99/4a used it, but it sounds pretty close.) To convert the file into an audio file that conforms to the Kansas city standard, Adam Parrish clued me into the CSound audio programming language. Csound is “a unit generator-based, user-programmable computer music system.” Its syntax is excruciating, but it is extremely powerful. I spent most of the day trying to learn the basics to create the fundamental components of a CSound composition…the Orchestra File and the Score file.
The Orchestra file describes all the “instruments” used to generate audio. In my case, I needed two instruments…one 1200hz sine wave oscillator for “0” bits, and one 2400hz sine wave oscillator for “1” bits. The score file is what describes the audio piece itself…it tells CSound what sounds to generate, and when and how long to play each instrument. (CSound gets vastly more complex than my rudimentary needs.) Once I figured out how to generate this file, I wrote a PHP script that reads my binary image file and outputs the appropriate lines in the score file. (A big thanks to Adam Parrish again for helping with the bit masking stuff.) Once the .wav file was generated, I converted it to the GSM audio format that Asterisk loves so dearly. I then created a short dial plan to first playback a greeting, and then the file itself.
You can access the server by dialing (212) 796-0729 ext. 160. Unfortunately, the low quality GSM codec probably precludes the audio waveform from actually being used for file transfer…but it’s still a fun idea. You can listen to a higher-fidelity version of the file here (2.4mb). If you’d like to see some of the code, go to the original post on 5-in-5.com!



