# Tips on installing FreeSWITCH and FusionPBX in debian

I’ve been testing out FreeSWITCH and FusionPBX. I found it non trivial to install in debian. Here are my tips for installing.

1. Don’t bother with the install script. I found it to be broken. And when it breaks during install, it leaves you in a state that’s very hard to understand and fix. In the end it was easier to install FreeSWITCH by hand, get that working, to the extend that you can make inter extension calls, then proceed with the FusionPBX install.
2.  Install FreeSWITCH by following the Quick Install Guide.
3. Commit the entire FreeSWITCH configuration to git so its easy to roll back when you reinstall FusionPBX. Switch to a new branch before making further changes.
cd /usr/local/freeswitch
git init
echo 'db/*' >> .gitignore
echo 'log/*' >> .gitignore
echo '.svn*' >> .gitignore
git commit -m "Initial Commit"
git checkout -b try1

4. Get the latest version of FusionPBX from svn.
cd /usr/src
svn checkout http://fusionpbx.googlecode.com/svn/trunk/ fusionpbx
cd fusionpbx
cp -a fusionpbx /var/www/fusionpbx

5. Create a fusionpbx site for apache and enable it. Note that this makes fusionpbx appear at the root of your site. Create fille called fusionpbx in your /etc/apache2/sites-available directory and put the following in it:
      <VirtualHost *:80>
ServerName freepbx.example.com
DocumentRoot /var/www/fusionpbx
<Directory />
AllowOverride None
</Directory>
<Directory /var/www/fusionpbx/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
LogLevel debug

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>


Then enable the site with a2ensite fusionpbx/

6. after installing FusionPBX, commit the entire configuration to git to make rolling back easier. Switch to a new branch before making further changes.
7. set up a FQDN for the box running FreeSWITCH and FusionPBX
8. use ACL to allow www-data to make changes to the /usr/share/asterisk directory

And after you install and you realise it didn’t quite go as planned

1. Reset the postgresql database:
root@fusionpbx: # su - postgres
postgres@fusionpbx:~$psql postgres=# drop database fusionpbx; postgres=# create database fusionpbx; postgres=# alter user fusionpbx with password 'XXXX'; grant ALL PRIVILEGES ON DATABASE fusionpbx to fusionpbx;  2. revert your FreeSWITCH configuration using git 3. revert your FusionPBX configuration using git # Proxy Dashing Dashboard behind Apache with SSL I needed to allow access to my Dashing dashboard over ssl from the Internet. I decided to proxy it behind Apache and get Apache to do all the SSL heavy lifting, mainly because I couldn’t work out if and how you could enable SSL within Dashing itself. It turned out to be quite simple to implement. I simply created a vhost configuration for my dashboard and enabled it in Apache. Create a file called dashboard in /etc/apache2/sites-available/ with the following content: <VirtualHost *:80> ServerName dashboard.example.com Redirect permanent / https://dashboard.example.com/ </VirtualHost> NameVirtualHost *:443 <VirtualHost _default_:443> SSLEngine On SSLCertificateFile /etc/ssl/CAcert.cert.pem SSLCertificateKeyFile /etc/ssl/private/key.pem ServerAdmin webmaster@localhost ServerName dashboard.example.com ErrorLog "/var/log/apache2/dashboard-error_log" CustomLog "/var/log/apache2/dashboard-access_log" common <Proxy *> Order allow,deny Allow from all </Proxy> ProxyPass / http://mylocalserver.example.com:3030/ ProxyPassReverse / http://mylocalserver.example.com:3030/ </VirtualHost> Ensure the proxy modules are enabled: $ sudo a2enmod proxy
Enabling module proxy.
To activate the new configuration, you need to run:
service apache2 restart
$sudo a2enmod proxy_http Enabling module proxy_http. To activate the new configuration, you need to run: service apache2 restart$

Enable the new dashboard site:

$sudo a2ensite dashboard Check your configuration is working before restarting apache: $ sudo apachectl configtest
Syntax OK
$sudo service apache2 restart [ ok ] Restarting web server: apache2 ... waiting .$

Don’t forget to delegate your dashboard.example.com hostname to resolve to your apache server’s IP address.

Now visit http://dashboard.example.com/name_of_your_dashboard. Your browser should automatically get redirected to https://dashboard.example.com/name_of_your_dashboard and you should see your dashboard.

# 3D Printed Heated Towelrail Brackets

