RaspPBX is a project which brings the free and open source Asterisk and FreePBX into Raspberry Pi board. RaspPBX turns Pi into a communications server which can be used by small businesses with up to 12 extensions. FreePBX is a web-based open source GUI that controls and manages Asterisk. Our goal is to show installation of the latest RaspPBX into Raspberry Pi 3 Model B Rev 1.2.
The latest image available for download includes Asterisk 13.20.0 and FreePBX 14.0.2.10.
1. Download, Extract and Copy RaspPBX Image to SD Card
$ wget http://download.raspberry-asterisk.org/raspbx-04-04-2018.zip
$ sudo dd bs=4M if=raspbx-04-04-2018.img of=/dev/mmcblk0 status=progress conv=fsync
$ unzip raspbx-04-04-2018.zip
2. Utilize all space on your SD card
By default the image utilizes only 4GB of your SD card space. Login to the console with username root and password raspberry and issue the command below.
# raspi-config
Navigate to Advanced Options-> A1 Expand Filesystem Ensures that all of the SD card storage is available to the OS. The filesystem will be enlarged upon the next reboot.
3. Configure Static IP Address
Set static IP address for interface eth0.
# echo "interface eth0" >> /etc/dhcpcd.conf
# echo "static ip_address=172.17.100.50/16" >> /etc/dhcpcd.conf
# echo "static routers=172.17.100.1" >> /etc/dhcpcd.conf
# echo "static domain_name_servers=172.17.100.1 8.8.8.8" >> /etc/dhcpcd.conf
4. Set timezone
We need to configure the correct timezone (Picture 1).
# dpkg-reconfigure tzdata
Picture 1 - Setting Timezone for RasPBX
5. Upgrade RasPBX
Asterisk is supplied by RasPBX repositories, use raspbx-upgrade to get updates. The upgrade process takes more than 1 hour. You can use ssh to login to RasPBX with the default username root and password raspberry.
# raspbx-upgrade
After the upgrade, check the version of Asterisk with the command below.
# asterisk -rx 'core show version'
Picture 2 - Asterisk Version is 13.22.0 After Upgrade
FreePBX has it’s own update system, use Module Admin to keep FreePBX up to date. All other software packages on the system are supplied by the Raspbian project, raspbx-upgrade installs these updates as well.
6. FreePBX Initial Setup
6.1 Create Account for FreePBX Administration
Enter address http://172.17.100.50 into your web browser. Fill the password and click Create Account (Picture 3).
Picture 3 - Creating New Account for Web Administration
Once account is created, click FreePBX Administration. Login window will appear (Picture 4).
Picture 4 - Login to Web Interface PBX with New Password
6.2 Select Default Locales
After login, initial configuration wizard starts. We need to configure system language and timezone for FreePBX (Picture 5).
Picture 5 - Selecting System Language and Timezone
7. Force RasPBX to Use Https for Secure FreePBX Administration
We will use the self-signed certificate. First, enable ssl mode.
# a2enmod ssl
The file /etc/apache2/sites-available/default-ssl has the configuration for an http server. To enable ssl site default-ssl issue the command below.
# a2ensite default-ssl
Restart apache server.
# systemctl restart apache2
Secure login to FreePBX using https (Picture 6).
Picture 6 - Using https for FreePBX Administration
8. Adding SIP Extensions to FreePBX
We are going to create two chan_sip extensions 1010 and 1020 in order to test local call between phones registered to RasPBX. Our dial plan consists of the pattern 1XXX that we will assign to the extensions registered to our RaspPBX. Navigate to Applications-> Extensions. Click Add Extension and select Add New Chan_SIP Extension (Picture 7).
Picture 7 - Adding Chan_Sip Extension 1010
Create the second extension 1020 (Picture 8).
Picture 8 - Chan_SIP Extensions 1010 and 1020
9. Download, Extract, Install and Configure Softphone
We will use Zoiper softphone which is free of charge for non-commercial use. The non-commercial installation offers only basic functionality but it perfectly suits our needs. We will install Zoiper on Linux Ubuntu 18.04.
Visit the Offical download site and click Linux button. Choose a free version and click tar.xz package button. Extract archive and run binary.
$ xz -d zoiper5_5.2.19_x86_64.tar.xz
$ tar xvf zoiper5_5.2.19_x86_64.tar
$ cd Zoiper5/
$ ./zoiper
Click Continue as free user. Navigate to Settings-> Accounts and click Add button. Configure the SIP account (Picture 9). The username is 1010 and secret test1010.
Picture 9 - SIP Account Configuration for Zoiper Softphone
If you fail to register softphone, you can troubleshoot registration by connecting to Asterisk console with the command.
# asterisk -r
The Picture 10 shows the unsuccessful attempt to register SIP client configured as the extension 1010 when wrong password is entered.
Picture 10 - Failed Attempt to Register Extension 1010 When Wrong Password is Provided
To test local calls between extensions 1010 and 1020, install Zoiper softphone on Android phone. Zoiper softphone is available on Google play.
10. Testing Local Calls between Phones Registered to RaspPBX
Once we finished configuration of the second softphone installed on Android, we will try to establish call between extensions 1010 and 1020. The Picture 11 depicts the screen of Zoiper installed on Ubuntu when a call is invoked from the extension 1010 to 1020.
Picture 11 - Call from Extension 1010 to 1020
Active calls can be found with the command below (Picture 12).
# /usr/sbin/asterisk -rx 'core show channels'
Picture 12 - Checking Active Calls Using Asterisk Console
They are 22 calls placed at all with one active call from extension 1010 to 1020.
In the next, tutorial we will connect RasPBX with another FreePBX installation using PJSIP trunk.
Best source