roller24's picture

I have been working on getting a pbx deployed with turnkey, using turnkey-lxc as a baremetal host.

I thought I would share some fails and successes here for anyone interested, or anyone who would like to take this to another level of development. 

I am very unfamiliar with git, aws, and virtual stacks as a whole, and would not consider myself as proficient enough to deploy a truly secure environment for any large enterprise systems. My interest atm is to develop a very lightweight efficient office machine for SOHO environments to provide myself, and hopefully some future clients. I am a network tech with CompTIA A+, Network+, and hopefully by summer Security+ certifications. I deal with a lot of phone systems, cctv, and small commercial networks. 

Proxmox, sounds interesting for a development platform, and would maybe be best suited as the bare metal host for future deployments and I will look into it at some point, but at present, it sounds more like a pharmacutical drug, than a IT platform, and I know nil about it, so I'm going to stick with Turnkey_LXC as my host, and perhaps migrate towards PM in the future.

My test environment is a small computer I picked up for free, which has minimal resources :

250 gb harddrive, 8gb ram, 64bit amd dual core processor, and 2 nics one being gigabit speed, and the other fast ethernet. I haven't really found a need for 2 nics, so I use the Gigabit port. 

My host is Turnkey-LXC appliance, as I was impressed by it's easy use and quick deployment of other TK appliances. So far my only real issues have been with the appliance features, odoo, for example is very complex, and takes quite a bit of knowledge to navigate and use. 

Back to the PBX. 

First attempt was partially successful, but not very stable, I use FREEPBX as I am familiar with it , and can  navigate and deploy without too much chaos, I consider it to be the standard for Asterisk front ends, and have the utmost confidence in it's security features. 

I had already deployed WP , Zoneminder, and Odoo as guest LXCs on the TKLXC host, and all were functioning as expected. Because there is no TK-PBX I decided to install from source on TKL CORE as a guest . It appearred to go well and I was happy for a time, then some anomolies arose:

 1.      Because Freepbx is built on top of RedHat, the available commercial modules are not available, this limits the functionality and also prevents use of many modules, including the responsive firewall, which I like to use.

 2.     Although calls were successful 100% of the time, media was not. Sporadic failures with no error messages caused no sound from either side about 50% of the time. This renders a phone system useless. I suspect that this had something to do with passing the media from the host to the guest, and concluded that a PBX needed to reside either at the host level or in a VM as opposed to an LXC.

My second trial was finding a Debian based PBX which I was able to find, and which may be useable at some point, called Fusion PBX. it is a very nice system, built on Switch, not Asterisk. I used the install script from within the LXC host as opposed to building a separate APP, and it installed fine and I was able to access the GUI web interface, on the same ipaddr as the host. However the unfamiliarity of the software made configuring, and deployment appear more daunting than I was ready to tackle, so I've put this on the back burner, thinking that it may work well as a guest on core, with more stability than a RedHat variant. It had quite a few advantages for station provisioning which arent available in Freepbx, but lacked other features like Hospitality and CRM which are available in FreePBX. Never the less this may be a good candidate for an Turnkey-LXC Appliance.

I experimented with TKL Dev, but again, I have much to learn about this before I attempt an appliance of that sophistication level.

So My third endeavor was a KVM install of the FreePBX distro with virt-install. 

I made sure everything was ready for a VM by using the guidance at 

https://www.cyberciti.biz/faq/install-kvm-server-debian-linux-9-headless...

down to the part where the Centos was going to be deployed.

After some trial and error, I downloaded the distro for freepbx and placed it in a local directory and also install virt-viewer, which maybe wasn't needed, but I was having difficulty with the console. I think it was a syntax in the script to install, but what ended up working was this:

virt-install \
--name freepbx \
--ram 2048 \
--disk path=/var/lib/libvirt/images/freepbx.qcow2,size=20,bus=virtio,format=qcow2 \
--vcpus 2 \
--os-type linux \
--os-variant generic \
--network bridge=br0 \
--graphics none \
--console pty,target_type=serial \
--location /var/lib/libvirt/boot/SNG7-FPBX-64bit-1805-2.iso \
--extra-args 'console=ttyS0,115200n8 serial'

On install, I had to re-set many of the settings, and I'm not sure if the above settings, ever made it through, but ended up with a working FreePBX VM. I then ran:

virsh autostart freepbx

to ensure it loaded on reboots of the host.

The firewall built in requires no other firewalls be used, so I set the ipaddr as a DMZ on my internet router, and allowed all traffic to pass through to the ipaddr on the host firewall. 

I'm sure this will keep fail2ban very busy, so I'm gonna watch those logs very carefully for a while.

The calls are going through and the sound is working 100% as expected, so I'm happy with this and will report any issues here.

 

 

 

Forum: 
Jeremy Davis's picture

Great post. Thanks for sharing your experience and the info your discovered. That's awesome.

FWIW I find Proxmox a breeze to use. Although in fairness, I've been using it for years, so it may not be as intuitive as I tend to think it is... IMO the beauty is that is provides both LXC containers and "proper" VMs via (QEMU/KVM) along with a really powerful and (IMO) easy to use web UI.

So it sounds like you have more or less recreated the same environment within your LXC appliance (by installing support for "proper" VMs via libvirt). AFAIK, libvirt can also be used with LXC, although I'm not sure how it would interact with our default LXC setup.

As a general rule, I prefer CLI tools, however because I started using Proxmox before I ever got really comfortable at the commandline, I've never really used LXC or QEMU/KVM to any significant degree from the commandline. It is worth noting though that Proxmox has it's own set of commandline tools, and isn't compatible with libvirt.

