PSTN fun

From Hackerspace Brussels
Jump to: navigation, search

Encrypted phone system based on cheap phones and PC soundcards.

Test System

PBX

  • schaarbeek fleemarket visit
  • ebay (got one similar to here)

Small phones easy to interface with soundcard

Stereo to mono splitter

  • homebrew
  • ebay 1 2

PC with a soundcard and ALSA-libs installed

Ideas

Reusing audsl

audsl is a software modem implementation, using yr soundcard as a DAC/ADC http://www.araneus.fi/audsl/

it's a bit dated using OSS as audio api, we should get it patched to use ALSA

From [1]:

"AuDSL is an experimental software modem for low-speed Internet connectivity over leased copper lines using PC sound cards as the line interface. The acronym AuDSL stands for Audio Digital Subscriber Line."

Compiling audsl (aka make)

To avoid g++ errors, include <sys/socket.h> in audsld.cc

Compiling tests (aka make test)

To avoid compiler errors, include <cstdio> in test/test-hdlc-tx.cc

OSS/ALSA issues

[/dev/dsp is missing]

AuDSL is based on OSS and needs /dev/dsp and /dev/mixer devices to run. If your Linux distribution supports ALSA oss-emulation (Ubuntu 10.04 LTS and Debian do), load snd-pcm-oss module.

[audsld - playback mmap: Input/output error]

Since AuDSL uses OSS mmap() function, some permissions must be set. That was solved by [2]. Run the code above to solve it:

 for pcm in `find /proc/asound -name 'pcm*p'`; do
   echo erase >${pcm}/oss
   echo erase >${pcm%p}c/oss
   echo audsld 0 0 direct >${pcm}/oss
   echo audsld 0 0 disable >${pcm%p}c/oss
 done

[Audio device does not support mono mode]

That's from a ioctl call which sets the MONO mode in your soundcard (audio-io.h,56):

       int stereo = 0;
       if (ioctl(fd, SNDCTL_DSP_STEREO, &stereo) == -1) {
           fprintf(stderr, "SNDCTL_DSP_STEREO: %s\n", strerror(errno));
           exit(1);
       }
       if (stereo != 0) {
           fprintf(stderr, "Audio device does not support mono mode\n");
           exit(1);          
       }

Unsolved - hw problem ?

Speex

Patent-free audio compression format designed for speech [3]

Links

Books

  • Understanding Telephone Electronics, Fourth Edition book
  • Linux Audio Programming (Chapter 5) - Programming Linux Games book

Tutorials