[How-to] Host PBXact or PBXact SaaS on Azure

This step-by-step guide aims to help anyone install and start using PBXact or PBXact SaaS on the Azure hosting platform.

NOTICE

While no incompatibilities between the FreePBX ISO and Azure's hosting platform have been detected at the time of writing this guide, Sangoma does not officially Support hosting FreePBX/PBXact on platforms other than Sangoma Cloud. This means that, while Sangoma Support Services may still be accessed, any platform-related issue will not be covered.

PRE-REQUISITES

 

OPTIONAL PRE-REQUISITES FOR QUICKER UPLOAD OF THE VIRTUAL HARD DISK DRIVE FILE

 

Create a Virtual Machine and Install the FreePBX ISO on it

Create the local VM

The following Steps are done inside the Hyper-V Manager application:

  1. Create the Virtual Machine:
    Action > New > Virtual Machine...

    1. Specify Name and Location: give your VM any Name (example: PBXact)

    2. Specify Generation: Generation 2

    3. Assign Memory: depends on your PBX processing needs (number of users, concurrent calls, etc.). As examples of general approximates: 2GB could prove to be enough for up to 25 users, while 4GB could prove to be enough for up to 100 users

    4. Connect Virtual Hard Disk: set the Size of the virtual hard disk drive file

      Note: the size will depend on your PBX storage needs, 10GB minimum are recommended for basic PBXact operation. If calls are to be recorded, the disk size would need to be accordingly bigger, considering that each minute of recorded SIP audio consumes ~1MB of disk space. The size here should be in accordance with Azure's plan which we'll select later

      1. Installation Options: for the Media, select the previously downloaded FreePBX .iso file

    5. Click Finish to create the VM

  2. Edit the Settings of the VM:
    right-click on the VM name > Settings...

    1. Security: make sure the option "Enable Secure Boot" is disabled

    2. Click OK to save an apply the changes

 

Install FreePBX onto the local VM

  1. Start the VM: double-click on the VM name and then click on Start in the VM window that will be displayed

  2. The first screen of the FreePBX installation will get displayed, select:
    FreePBX 15 Advanced Installation > Advanced Installation with Normal Video > Advanced Install with Asterisk 16 via Standard Video

  3. The installation UI will load up and get displayed:

    1. INSTALLATION DESTINATION

    2. make sure the hard disk drive is selected (this is the default) and click Done

    3. select partition scheme as: Standard Partition

    4. Click here to create them automatically

    5. select the swap partition and press the "-" sign to delete it

    6. click on Done twice

    7. Accept Changes

    8. Begin Installation

    9. The installation will begin; while the installation is running set the root password and take note of it

    10. Once the installation is complete, click on Reboot on the lower right corner of the VM's screen

 

Adjust the FreePBX VM for Azure

  1. Log into FreePBX's Linux console as root user (use the password set in step 3.i. above)

  2. FreePBX's banner/MOTD will get displayed showing its DHCP-obtained IP address, use it to login rather via SSH

  3. Once inside the SSH session as root user, execute all of the following commands one by one in order (adjust the 2048 in line 16 accordingly depending on amount of swap memory, in MBs, appropriate for your environment):

    echo -e "NETWORKING=yes\nHOSTNAME=localhost.localdomain" > /etc/sysconfig/network echo -e "DEVICE=eth0\nONBOOT=yes\nBOOTPROTO=dhcp\nTYPE=Ethernet\nUSERCTL=no\nPEERDNS=yes\nIPV6INIT=no\nNM_CONTROLLED=no" > /etc/sysconfig/network-scripts/ifcfg-eth0 ln -s /dev/null /etc/udev/rules.d/75-persistent-net-generator.rules echo -e "\n\n[openlogic]\nname=CentOS-\$releasever - openlogic packages for \$basearch\nbaseurl=http://olcentgbl.trafficmanager.net/openlogic/\$releasever/openlogic/\$basearch/\nenabled=1\ngpgcheck=0" >> /etc/yum.repos.d/CentOS-Sources.repo yum clean all sed -i 's/.*GRUB_CMDLINE_LINUX.*/GRUB_CMDLINE_LINUX="rootdelay=300 console=ttyS0 earlyprintk=ttyS0 net.ifnames=0"/' /etc/default/grub grub2-mkconfig -o /boot/grub2/grub.cfg sed -i 's/.*add_drivers+.*/add_drivers+=" hv_vmbus hv_netvsc hv_storvsc "/' /etc/dracut.conf dracut -f -v yum install python-pyasn1 WALinuxAgent -y systemctl enable waagent sed -i 's/.*ResourceDisk.Format.*/ResourceDisk.Format=y/' /etc/waagent.conf sed -i 's/.*ResourceDisk.Filesystem.*/ResourceDisk.Filesystem=ext4/' /etc/waagent.conf sed -i 's/.*ResourceDisk.MountPoint.*/ResourceDisk.MountPoint=\/mnt\/resource/' /etc/waagent.conf sed -i 's/.*ResourceDisk.EnableSwap.*/ResourceDisk.EnableSwap=y/' /etc/waagent.conf sed -i 's/.*ResourceDisk.SwapSizeMB.*/ResourceDisk.SwapSizeMB=2048/' /etc/waagent.conf waagent -force -deprovision export HISTSIZE=0 poweroff

     