Our heated towel rail’s brackets broke from old ages recently. After investigating getting a new towel rail and finding out they were quite expensive, I decided to try and design and 3D print new brackets for it.

The first cut of the design turned out to have too little space for the nuts. A second draft with a little more space and it worked perfectly.

The top left of the above image shows the broken parts and the bottom center shows 2 of the 3d printed replacement parts.

# Preserve file permissions 664 under subdirectories in linux with ACLs

Have you ever wanted to give several users permission to work on files within a directory, but then struggled with what permissions and user:group ownership to set them to so users can always edit the files?

You might think the solution is to make the parent directory owned by a common group, lets say dev, and then try and make the permissions flow through to the files within. This doesn’t work though, and new files will still be created with the user’s umask, typically 644, which is no good as it results in the other users not being able to edit the file.

The solution lies in ACLs (Access Control Lists). Thanks to Pelle at Stackoverflow for making such a concise set of steps to set this up. Blatantly copied here:

First add the acl option to the mounted partition where the directory is you want to apply this to. Add the acl option to the mount point in /etc/fstab:

/dev/xvda1      /               ext3    errors=remount-ro,acl 0       1


Then remount the filesystem to enable it:

# mount -oremount /


Then set the permissions using the setfacl command:

# setfacl -dm u::rwx,g::rwx,o::r /shared/directory


Test by creating a new file in /shared/directory:

/shared/directory$touch test /shared/directory$ ls -al test
-rw-rw-r-- 1 jason dev 0 Feb 20 12:37 test


Marvel in the wonders of modern filesystems.

Cylinder intersecting a cube

Hack A Day has a great article introducing FreeCAD.

FreeCAD is a parametric 3D modeler. Parametric modeling allows you to easily modify your design by going back into your model history and changing its parameters. FreeCAD is open source (LGPL license) and completely modular, allowing for very advanced extension and customization.

1. It’s free as in beer
2. It’s free as in libre
3. It’s available for Windows, Linux and Mac OS X
4. It’s scriptable in python
5. you can draw things using constructive solid geometry (CSG)
6. you can create objects by extruding 2D drawings similarly to Solidworks

# typing mathematical symbols into emacs using the TeX input method

You can type mathematical symbols into emacs using the TeX input method.
 C-\ TeX <enter> \ohm \therefore \pi 
C-\ will toggle the input method on and off. Note the \ indicator in the bottom left of the status bar.

# LED down light comparison website – www.ledbenchmark.com

I’ve wanted a reliable source of information on LED light bulbs for a long time. Well apparently it does exist. ledbenchmark.com have brief reviews and comparisons of many blubs and it seems to be done in a nice scientific way.

Image By Mcapdevila [CC-BY-SA-3.0], via Wikimedia Commons

# Windows 7 Visual FoxPro ODBC Driver

Microsoft have made it virtually impossible to find out how to get this driver for Windows 7. Fuck you Microsoft.

If you are getting the error “You must first install the current version of the Visual FoxPro ODBC Driver”, you need to download this driver and install it.

Tthe file you are after is called VFPODBC.msi and can be downloaded directly from Microsoft at the time of writing. No doubt they will move that link to ensure no one can find it again.

To use it on a 64 bit windows system, you need to run the 32  bit version of ODBC: C:\Windows\SysWOW64\odbcad32.exe

# Top 3 tips for migrating a server to a virtual machine

I recently migrated a server to a virtual machine, and while it was mostly a smooth process, I did encounter a couple of problems.

• Ensure that any licensing services will run on the new virtual hardware. Our accounting system’s license server wouldn’t run until it was set up with new licenses.
• Check date and time are correct on the new host and guest vm.
• Make sure the server is set to use a static IP addresses before migrating.

# Anacron run-parts: /etc/cron.daily/amavisd-new exited with return code 1

I’ve been getting messages like the ones below from cron my debian box for some time now. I finally got sick of seeing them and I tracked down the error.

/etc/cron.daily/amavisd-new: Please run this cronjob as user amavis run-parts: /etc/cron.daily/amavisd-new exited with return code 1 

At some point the debian package moved the cron config file from /etc/cron.daily/amavisd-new to /etc/cron.d/amavisd-new but for some reason when upgrading, it does not remove the old config file, leaving you with an erroneous file.

All you need to do is delete /etc/cron.daily/amavisd-new and the messages should go away.