Install FreePBX On Raspberry Pi

Overview

The great thing about the Raspberry Pi is it’s ability to change it’s OS with a swap of an SD card. This allows the Pi to change functions and testing almost as easily as spinning up a Virtual Machine (VM).

Introduction

There’s currently a project which packages FreePBX and Asterisk all setup and ready to go in a image file for the Raspberry Pi. It’s all self contained so it has it’s own database and web server.

Install

The install will be performed from a Windows machine but as long as the image can be copied to the SD card it should not be a problem.

Go to Raspberry-Asterisk project page and go to the download section. Grab the latest version (at the time of writing raspbx-27-04-2013.zip) as a zip file. It may require some scrolling to find the link.

Next download Win32 Disk Imager which will create and copy the Raspberry Pi image to the SD card.

Unzip both Raspberry-Asterisk image and Win32 Disk Imager. The image file should have an extension .img and the disk imager program should have an .exe.

Insert an SD card and note the drive letter assigned. Double check this because you could be overwriting another drive!

Start Win32 Disk Imager using the Win32DiskImager.exe
Win32 Disk Imager

Select the image file by pressing the folder icon or by typing the path directory into the textbox.

Select the drive letter which corresponds to the SD card. By default it will hide all non removeable media drives so you can’t accidentally write over Windows drive.

Press write button, confirm any dialog boxes.

Once complete, eject / unmount the SD card, put it into the Raspberry Pi and power up the device.

Basic Configuration

The default information to log in are as follows:

SSH
user: root
password: raspberry

FreePBX Website
user: admin
password: admin

Local Configuration

Log into the terminal either locally or via SSH. The first thing to do is to change the root account password. Issue the command passwd and follow the on-screen prompt to change the password.

Enter raspi-config and a menu should appear. If an SD card larger than 4GB is used run the expand_rootfs option to resize the partition to use up the whole SD card.

Other options to check include the time zone, locale and keyboard settings.

FreePBX Configuration

Go to the IP address of the Raspbx. The IP can be found by typing ifconfig into the terminal. Log in using the default credentials.

Go to Admin > Select Admin from the list on the right to edit the user and change the password.

Go to Settings > Advanced Settings and change Asterisk Manager Password? under Asterisk Manager section and User Portal Admin Password in System Setup section. On changing these fields a tick icon appears. Ensure it is pressed to commit the change otherwise nothing has been set. This must be done per setting change. Also under in advanced settings change the Country Indication Tones in Dialplan and Operational section. This will change the ring tones to country specific tones.

Email Server With Gmail

Follow the following to setup email capabilities using Gmail SMTP to deliver email. Emails can be sent when new voicemail message appears for example. Setup will be done via the console.

Raspberry Pi Asterisk uses Exim4 as the Mail Transport Agent (MTA). The role of the MTA is to route emails.

Run the configuration wizard dpkg-reconfigure exim4-config

Press Ok on the first page which details the setup process.
Mail Server Configuration Details

Select mail sent by smarthost; received via SMTP or fetchmail from General type of mail configuration:
Mail Type

Enter noreply.raspbx.org as the System mail name:
System Mail Name

Ok the next notice about IP address.
IP Address Notice

127.0.0.1 ; ::1 should the incoming SMTP connections:
Incoming IP Addresses

Other detinations for which mail is accepted: should be noreply.raspbx.org
Other Accepted Destinations

Leave the Machines to relay mail for: empty.
Machines To Relay For

Set the outgoing smarthost: to the SMTP address of Gmail with an extra colon between the host name and the port number.
Outgoing Smarthost

Select No to Hide local mail name in outgoing mail?
Hide Local Mail Name

Ok the DNS mode of operations.
DNS Mode

Select No for Keep number of DNS-queries minimal.
DNS Query Minimal

Select mbox format for Delivery method.
Delivery Method For Local Mail

