From Seasteading
Jump to: navigation, search

This is probably the only area that I can call myself an expert in.

Asterisk can be made to build a tricked out phone system of any size at a trivial cost.

Ultimately, this page will be a set of config files, patches and dependencies for building such a system.

Current version doesn't do GSM. Mainly because I have no idea how to do it.

The only thing on here that's going to be non-obvious to the person familiar to Asterisk is the MELP stuff. Basically MELP is a 2400bps codec. It's very similar to LPC10 except you don't sound like a robot. The quality is pretty good. I wouldn't mind using it for all of my calls. Using MELP with IAX2 makes for a very low bandwidth channel. In trunking mode, IAX2 only has protocol overhead on the first 1 or 2 calls. After that, it starts to become trivial. Since LPC10 and MELP are so similar in structure, Asterisk can be tricked into thinking that MELP is actually LPC10. Using the reference code, I've gotten a codec_melp to load, but it just crashes. Unfortunately, this isn't an ultimate solution because the code I did (making the reference code reentrant) can't be released into the wild. That would be beyond "purely philosophical" inquiry and Compandent (the patent holder) could sue me into oblivion. Fortunately, they sell serial modules that can do multiple MELP channels.

Why all the trouble with MELP?

Without MELP, there are other options.

  • LPC10 - Problem: makes you sound like a robot... it's pretty scary
  • g723.1 (still using VoIP) - Problem: doubles the amount of bandwidth needed
  • HF phone relay - Problem: bad sound quality
  • Satellite phone - Problem: expensive, quality not as good, annoying latency


  • MELP/MELPe - Military grade compression for minimizing bandwidth consumption
  • AMRNB - What cellphones use
  • g723.1/g729 - What voip phones use
  • iLBC/speex - Open source low-bitrate codecs

Useful protocols

  • Bluetooth will be implemented via chan-mobile
  • GSM will be implemented with a commercial gateway.
  • Regular POTS service can be done using hardware
  • SIP - VoIP protocol
  • IAX2 - Lightweight VoIP protocol - good jitterbuffer that can be tweaked for dealing with packet loss/latency


  • At least a P4 2.4 2GB server with a focus on reliability (solid disk, passive cooling if possible) $1000
  • Backup server/load balancer $1000
  • Half decent switch $300
  • Digium AEX2460E Analog Card 6x4 FXS + Echo can $1800
  • g729 licenses $100
  • 20U Rack $500
  • Rackmount UPS $500
  • Two serial MELPe hardware modules $1000 (This could be way off)
  • Far end server colocation $400/month
  • Total: $6200
  • Recurring: $400 per month plus cost of minutes
  • Doesn't include wiring because that depends entirely on the layout of the structure.
  • Amplifiers will be necessary in some situations.

This scheme supports 24 POTS lines. One could fit 3 or 4 of those cards in each server, so it scales pretty well.

Obviously, the rack and UPS can be avoided if space is already provided by existing infrastructure. I leave it in here for the purpose of offering a complete solution.

Cutting Corners

Ways to make the system simpler/less expensive.

  • Ditch the Digium cards and stockpile some ATAs (Analog Telephony Adapters)
  • Don't pay for patented codecs if it is unnecessary (don't do this without some legal advice as the patent holders see this as SERIOUS BUSINESS)
  • No hardware echo can
  • No backup server
  • No colo


  • Existing network/Internet
  • Cool/dry/secure area
  • ~1000 watts available power


  • Used to switch calls
  • Used to translate between various protocols
  • Used to perform IVR functionality such as voicemail

Misc Features

  • Faxing: Even with T.38 (Fax over IP), 14400bps are needed. It's not clear that this will always be available. Store-and-forward should be used to fall back on when network conditions are poor. Regular T.30 fax will work fine internally. Externally, it is absolutely 100% completely impossible to get regular faxing to work.
  • SMS works with a properly installed chan_mobile
  • Video will only be possible internally
  • Voicemail is trivial to setup with Asterisk. Usually works out of the box with chosen provisioning software.
  • Intercom - chan_alsa provides the ability to dial the sound card. "HI. I'M GEORGE ZIMMER, FOUNDER AND CEO OF THE MEN'S WAREHOUSE..."
  • Emergency/911 - trivial dialplan work

