8

10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

Embed Size (px)

DESCRIPTION

Congratulations on your choice to use 10 Minutes: Asterisk PBX on Amazon EC2!More than 10,000 Asterisk enthusiasts worldwide have relied on this priceless guide to quickly install Asterisk PBX on Amazon EC2. This quickstart guide will teach anyone how to deploy a functional Asterisk PBX on Amazon's EC2 (Elastic Compute Cloud) service. Asterisk is the world's most popular open source PBX, with millions of installations to date. In 10 minutes or less, you'll be up and running with a robust telephony platform in the cloud. This guide is based on months of rigorous testing in a cloud environment and has been used for Amazon EC2 deployments everywhere. What are you waiting for? Fire up AWS and start reading!

Citation preview

Page 1: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide
Page 2: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

10 Minutes: Asterisk PBX on Amazon EC2Ronald Lewis

Published worldwide by doxonmillsCopyright 2011 © by Ronald Lewis

rev 2.91811

All rights reserved. This ebook is licensed for personal or commercial use only. Nopart of this publication may be sold, reproduced, distributed, transmitted, or stored

using any method without the express written consent of the author and/or publisher,except in the case of reviews or articles. Thank you for respecting the creative work of

this author.

First ebook edition: 2008Purchase a copy for only $2.99 on Amazon (Kindle) or Barnes & Noble (Nook)

Also by Ronald Lewis: Stick it to The Man, Skyhorse Publishing

Contact the author online at [email protected], ronaldlewis.com or twitter.com/ronaldlewis

WELCOME

Thank you for choosing 10 Minutes: Asterisk PBX on Amazon EC2!

More than 10,000 Asterisk PBX enthusiasts worldwide have relied on this pricelessguide to quickly install Asterisk on Amazon EC2.

This quickstart guide will teach anyone how to deploy a functional Asterisk PBX onAmazon's EC2 (Elastic Compute Cloud) service in minimal time. Asterisk is theworld's most popular open source PBX, with millions of installations to date. In 10minutes or less, you'll be up and running with a robust telephony platform in the cloud.This guide is based on months of rigorous testing in a cloud environment and hasbeen used for Amazon EC2 deployments everywhere.

This guide does not cover advanced topics such as dial plans, conferencing, etc. Theprimary goal of this guide is to help you quickly install and run Asterisk in the cloudwith minimal hassle. Running a robust PBX in the cloud has many benefits forindividuals and businesses. By reading this guide, you're taking an exciting step in theworld of telecommunications!

Page 3: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

SUPPORT THE AUTHOR

Support the world's most popular Asterisk PBX on Amazon EC2 guide by trying asponsor below!

• VoIP phones• Asterisk appliances/gear

Or buy the author a coffee for their work by purchasing a copy for only $2.99from Amazon (Kindle) or Barnes & Noble (Nook).

BEFORE YOU BEGIN

Your success with this guide will depend on a few things:

• You have an active Amazon AWS account• You are familiar with launching EC2 instances

REQUIREMENTS

• Internet browser• Firefox Plugin (recommended): Elasticfox for Amazon EC2 (download)• Softphone or VoIP phone (buy now)• 10 minutes

GETTING STARTED

A successful deployment of Asterisk on Amazon EC2 requires that you enable threecritical ports on EC2's firewall. Without them, Asterisk will not work. Thus, thefollowing ports are key to passing RTP packets (for voice) and SIP signaling (fordevices, DTMF codes, etc.):