Select Yes to Split configuration into small files?
Split Configuration Into Small Files

Ok to the postmaster and root setting notice.

Leave the Root and postmaster mail recipient: empty.
Root And Postmaster Recipient

Once complete it will automatically restart Exim MTA for the configuration to take hold.

Edit /etc/exim4/passwd.client
The file should have (and if not add) text SMTP_HOSTNAME:USERNAME:PASSWORD. For example *.google.com:danny@gmail.com:password
Save and exit the file.

Edit /etc/email-addresses add the following to the end of the file:

root: your_email@host.com
asterisk: your_email@host.com

changing the email address to a personal one. This should be the same email address as the Gmail address.

Due to the additional changes run update-exim4.conf to update Exim’s configuration, invoke-rc.d exim4 restart to restart Exim and exim4 -qff to force send any pending mail.

To check the connection is working tail /var/log/exim4/mainlog and check for no error messages.

Maintenance

Every now and then it is best to check for updates. This is done via FreePBX Module Admin menu from the web page but also in the terminal run raspbx-upgrade to keep the Linux distro up to date.

Summary

Raspberry-Asterisk Website
Win32 Disk Imager
GmailAndExim4

About Danny

I.T software professional always studying and applying the knowledge gained and one way of doing this is to blog. Danny also has participates in a part time project called Energy@Home [http://code.google.com/p/energyathome/] for monitoring energy usage on a premise. Dedicated to I.T since studying pure Information Technology since the age of 16, Danny Tsang working in the field that he has aimed for since leaving school. View all posts by Danny → This entry was posted in Linux, PBX and tagged , , , , , , , , , , . Bookmark the permalink.

3 Responses to Install FreePBX On Raspberry Pi

  1. Jim DeLancey says:

    Thanks Danny for your tutorial. It is very descriptive, concise and allowed me to get things up and running right away.

  2. Thomas Kardos says:

    Hello Danny,

    i am very new to the world of SIP, but i am trying to configure the voicemail feature to send them via email attachments but somehow i just can’t get it to work , i have followed your guide but still no luck. I have also tried to replace the port from 578 to 465 (google gave me that). When i run the command tail /var/log/exim4/mainlog it gives me the following:
    root@raspbx:~# tail /var/log/exim4/mainlog
    2015-07-30 23:03:55 1ZKtFC-0007pv-AM == sajtalma1@gmail.com R=smarthost T=remote_smtp_smarthost defer (-53): retry time not reached for any host
    2015-07-30 23:03:55 End queue run: pid=3304
    2015-07-30 23:04:25 1ZKv05-0000rr-8v <= sajtalma1@gmail.com U=asterisk P=local S=53661 id=Asterisk-1-1714481708-00001-1501@raspbx

    As i am already looking on googles 8th page for advice i hoped maybe you would be able to shed some light on my issue.

    Best regards,
    Thomas

  3. Thomas Kardos says:

    I managed to get further now and get the followin EM:
    root@raspbx:~# tail /var/log/exim4/mainlog
    2015-07-30 23:32:45 1ZKvFe-0001AB-0u Message is frozen
    2015-07-30 23:32:45 1ZKvG4-0001BK-53 Message is frozen
    2015-07-30 23:32:45 1ZKvLB-0001ez-5p Message is frozen
    2015-07-30 23:32:45 1ZKvFY-00019w-Fo Message is frozen
    2015-07-30 23:32:45 1ZKvFb-0001A4-Ar Message is frozen
    2015-07-30 23:32:45 1ZKvFp-0001Ae-1A Message is frozen
    2015-07-30 23:32:45 1ZKvFj-0001AQ-DZ Message is frozen
    2015-07-30 23:32:45 1ZKvFw-0001Az-1p Message is frozen
    2015-07-30 23:32:45 1ZKvIz-0001Zb-8a Message is frozen
    2015-07-30 23:32:45 End queue run: pid=8922

Leave a Reply