tiago.herrmann at canonical.com
Sun Mar 19 14:50:54 UTC 2017
Over the past few weeks I have been working on a FreePBX snap in my spare time.
My motivation is that I have a raspberry pi at home running asterisk
for about 2 years now, and would like to switch to ubuntu core at some
I used the nextcloud snap as a starting point and finally got the
basic features working. (Access to the web administration interface,
create extensions, make calls, and access to the voicemail)
After installing the snap, FreePBX will be available at
I had to workaround a couple of things to get all the pieces confined
(asterisk and freepbx mainly), so I will report some of them here. I
am still learning snap so I bet there are better ways to do it.
1) Asterisk running fine right after snap installation, but failing afterwards.
After a lot of debugging I figured asterisk was crashing with SIGSYS,
and found that the asterisk binary tries to call chown(), setgid() and
other syscalls that are only allowed during installation (which
explains the behavior I was seeing). My workaround was to add these
calls to the snacraft-preload part that Sergio wrote and preload
asterisk with it. These calls always return success for now just to
keep asterisk happy. If you guys know a better way to workaround it, I
would be happy to remove this hack.
2) Asterisk crashes trying to acess alsa directly.
I found this alsa wrapper from Jamie, and it fixed the crash:
3) Hardcoded paths in FreePBX.
I had to manually change most of the code to prepend a prefix to the
paths. The prefix is retrieved from an environment variable that is
exported in the wrapper scripts. The modified code is temporarily
hosted in my github and retrieved as a remote part.
4) Asterisk configuration files moved to $SNAP_DATA.
While this could become a security issue, freepbx has to overwrite
asterisk configuration files in runtime. I did not find a better way
to do it so far.
5) Long time to get the FreePBX fully installed/available.
During the first launch I am running the FreePBX installation scripts.
Sometimes it can take up to 5 minutes to get everything in place and
to get the web administration tool available.
6) FreePBX signs all files and prints in the UI a security warning
informing the admin if any file is different from upstream.
For now the web administration interface shows a security warning
showing all files I changed to make it work as a snap. It won't impact
the functionality, but maybe I will need to find some way to re-sign
7) CDR reports still not working.
This needs further investigation.
8) I have been testing this snap only on amd64.
I quickly tested it on arm64 a few weeks ago and asterisk failed to
run. Fixing this issue is my next priority for now.
Any help would be appreciated.
More information about the Snapcraft