Está en la página 1de 6

CloudCrunch How-to: Asterisk PBX and Amazon EC2 (PREVIEW)

Author: Ronald Lewis, CloudCrunch


Released: TBA

Welcome!

This CloudCrunch How-to 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 less than 20 minutes, you'll be up and
running with a robust telephony platform "in the cloud". This guide is
based on months of evaluating and testing Asterisk in a cloud
environment and it represents the best practice for all future EC2
deployments.

NOTE: THIS PREVIEW RELEASE IS NOT THE FINAL VERSION OF THIS


DOCUMENT. COPY, FORMAT AND LAYOUT IS SUBJECT TO CHANGE PRIOR TO
OFFICIAL RELEASE

Assumptions

• You have an active Amazon AWS account


• You are familiar with launching instances

Requirements

• Mozilla Firefox (download)


• Firefox Plugin: Elasticfox for Amazon EC2 (download)
• 20 minutes of your time

Getting Started

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

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

(Insert screenshots of adding ports with Elasticfox)

CloudCrunch How-to: Amazon EC2 and Asterisk PBX. Copyright 2008 CloudCrunch and Ronald Lewis.
CloudCrunch How-to: Asterisk PBX and Amazon EC2 (PREVIEW)
Author: Ronald Lewis, CloudCrunch
Released: TBA

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

(Insert screenshots of selecting AMI and AKI)

Compiling and Customizing Asterisk

We're almost there!

We'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. Why compile the source code of Asterisk? It's
great practice to learn how to independently create the bits for the world's best open source PBX! It's
painless!

Let's get started:

• 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 subversion

WARNING: DO NOT INTERRUPT THIS PROCESS. PLEASE WAIT UNTIL ALL


COMPONENTS HAVE BEEN INSTALLED.

Getting closer!

Let's proceed to download Asterisk's source code, shall we? At the command line, enter the following:

: cd /mnt

: mkdir source

CloudCrunch How-to: Amazon EC2 and Asterisk PBX. Copyright 2008 CloudCrunch and Ronald Lewis.
CloudCrunch How-to: Asterisk PBX and Amazon EC2 (PREVIEW)
Author: Ronald Lewis, CloudCrunch
Released: TBA

: cd source

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

: cd asterisk

: ./configure

SKIP THIS (re-add menu option later)

: cd /mnt

(this section is under revision; continue to 'finally, we can compile Asterisk')

Customize Asterisk using menu:

> *down arrow* to option 12 > *down arrow* to option 4 > clear option with *space bar* >
*up arrow* to option 1 > select option with *space bar*

> return to main menu with *left arrow*

> Type 'x' to exit and save options

Finally, we can compile Asterisk!

Asterisk is now configured for showtime! Now, let's compile the bits for a great piece of software. At the
command prompt, enter the following:

: make install

: make samples

CloudCrunch How-to: Amazon EC2 and Asterisk PBX. Copyright 2008 CloudCrunch and Ronald Lewis.
CloudCrunch How-to: Asterisk PBX and Amazon EC2 (PREVIEW)
Author: Ronald Lewis, CloudCrunch
Released: TBA

We've reached the finish line! You've just prepared, configured and compiled
your very own world-class PBX "in the cloud" on Amazon EC2. Now, let's
configure our dialplan and soft phone for testing.

At the command prompt, enter the following:

: cd /etc/asterisk

: nano sip.conf

IMPORTANT! Please edit sip.conf according to the instructions below.

Find ';disallow=all' and remove the ';' symbol


Find ';allow=ulaw' and remove the ';' symbol
Find '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 ";"
Find ';nat=' and remove ';' and add 'route' after '='

Add the following to the END of the sip.conf configuration file (we'll use this with our
softphone to test the configuration)

[1234]
type=friend
callerid="Asterisk" <1234>
host=dynamic
canreinvite=no
secret=1234
dtmfmode=rfc2833
context=default
qualify=yes (IMPORTANT -- Our softphone WILL NOT work without this designation)

Save the changes in Nano by pressing 'CTRL + X'

EDIT EXTENSIONS.CONF

At the command prompt, enter the following:

CloudCrunch How-to: Amazon EC2 and Asterisk PBX. Copyright 2008 CloudCrunch and Ronald Lewis.
CloudCrunch How-to: Asterisk PBX and Amazon EC2 (PREVIEW)
Author: Ronald Lewis, CloudCrunch
Released: TBA

: nano extensions.conf

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

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

exten => *98,1,VoiceMailMain


exten => *98,2,Hangup

Start Asterisk

: asterisk

(Starts Asterisk PBX)

: asterisk -r

(Launches Asterisk management console)

Configure X-Lite
(add screenshots of configuring X-Lite)

username: 1234
password: 1234
authorization name: 1234
domain: <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-Lite
2. Enter '*98'
3. Click 'Send'

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

CloudCrunch How-to: Amazon EC2 and Asterisk PBX. Copyright 2008 CloudCrunch and Ronald Lewis.
CloudCrunch How-to: Asterisk PBX and Amazon EC2 (PREVIEW)
Author: Ronald Lewis, CloudCrunch
Released: TBA

Congratulations! You have a fully functioning Asterisk PBX on Amazon EC2.


Welcome to a new era of telecommunications!

CloudCrunch How-to: Amazon EC2 and Asterisk PBX. Copyright 2008 CloudCrunch and Ronald Lewis.

También podría gustarte