customer communication platform

Aavaz Free PBX in the Cloud with GCP and Twilio

October 1, 2021 487 No Comments

Some assumptions before you start:

  1. You have basic understanding of linux and docker
  2. You understand concepts of firewalls
  3. You have never worked with Google Cloud Platform (GCP)
  4. You have never worked with Twilio

Overall Process

  1. Create an instance on GCP along with opening firewall rules
  2. Create a SIP trunk on Twilio
  3. Install Aavaz Free PBX on the GCP Virtual Machine
  4. Configure the Aavaz PBX from your browser

Key Terms

  • SIP Trunk is what allows you to call to
  • Instance and Virtual machine are used interchangeably and are essentially like physical computers or servers

Signup with GCP and Spin Up an Instance

Signup with GCP

When you signup with GCP you get $300 in free credits. The average cost for running a “Virtual Server” or instance for Aavaz PBX is about $50 a month as setup in this how-to.

Spin Up a GCP Instance

Please follow this Google Provided Quickstart using a Linux VM. Once you’re done you will have an Ubuntu Linux virtual machine (VM) running.
You can click on the “Guide Me” button and follow the instructions.
Here are recommended values for the settings:
Feel free to change them if you are comfortable.

  • Name: aavaz-pbx-1
  • Region: Pick a region that is closest to you. Any zone will be ok.
  • Machine Family: General Purpose
  • Series: E2
  • Machine Type: e2-standard-2 (2 vCPU, 8 GB memory)
  • Operating System: Ubuntu
  • Version: Ubuntu 20.04 LTS
  • Boot disk type: Balanced persitent disk
  • Size: 20GB
  • Firewall: Allow http access and Allow https access
  • Network tag: aavaz-pbx (Expand Networking) This will be used in creating some firewall rules later

Once the instance is created copy the external IP address. We will refer to this as the “instance-external-ip” and will need it later for Twilio and to access your Aavaz PBX.

Configure a Firewall Rule

On the VM instances page, look in the Name column to find the VM instance you created.
Click into the “aavaz-pbx-1” you created from above.
Find “Network interfaces” on the page and click on the Network. Most likely called “default”
Click on the “FIREWALL RULES” tab and then “ADD FIREWALL RULE”.

Firewall Settings:

  • Name: aavaz-pbx-services
  • Target tags: aavaz-pbx
  • Source IP ranges: 0.0.0.0/0
  • Specified protocols and ports:
  • tcp: 5060-5061, 10000-30000
  • udp: 5060-5061, 10000-30000

Signup with Twilio and Setup a SIP Trunk

Signup with Twilio

Singup for a Twilio Account. You can are given some free usage with Twilio but with restrictions. Here’s what is available for free.

For our purposes the free account allows us to make use of “Elastic SIP Trunking” as described here.

Don’t forget to verify your numbers if you’re only planning on working with a free account.

Setup a SIP trunk

We will do the following

  1. Allow your new virtual machine in GCP to work with Twilio by adding it’s IP to access control lists
  2. Get a phone numbers
  3. Setup a SIP trunk using the 2 items above

Steps to follow

    1. Navigate to “Phone Numbers” -> “Manage” -> “Buy a number”
      a. Search for a number with “Voice” capabiliy in your country and “buy” one you like.
    2. Navigate to “Elastic SIP Trunking” -> “Manage” -> “Trunks”
      a. Click on “Create new SIP Trunk”
      b. Friendly Name: Aavaz-PBX
      c. “General” Section:
      • All defaults are fine.
      • Ensure “Symmetric RTP” is enabled.

      d. “Origination” Section:

      • Termination SIP URI: your-name-aavaz-pbx and then SAVE
      • Authentication: IP Access Control List: Select aavaz-pbx-ips and then SAVE

      e. “Termination” Section:

      • Click on the “+” icon to add a new entry
      • “Origination SIP URI”: you have to add “sip:instance-external-ip”. e.g., “sip:10.34.5.215”

      f. “Numbers” Section:

      • Select the number you previously bought and then SAVE

    You should be all set.

    Install and Configure Aavaz Free PBX

    Install the Aavaz Free PBX

    On the VM instances page, look in the Name column to find the VM instance you created.
    In the Connect column of the VM instance, click SSH.
    A new cmd window opens showing you are connected to your VM terminal.

    Install docker if you haven’t already

     
        
          curl -fsSL https://get.docker.com -o get-docker.sh
          sudo sh get-docker.sh
          sudo systemctl enable docker
          sudo systemctl start docker

      Pull the Aavaz PBX image and run the container

         
            sudo docker pull aavaz/pbx:latest
            sudo docker volume create aavaz
            sudo docker volume create aavazRec
          sudo docker run -itd --name aavazpbx --privileged--network host -v aavazRec:/mnt/aavazRec -v aavaz:/aavaz/deploy/db aavaz/pbx:latest /aavaz/start.sh /bin/bash
        

          Configure the Aavaz Free PBX

          Open your browser on “http://instance-external-ip” and complete steps 1, 2, 3 to be up and running.

          Stay tuned for more instructional information and videos shortly.