• 5060 (UDP)• 4569 (UDP)• 10000-20000 (UDP)• 22 (TCP) (You'll need this for SSH access)

Page 4: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

Now that you've enabled the ports necessary for Asterisk to function, it's time tolaunch an instance! Let's use Eric Hammond's Ubuntu AMI (Amazon MachineImage), ami-ce44a1a7, and the 1000HZ AKI, aki-9b00e5f2. This AKI is importantbecause it is specifically compiled for VoIP applications such as Asterisk. Any AKI(Amazon Kernel Image) other than one set at 1000HZ will produce undesirableresults in voice quality and functionality.

BUILDING ASTERISK

You've added the necessary ports and launched the image used for this guide. Now,it's time to compile a few components which are necessary to build Asterisk. Whycompile the source code of Asterisk? It's great practice to learn how to independentlycreate the bits for the world's best open source PBX! It's painless!

Let's begin:

• Open an SSH connection to your newly launched instance• Login as ROOT• Enter the following at the command line:

apt-get -y install libc6-dev g++ gcc libncurses5-dev make subversionWARNING: DO NOT INTERRUPT THIS PROCESS. PLEASEWAIT UNTIL ALL COMPONENTS HAVE BEEN INSTALLED

Getting closer!

Let's proceed to download Asterisk's source code. This is the beginning of the magic.At the command line, type:

cd /mnt

mkdir source

cd /source

svn checkout http://svn.digium.com/svn/asterisk/tags/1.4.21.1 asterisk

Page 5: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

TIP: Asterisk 1.4.21.1 is an older, but stable version. Supplement the versionnumber with a newer one if you prefer

cd /asterisk

./configure

cd /mnt

COMPILING ASTERISK

Asterisk is configured! Now, let's compile the bits for a great piece of revolutionarysoftware. At the command prompt, type:

make install

TIP: Now is a perfect time to make a sandwich, walk the dog, do chores, orbuy a nice VoIP phone. Come back later; You'll need only a few minutes tocomplete the installation

make samples

You've reached the finish line! You've just prepared, configured and compiledyour very own world-class PBX "in the cloud" on Amazon EC2. Your friendswill be jealous. Now, let's configure your dialplan and softphone for testing.

At the command line, type:

cd /etc/asterisk

<favorite text editor> sip.conf

WARNING! Please edit sip.conf according to the instructions below:

Find ';disallow=all' and remove the ';' symbolFind ';allow=ulaw' and remove the ';' symbolFind 'externip = 'and enter the PUBLIC IP address of YOUR instance (e.g.,75.75.101.100)Find ';localnet=" and enter '10.0.0.0/255.0.0.0' after '=' and remove ";"

Page 6: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

Find ';nat=' and remove ';' and add 'route' after '='

Add the following to the END of the sip.conf configuration file (Necessaryto test your softphone with Asterisk)

[1234]type=friendcallerid="Asterisk" <1234>host=dynamiccanreinvite=nosecret=1234dtmfmode=rfc2833context=defaultqualify=yes (IMPORTANT -- Your softphone WILL NOT work withoutthis designation)

Save the changes in your favorite text editor

TESTING ASTERISK

At the command line, enter:

<favorite text editor> extensions.conf

TIP: extensions.conf is the 'traffic manager' of Asterisk. Here, you'll define howAsterisk handles extensions, phone numbers, voicemail and more

Add the following to the END of extensions.conf (this will test the dial plan and seeif we have audio)

exten => *98,1,VoiceMailMainexten => *98,2,Hangup

Launch Asterisk

To load Asterisk, there are just two simple commands. At the command line, type:

Page 7: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

asterisk

To access Asterisk's management console, type:

asterisk -r

Configure X-Lite (or other softphone) to test configuration

username: 1234password: 1234authorization name: 1234domain: <EC2 INSTANCE PUBLIC IP>

IMPORTANT!

• 'Register with domain' should be CHECKED• 'Send outbound via' <DOMAIN> should CHECKED• Be sure to 'enable' your SIP account

Test your Asterisk installation

1. Open X-Lite2. Enter '*98'3. Click 'Send'

You should be greeted with the Asterisk Voicemail System ('Comedian Mail').

Congratulations! You have a fully functioning Asterisk PBX on Amazon EC2.Welcome to the future of telephony. How about a cup of coffee for the author? Buy acopy of this ebook for only $2.99 from Amazon (Kindle) or Barnes & Noble (Nook).Your support is appreciated.

ABOUT THE AUTHOR

Constantly investigating innovative and new ideas, Ronald Lewis is out to change theworld. Through his career as an independent journalist, Ronald has been able toestablish and cultivate relationships with some of the biggest names in technology andthe most talked about names in entrepreneurship. Currently, he is an advocate forseveral revolutionary technologies and serves as an activist against the unknown

Page 8: 10 Minutes: Asterisk PBX on Amazon EC2 -- A Quickstart Guide

injustices which plague our culture. His life of research and interest in just programslead to the publication of his first book, Stick it to the Man, released summer of 2009through Skyhorse Publishing.

Read the author's expanded bio

###