Re the specifics of you experience, it all sounds pretty cool although I'm sure was perhaps a disappointment that you couldn't get it running smoothly and reliably on TurnKey Core.

As for using TKLDev, I would not recommend that you start looking at that in too much detail, until you can get your desired functionality working reliably on TurnKey Core. So long as you take good notes along the way of how you created the work TurnKey Core based new appliance, converting it to TKLDev build code is essentially pretty easy. Obviously there is devil in the detail and sometimes something that is a breeze to do interactively, can be a bit tricky to do non-interactively. But we've developed plenty of tricks to tackle that. So when the time comes, I'm more than happy to assist with pointers and feedback.

So great work and good luck with your future adventures! :)

roller24's picture

looks as though my set up has rendered some network issues on the guest LXCs so I'm going to jump right in to proxmox and avoid having to troubleshoot the network configurations. I think this will be beneficial in the long run, if I ever reach a point that I wan't to migrate this to aws, if everything is vm'd then I think it will be less aggrivating.

roller24's picture

Once I looked past the complexity, I was able to see the simplicity. The initial attempts to create a VM, led me quickly to documentation. After finding how the file storage structure was setup for iso's and such, I was able to spin up the pbx vm very easily. I'm going to add 2 containers today, and then start on some content. I like the way that PM lays out the "data center" and "nodes". This really simplifies for customization of various deployments and scaling, so a certain flavor of odoo for example can be set up for say, a small hotel, and another can be set up for a restaurant or service company. Kind of like making templates for future deployments. 

Jeremy Davis's picture

Also not sure if you've noticed, but the TurnKey LXC containers (same builds as you can download within the TurnKey LXC appliance) are available for download within the PVE UI. Out of interest, we actually target them to Proxmox, then tweak them a little for usage in TurnKey LXC appliance (the Proxmox builds pre-date the LXC appliance).

John Carver's picture

Congratulations on getting FreePBX running.  If I understood you correctly, you were only successful in getting it to run in a virtual machine (VM) and not a container because FreePBX is based on CentOS and not Debian.

At a previous job, I was tasked with becoming an Asterisk expert so our company, The Starken Group, could provide VoIP services to our small business customers.  It did not go well.  Since then I've tried several versions based on FreePBX including Ward Mundy's Incredible PBX.  Several years ago I started investigating how to build a VoIP PBX on TurnKey core.  I came to the conclusion that FreeSWITCH was superior to Asterisk for a number of reasons including license issues.  At that time I was looking at 2600hz.org's offering which at the time was called the BlueBox.  It has since been renamed Kazoo and the Monster UI added.  See https://2600hz.org/ for more details.

I'm a little concerned about FusionPBX's license agreement, or rather the lack of one.  Although all code uploaded to GitHub's free public repos is supposed to be open-source, the lack of a published GPL license triggers my 'spidey sense'.

AFAIK, there is no technical reason why a VoIP PBX can't run in a container although it might have to be privileged.  I think Ward Mundy discussed that in a blog post some time ago.

If you are interested in developing a TurnKey PBX appliance, I'd be willing to help walk you through the TKLdev development process.  I'm currently working on a Mautic appliance for social media marketing automation.

Information is free, knowledge is acquired, but wisdom is earned.

Chrizzle23's picture

I have a few PBX setups for my home and my lab, and I ended up using Proxmox VMs rather than containers. My theory is that Asterisk needs some realtime stuff at the kernel level that just doesn't work for containers. 3CX may work on a container because I have run it on an OpenVZ host with great results.

If anyone is interested, here is my personal setup:

I use and IncrediblePBX server and a 3CX server connected together for my family phone system.  I use Incredible PBX for its flexibility, and 3CX for its easy to use (and network) softphones and webRTC meetings.

IncreidblePBX is based on Scientific Linux and uses the strictly GPL modules from Asterisk + FreePBX. It also has lots of neat gadgets added on, and it comes with a bunch of trunks and extensions already defined. The analogy I like to use is that IncreidblePBX is to Asterisk as Debian is to Linux Mint.

I use Incedible PBX to serve the IP phones and ATA at my house because there is no limitation on the number of trunks, extensions, or simultaneus calls. That way, I can have dedicated trunks for the house phone, office phones, and a conference bridge. I can then use hunt groups and ring groups to deliver calls. For example, a call to my home office line will ring the IP phone on my desk , while a call to the house line will ring the ATA for the analog phones plugged into the house wiring along with the office IP phones.

3CX runs on top of Debian. It's closed source, but there is a free licensed version that does up to 25 extensions and 4 simultaneus calls. That would probably be fine for my house setup, but connecting disparate phone systems together is fun.

The reason I like 3CX is that their softphones are great, and you can get them set up with out making any firewall changes. I use 3CX on a low end hosted OVZ cloud so that my family can use the softphones over WiFi when we travel over seas.

I like to pick up a cheap prepaid sim locally when we travel abroad, and use VOIP to call back home. Outgoing calls from the 3CX server have the same caller ID as our house phone.

Both PBXs have a trunk with the same provider (VOIP.MS) so that they can call eachother for free. 3CX has a phonebook that gets pushed to all of the soft phones, so no one has to remember extension numbers, SIP URIs, or speed dials when they are away from home.

deutrino's picture

Hello folks, found a couple crunchy links for you all:

https://www.freepbx.org/freepbx-16-debian-11-an-apt-combination/

https://wiki.freepbx.org/display/FDT/How+to+Install+FreePBX+16+on+Debian...

I know I've threatened to contribute an appliance build multiple times before, maybe this'll be the one!! lol. Not likely, but if I do end up needing/attempting this, I'll do my best to try to replicate it in TKLDev.

Add new comment