Building a state of the art business VoIP phone system using linux, free software and Amazon EC2 Cloud services. No hardware needed. To learn more about this and other amazing I.T. services, contact FiskIT today! www.fiskinfotech.com
Install initially based on instructions from these sites
http://www.freepbx.org/trac/wiki/UbuntuServer
http://wiki.freepbx.org:8090/pages/viewpage.action?pageId=1409028
http://ubuntuforums.org/showthread.php?t=1986217
Create new instance
     In AWS Console EC2 Dashboard    
          Launch Instance
          Choose Classic Wizard and continue
          Select Ubuntu Server 12.04.1 LTS 64bit
          Change instance type to M1 Small (T1 Micro does not have enough umpf for ivr and whatnot) and continue
          Check box Prevention against accidental termination and continue
          Edit the Storage Device Configuration, uncheck Delete on Termination, hit Save then continue
          Under Name, add a server name for the value
          Choose an existing key pair or create a new key (save this to your desktop and also save a copy somewhere safe.  If you loose it, you wont be able to gain access to the vm ever again)
          Create a new security group
               Group name: voip server
               Group description: voip server rules
               Rules to add:
                    http: 0.0.0.0/0
                    https: 0.0.0.0/0
                    ssh: 0.0.0.0/0
                    udp 5060-5061: 0.0.0.0/0
                    udp 10000-20000: 0.0.0.0/0
               Continue, Launch, Close
Connect to the instance
     In AWS Console, EC2 Dashboard, Instances, right click on the instance and choose Connect
          For private key path, enter the path to the pem file you saved when you created a new key in the previous steps
          Launch ssh client
Update your system:
     apt-get update && sudo apt-get upgrade -y 
     reboot
Install the packages
     apt-get -y install php5-mysql php-db mysql-server libapache2-mod-php5 php5-gd php-pear php-DB sox curl build-essential linux-headers-`uname -r` openssh-server apache2 mysql-client bison flex php5 php5-curl php5-cli libncurses5-dev libssl-dev libmysqlclient15-dev mpg123 libxml2-dev libnewt-dev sqlite3 libsqlite3-dev pkg-config automake libtool autoconf git subversion gcc 
          Set mysql root passwd when prompted
     pear install db
Download Software
     cd /usr/src/
     wget 
https://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
     wget 
http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz
     wget 
http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
     wget 
http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
Install dependencies for google voice
     cd /usr/src
     tar xf iksemel-1.4.tar.gz
     cd iksemel-1.4
     ./configure
     make all install  
For the localization to work properly you may have to edit /etc/php5/apache2/php.ini and modify as follow (leny/sid): 
     ; PHP's built-in default is text/html
     default_mimetype = "text/html"
     ;default_charset = "ISO-8859-1"
     default_charset = "utf8";
Compile and install DAHDI.
     cd /usr/src
     tar xvfz dahdi-linux-complete-current.tar.gz
     cd dahdi-linux-complete-2.6.1+2.6.1
     make all
     make install
     make config
Compile and install LIBPRI.
     cd /usr/src
     tar xvfz libpri-1.4-current.tar.gz
     cd libpri-1.4.14
     make
     make install
Compile and install Asterisk
     cd /usr/src
     tar xvfz asterisk-11-current.tar.gz
     cd asterisk-11.2.1
     ./configure
     contrib/scripts/get_mp3_source.sh
     make menuselect
     make
     make install
     make config
Install Asterisk-Extra-Sounds
     cd /var/lib/asterisk/sounds
     wget 
http://downloads.asterisk.org/pub/telephony/sounds/asterisk-extra-sounds-en-gsm-current.tar.gz
     tar xfz asterisk-extra-sounds-en-gsm-current.tar.gz
     rm asterisk-extra-sounds-en-gsm-current.tar.gz
Setup permissions for asterisk.asterisk
     adduser asterisk --disabled-password --no-create-home --gecos "Asterisk User"
     chown asterisk. /var/run/asterisk
     chown -R asterisk. /etc/asterisk
     chown -R asterisk. /var/{lib,log,spool}/asterisk
     chown -R asterisk. /usr/lib/asterisk
     mkdir /var/www/html
     chown -R asterisk. /var/www/
Modify Apache
     sed -i 's/\(^upload_max_filesize = \).*/\120M/' /etc/php5/apache2/php.ini
     cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf_orig
     sed -i 's/^\(User\|Group\).*/\1 asterisk/' /etc/apache2/apache2.conf
     service apache2 restart
     nano /etc/apache2/sites-enabled/000-default
     Change /var/www to /var/www/html
Download and untar FrePBX
     cd /usr/src
     wget 
http://mirror.freepbx.org/freepbx-2.10.0.tar.gz
     tar zxvf freepbx-2.10.0.tar.gz
     cd freepbx-2.10.0
Configure Asterisk database in MYSQL and set permissions
     export ASTERISK_DB_PW=amp109
     mysqladmin -u root -p create asterisk
     mysqladmin -u root -p create asteriskcdrdb
     mysql -u root -p asterisk < SQL/newinstall.sql
     mysql -u root -p asteriskcdrdb < SQL/cdr_mysql_table.sql
     mysql -u root -p -e "GRANT ALL PRIVILEGES ON asterisk.* TO 
asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
     mysql -u root -p -e "GRANT ALL PRIVILEGES ON asteriskcdrdb.* TO 
asteriskuser@localhost IDENTIFIED BY '${ASTERISK_DB_PW}';"
     mysql -u root -p -e "flush privileges;"
     nano /etc/asterisk/manager.conf
          make sure password for admin is amp109
Patch safe_asterisk script
     sed -i "s|#!/bin/sh|#!/bin/bash|" /usr/sbin/safe_asterisk
#     nano /usr/sbin/safe_asterisk
#          SAFE_AST_BACKGROUND=1
Start asterisk
./start_asterisk start
Create symbolic link for agi-bin
ln -s /usr/share/asterisk/agi-bin /var/lib/asterisk/agi-bin
Install FreePBX
     ./install_amp
     log into fbpx portal via 
http://host/
     Go into advanced settings, make sure password for admin is amp109
     Apply
Wrapping up
     purchase an elastic IP and assign to the instance
     point a domain voip.domain.com to your IP
     log into freepbx via http:// with the username admin and password admin
Install FreePBX Modules
     Under administration, module admin, install the additional modules you want/need, upgrade already installed if available
Setup Extensions, groups, ivr, etc
Setup trunks