Setting up VOIP on a DigitalOcean VPS

Tags:

The best way to get started with VoIP (Voice over Internet Protocol) is to set up a sandbox Asterisk server on a public IP address. To begin you can use your Gmail/Google Voice account for outgoing calls, and then attach your Asterisk to a full SIP connection for incoming and outging calls. For this I'm using a VPS (virtual private server) from Digital Ocean, running Ubuntu 13.10.

For complete control, we can download, compile, and install the latest version of Asterisk directly from the source (here). Generally we'll put this on more-or-less a standalone system, so let's to download and unpack into /usr/src:

cd /usr/src
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk 11-current.tar.gz
tar xfz asterisk-11-current.tar.gz
cd asterisk-11.6.0

(The last will change according to your version.)

Before continuing, install required packages:

# apt-get install make libncurses-dev libxml2-dev sqlite3 libsqlite3-dev
# apt-get install libiksemel-dev  (for gtalk, jingle below)
# apt-get install libssl-dev  (for chan_sip)
# apt-get install subversion (for the mp3 addon)

Now, run the configure program to check dependencies.

./configure

Now, select the options and make sure we will have the required channel drivers, sip and gtalk:

make menuselect

Make sure that chan_sip, chan_gtalk and chan_jingle are available and selected. These are marked as "deprecated" but still work.

 **************************************************
 Asterisk Module and Build Option Selection
 **************************************************
      Press 'h' for help.

      Add-ons (See README-addons.txt)
      Applications
      Bridging Modules
      Call Detail Recording
      Channel Event Logging
--->  Channel Drivers
      Codec Translators
      Format Interpreters
      Dialplan Functions
      PBX Modules
      Resource Modules
      Test Modules
      Compiler Flags
      Voicemail Build Options
      Utilities
      AGI Samples
      Module Embedding
      Core Sound Packages
      Music On Hold File Packages
      Extras Sound Packages

The final step is to compile everything:

make
make install
make samples

Now the fun part -- configure the sip.conf and extensions.conf files in your working Asterisk system: these are found in /etc/asterisk. To get an Asterisk command-line, use the shell command asterisk -r:

# asterisk -r
Asterisk 11.6.0, Copyright (C) 1999 - 2013 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 11.6.0 currently running on server (pid = 57157)
www2*CLI>

An excellent place to start is the Asterisk Wiki, under "Beginning Asterisk."