Running Asterisk on Amazon AWS

How Can You Run Asterisk on Amazon AWS

First thing to do is to install Amazon AWS's free tier Ubuntu 18 LTS, then you use these commands to install and configure it.   Install your amazon ubuntu server, then configure the amazon firewall to forward ports: 5060-5070, and 16384-32767 all udp to the VM.  If you have a Sonicwall router in your home network, be sure to go to the SIP menu, and enable SIP and H323 transformations.

    8  apt -y upgrade
    9  apt update
   10  apt -y upgrade
   11  apt -y install git curl wget libnewt-dev libssl-dev libncurses5-dev subversion  libsqlite3-dev build-essential libjansson-dev libxml2-dev  uuid-dev
   12  add-apt-repository universe
   13  apt update
   14  apt -y install subversion
   15  apt policy asterisk
   16  cd /usr/src
   17  curl -O http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-16-current.tar.gz
   18  ll
   19  tar xvf asterisk-16-current.tar.gz
   20  cd asterisk-16.6.2/
   21  ll
   22  ./contrib/scripts/get_mp3_source.sh
   23  ./contrib/scripts/install_prereq install
   24  ./configure
   25  make menuselect
   26  make
   27  make install
   28  make samples
   29  make basic-pbx
   30  make progdocs
   31  make samples

then you need to edit sip.conf. add these make sure [general] has this:
[general]
context=phones          ; Default context for incoming calls. Defaults to 'default'
allowoverlap=no         ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0     ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
tcpenable=no            ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0     ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
transport=udp           ; Set the default transports.  The order determines the primary default transport.
srvlookup=yes           ; Enable DNS SRV lookups on outbound calls
subscribecontext=phones
allowsubscribe=yes              ; Disable support for subscriptions. (Default is yes)
qualify=yes
qualifyfreq=30                 ; Qualification: How often to check for the host to be up in seconds
keepalive=30                   ; Interval at which keepalive packets should be sent to a peer
notifyringing=yes             ; Control when subscriptions get notified of ringing state.
notifyhold=yes               ; Notify subscriptions on HOLD state (default: no)
nat=force_rport,comedia  ; Set the force_rport option if Asterisk detects NAT (default)
directmedia=no                ; Asterisk by default tries to redirect the
localnet=172.16.17.0/255.255.252.0      ;; my permanent ipv4 on amazon private network
nat=yes
externip=3.87.197.70    ;; my temporary amazon ipv4 public address.

then add some peers
[mike]
        type=peer
        context=phones
        allow=ulaw,alaw,g723,g729
        secret=mypasswordhere
        host=dynamic
        description=Mike Martin<123>
        directmedia=no                  ; Typically set to NO if behind NAT
        callerid=Mike
        mailbox=2500@default            ; Mailbox(-es) for message waiting indicator
        subscribecontext=phones
        allowsubscribe=yes
[john]
        type=peer
        context=phones
        allow=ulaw,alaw,g723,g729
        secret=mypasswordhere
        host=dynamic
        description=John Martin<123>
        directmedia=no                  ; Typically set to NO if behind NAT
        callerid=Johnson@phones
        mailbox=2501@default            ; Mailbox(-es) for message waiting indicator
        subscribecontext=phones
        allowsubscribe=yes

then extensions.conf
;THIS IS A CONTEXT CALLED PHONES
[phones]
exten => 100,1,NoOp(Call for mike)
exten => 100,2,Dial(SIP/mike,5)
exten => 100,3,VoiceMail(2500@default)
exten => 100,4,Hangup
exten => 102,1,NoOp(Call for john)
exten => 102,2,Dial(SIP/john,5)
exten => 102,3,VoiceMail(2501@default)
exten => 102,4,Hangup
exten => 104,1,NoOp(Call for biff)
exten => 104,2,Dial(SIP/biff,5)
exten => 104,3,VoiceMail(2600@default)
exten => 104,4,Hangup
exten => 123,1,Answer
exten => 123,2,Playback(tt-weasels)
exten => 123,3,Voicemail(2500)
exten => 123,4,Hangup

then voicemail.conf
[default]
1234 => 54321,Example Mailbox,root@localhost
6245 => 54321,Biff Martin,biff.martino@gmail.com,,Tz=european
2500 => 54321,Mike Martin,biff.martino@gmail.com,,Tz=european
2501 => 54321,John Martin,biff.martino@gmail.com,,Tz=european
2600 => 54321,Biff Martin,biff.martino@gmail.com,,Tz=european

Finally, use ZOIPER to add a phone for mike or john.

Finally You need to install Voicemail to Email

apt install ssmtp

Comments

Popular posts from this blog

Microsoft Visio 2010 Premium Product Keys

Mercedes Benz Diesel CDI EGR Emulator Circuit Diagrams

Fix: The Diagnostic Service Host service failed to start due to the following error. [ solved, no kidding ]