Convert the Disk Format and Type of the virtual hard disk file

  1. Back again in the Hyper-V Manager application, enter to edit the Settings of the VM once again:
    right-click on the VM name > Settings...

    1. Hard Drive:Edit

      1. Choose Action: Convert

        1. Choose Disk Format: VHD

        2. Choose Disk Type: Fixed size

        3. Configure Disk: set the Name of the virtual hard disk including the complete path before it

          Note: take note of the complete location where the virtual hard disk file will get created and stored as it will be needed later (by default in Windows for example: C:\Users\Public\Documents\Hyper-V\Virtual Hard Disks\myhdd.vhd)

    2. Click Finish to convert the virtual hard disk drive file

  2. After a few moments, the virtual hard disk file will have the correct format and type for using it in Azure

Set up Azure

Prepare Azure for receiving the VM's hard disk drive file

The following Steps are done inside your Azure Portal: 

  1. Search for and open Storage accounts (not Storage accounts (classic)) and click on "Create storage account". Set the parameters similarly to the following:

     

  2. Click Create

  3. Once the Storage account has been created, open it: search for and open Storage accounts (not Storage accounts (classic)) and click on the storage account just created ("pbxactsan" in this example) in order to create the Container:

     

  4. Click to open the Container just created ("pbxact-container" in this example), and then click on Upload in order to upload the virtual hard disk drive file of your local FreePBX VM machine (see note on step 2.b.i.3. above for the exact location of this file inside your local computer). After locating and selecting the file, click on the Upload blue button. The upload will begin.

IMPORTANT

A considerably faster method for uploading the virtual hard disk file (better transfer speeds as well as smaller file uploaded due to efficient compressing) is the following:

After meeting the OPTIONAL PRE-REQUISITES listed at the beginning of this guide, execute the following command in the command line (if using Windows, PowerShell is recommended over cmd)(change the parameters in italics accordingly):

C:\Go\bin\azure-vhd-utils\azure-vhd-utils.exe --verbose upload --localvhdpath 'C:\Users\Public\Documents\Hyper-V\Virtual hard disks\myhdd.vhd' --stgaccountname 'storageaccountname' --stgaccountkey 'ThEStoRagEacCountKEyOFYourazUreStORaGEacCoUNt==' --containername 'container_name' --blobname 'name_for_the_disk_file_to_receive_once_uploaded.vhd'

 

The Storage account key (stgaccountkey) is seen in the Azure Portal under: the Storage account > Access keys

 

Create Azure's Image using the uploaded virtual disk file and then Create the VM  off of that Image

  1. After uploading is complete, back in Azure Portal: search for and open Images and click on "Create image". Set the parameters similarly to the following (Browse for and Select the .vhd file just uploaded in the previous step):

  2. Click Create

  3. Once the Image has been created, open it: search for and open Images and click on the Image just created ("PBXact_image" in this example) in order to create the Virtual Machine:

     

  4. Create the VM similarly as follows --- IMPORTANT: select the Size (plan) according to your PBX processing needs (number of users, concurrent calls, if the calls will use demanding features such as recording, queueing, transcoding, encryption, etc.).
    As examples of general approximates: 2GB-1CPU could prove to be enough for up to 25 users doing up to 15 concurrent simple calls, while 4GB-2CPUs could prove to be enough for up to 100 users doing up to 60 concurrent simple calls. It all depends on the specific needs of each particular scenario.

     

    Note: remember the Username and Password set here as those credentials will be used the first time you'd want to access the console (SSH)

  5. Click on "Review + create" and then on "Create"

  6. After some minutes your VM will be completely created and ready to be used. To access it just search for and open Virtual machines and click on the Virtual machine just created ("PBXact15" in this example). An Overview of the VM will be displayed showing its assigned public IP address of your newly hosted PBX, use this IP for all communications (webUI and SSH access, SIP, Zulu Desktop, etc.).

 

Optional recommended steps

White list your Public IP address for all traffic coming from your public IP towards your newly created VM in Azure and remove all other public access:

  1. Search for and open Virtual machines and click on the Virtual machine just created ("PBXact15" in this example)

  2. Click on "Networking" and then on the "Add inbound port rule" button. Add the rule as follows (substitue 1.2.3.4 accordingly with the public IP address from where you are connecting to the hosted PBX VM):

     

  3. After having confirmed the rule is working as expected, proceed to delete all other public rules (would be the other ones also with their Priority assigned within the 300s range):

Transform FreePBX to PBXact or PBXact SaaS

The final step is just to transform the FreePBX brand new installation into PBXact or PBXact SaaS. For this, just use your previously acquired PBXact/PBXact SaaS Deployment ID when activating this FreePBX instance: open an SSH session using the credentials set when creating the VM in Azure (step 4 just above) and execute the following command as root user:

sudo su

(in order to change to root user)

fwconsole sysadmin activate depID_of_pbxact

(change depID_of_pbxact accordingly to your PBXact/PBXact Saas Deplyment ID)

 

If, after the complete execution of the command above, the webUI would not complete or not yet reflect PBXact's style, execute the following additional commands:

and then, repeat the activate command if needed.

 

Return to Documentation Home I Return to Sangoma Support