Network Access

For external communication, I think the phone system should try this sequence...

  • Any good opportunistic bandwidth ('stead is in port and has access to wifi)
  • Packet HF - so that it gets low latency bandwidth if possible
  • Satellite
  • Analog HF channel for emergency backup

I could use some good advice here from a networking guru.


This is beyond the scope of this page, but a few points:

  • Industry is changing rapidly.
  • Peering between seastead communities is just a matter of settling on which system to use.
  • Systems include: E164 (ENUM), DUNDi, VPF (Voice Peering Fabric, uses ENUM)
  • Peering directly with carriers won't be possible for small seastead communities. They will just have to use a regular service provider. They don't want to go to the trouble unless you can provide them with a substantial number of routes.

For peering between seastead communities, DUNDi is the most suited to decentralization. It has the disadvantage of little to no adoption as of this writing. Also, it only works with Asterisk.


  • IAX2 has an aes128 option
  • Bluetooth (cough) security
  • VoIP security not all that great in the open source world, but reasonable security can be achieved.


  • Build servers. Insert Digium card/s.
  • Load the ups/servers/patch panels into the rack.
  • Connect power; connect servers to switch
  • Load Debian or Ubuntu Server onto the servers.
  • See Software Installation Procecure below...
  • Install your favorite billing/provisioning software - I leave this open since there's a bazillion ways to do it.
  • Connect the system to the LAN/WAN
  • Order a dedicated server, nothing special.
  • Install Debian, then Asterisk, like we did before
  • Follow these instructions to connect to the colo server
  • Subscribe to server per minute voip providers and configure them on the dedicated server
  • Create dialplan

Software Installation Procedure

# Copypasta from
apt-get install linux-headers-`uname -r` bison openssl libssl-dev libeditline0 libeditline-dev libedit-dev
apt-get install gcc make g++ php5-cli mysql-common libmysqlclient15-dev libnewt-dev dialog
apt-get install libspeex1 libspeex-dev libvorbis-dev libcurl3-dev unixodbc mysql-server php5-mysql
apt-get install vim sox nmap ngrep iftop iptraf elinks lynx festival festvox-kallpc8k lighttpd
apt-get install libspandsp1 libspandsp-dev bluetooth libbluetooth2-dev libbluetooth bluez-utils blues-pin
apt-get install phpmyadmin

# Installation
cd /usr/src
svn co agx-ast-addons
svn co appconference
tar -zxvf libpri*
tar -zxvf zaptel*
tar -zxvf asterisk*
tar -zxvf appconference*
cd libpri ; make ; make install ; cd ..
cd zaptel ; ./configure ; make menuselect ; make ; make install ; make config ; cd ..
cd `ls | grep asterisk-1.4 | grep -v addons | head -n 1`
./configure ; make menuselect ; make ; make install ; make samples ; make config ; cd ..
cd `ls | grep asterisk-1.4 | grep addons | head -n 1`
patch -p0 < ../chan_mobile-1.4.x.patch
./configure ; make menuselect ; make ; make install ; make samples ; cd ..
cd appconference/trunk
make ; make install ; cd ../../
cd ast-agx-addons/trunk
./ ; cd ../../
/etc/init.d/asterisk start

dialog --clear "Do United States software patents apply to you?" 0 0
case $? in 1)
 dialog --msgbox --clear "Download the g729 and g729 codecs appropriate for your architecture." 0 0
 lynx ""
 mv codec_g72* /usr/lib/asterisk/modules/
 mkdir melptemp ; cd melptemp
 tar -zxvf melp1.2.tar.gz
 mv makefile Makefile
 cp melp.c melp.c.backup
 cat melp.c | sed -e 's/void main/int main/g' > melp2.c
 cat melp2.c | sed -e 's/,fp_in/,stdin/g' | sed -e 's/,fp_out/,fp_out/,stdout/g' > melp.c ; rm melp2.c
 make OSTYPE=linux
 cp melp /usr/bin/
 echo '#!/bin/bash\n\nmelp -a -i /dev/null -o /dev/null' > /usr/bin/melp_enc
 echo '#!/bin/bash\n\nmelp -s -i /dev/null -o /dev/null' > /usr/bin/melp_dec
 chmod a+x /usr/bin/melp_*
 cd ..