Académique Documents
Professionnel Documents
Culture Documents
WHAT'S
POPULAR how-to
How-To: Raspberry Pi
multiple WiFi setup
through the command
line (/how-to/how-to-
raspberry-pi-multiple-
wifi-setup-through-the-
command-line)
(/how-to/how-to-
raspberry-pi-multiple-
wifi-setup-through-the-
(/media/k2/items/cache/4147ca3af8bf81f64b5d738c371bfecb_XL.jpg)
command-line)
Asterisk + FreePBX +
Raspberry Pi 2 = VoIP
Sip Server (/how-
Asterisk and FreePBX Raspberry Pi 2 Install to/asterisk-freepbx-
raspberry-pi-2-voip-sip-
Asterisk with FreePBX installed on a Raspberry Pi 2, gives server)
me a small, VoIP server that I can use for all my telephony
needs.
I needed a small footprint, portable VoIP system for some R&D
SIP work, and with RasPBX, this solution works out better
than I expected.
(/how-to/asterisk-
freepbx-raspberry-pi-2-
I ran Freeswitch along with FusonPBX for many years in a virtual machine on a server at voip-sip-server)
home. Over the years things have changed, and I no longer need to have my server running Format / Partition a USB
24/7. I switched out many of my virtual machines to small form factor PC's or Raspberry flash thumb drive on
Pi's. Switching my VoIP server to a Raspberry Pi 2 has now given me the portability I Asuswrt routers (/how-
wanted, and I can now easily take it from job to job without any hassle. to/format-and-partition-
usb-asuswrt-routers)
I desperately wanted to install the new Freeswitch 1.6 onto my Raspberry Pi 2, but after
(/how-to/format-and-
hours of attempting to compile, and searching through forums, I could not get it to work. partition-usb-asuswrt-
Freeswitch 1.6 made some significant changes and requires libraries available in Debian 8- routers)
Jessie which is what Raspbian - Jessie is based on. Many of the dependencies were not
available at which point caused the compile to fail. It doesn't appear that the Freeswitch
team will be porting over 1.6 to the pi any time soon, as they have their hands full at the
moment, so for my Raspberry Pi experiments, I move on to Asterisk.
I have never used Asterisk before. Years ago, when I wanted to play around with VoIP, it
seemed that Freeswitch had more to offer, they seemed to be attempting Video support and Freeswitch 1.7 +
I seemed to grasp the architecture better on how Freeswitch was structured. At the time Raspberry Pi 2 = VoIP
there was a strong community behind both (and continues today), and Asterisk actually Sip Server (/how-
seemed a bit more popular, Freeswitch seemed like it was heading in the direction I wanted. to/freeswitch-1-7-
I still plan on upgrading to 1.6 on a virtual machine at a later date, but today I need a small, raspberry-pi-2-voip-sip-
portable unit, so Asterisk for the win! server)
(/how-to/freeswitch-1-7-
raspberry-pi-2-voip-sip-
Things You'll Need server)
Raspberry Pi 2 (with Micro SD card of at least 4GB) Nokia 5110 LCD on
SSH Client (terminal window in linux or program like putty) Raspberry Pi (/how-
Sip Client (either for your phone or PC) used to test connectivity (3cx, CSipSimple, etc) to/nokia-5110-lcd-on-
raspberry-pi)
Download the RasPBX image onto your computer (If wget fails to download, I suggest you
visit the RasPBX website to find the latest image available), it's a very slow download...it
took me close to 2 hours.
wget http://download.raspberry-asterisk.org/raspbx-25-01-2016.zip
Unzip
unzip raspbx-25-01-2016.zip
While that command is still running, plug the Micro SD card back in, your looking to find
what device it is showing up as (ie: sdb, sdc, sdd, etc)
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_01.png)
In our example, you can see that the SD card is showing up as sdc, In these examples, we
will now refer to our card as sdc (although yours may be sdb, sdd, etc)
Once you see something similar to this screen press Ctrl+c to exit the last command.
Unmount your Micro SD Card (replce sdc in the command below, with what your card is)
Using the command dd, we will write the image you previously had downloaded, directly to
your SD card
*Important, be sure to substitute the full path of your RasPBXi image and your SD letter
(sd[x]) shown in the example below
example:
You will not see any progress as the card is being written, It should take around 5
minutes or so and you should see a similar screen.
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_02.png)
Once completed, take out your card, and insert it into the Pi and power it up...
*Note - If using a static IP address on your Raspberry Pi, be sure to manually disable the
DHCP client on your network interface. See the Troubleshooting section below.
Login: root
Password: raspberry
SSH into your pi (replace the IP address in the command below, with the IP address of your
Pi)
ssh root@raspbx
or
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_03.png)
Now update to the latest additions
raspbx-upgrade
Hit Y if it wants to install updates, this may take a few minutes to complete all of the
updates.
Configure Timezone
configure-timezone
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_04.png)
- Setting the timezone for Asterisk
In the previous example, we set the timezone for the Raspberry Pi itself. Now we need to
set the time zone for Asterisk/FreePBX. Typically this is done with the FreePBX web
interface and selecting Admin > System Admin . We are running on a Raspberry Pi, and
from what I can find with google, this module is not compatible with the pi's architecture,
and there for not installed. So we need to edit it manually through the console.
View the contents (ls) of the directory /usr/share/zoneinfo and find your time zone
ls /usr/share/zoneinfo
ls /usr/share/zoneinfo/US
then copy (cp) your timezone over to /etc/localtime (replace US/Central, with your correct
timezone)
cp /usr/share/zoneinfo/US/Central /etc/localtime
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_07.png)
You will have to restart, in order for this change to take effect, I simply reboot
reboot
In order to have the ability to use the entire card, you'll need to expand the file system
(Expanding the partition across the entire card)
df -h
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_08.png)
Here is a 16GB Micro SD card, but you can see only 3.5G is used.
raspi-config
After reboot, log back in and issue the df-h command, you will now see the /dev/root
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_11.png)
Now everything has been updated, we can goto a web browser and type in the IP address of
your pi, you will see the FreePBX main screen
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_05.png)
Click on FreePBX Administration
We will add a basic extension so that we can register a SIP client (either from our PC or our
phone) that is connected on the same network as the RasPBX Raspberry Pi 2.
User Extension: This can be any number you'd like that should follow a dial plan that
fits your needs (1000-sales, 2000-engineering, etc), For this example I use 1000
Display Name: This is typically your First and Last Name, for this example I use my
name Algis Salys
Secret: This is the password that is needed, for extensions to register, for testing
purposes, I just made it 1000. This typically should be a long length of a combination of
alpha-numeric characters
(https://www.algissalys.com/images/articles/asterisk-freepbx-raspberry-pi-2-voip-sip-server/pi_asterisk_freepbx_install_06.png)
*Note: When you have made all the nessesary changes, and Clicked on Submit , now also
Click on Apply Config located at the top right of the screen.
Your client should now be registered to your new RasPBX VoIP server.
*Note the password of 1000, is only as a simple test example, you should use very complex
lower/upper-case alphanumeric passwords of a significant length (no less than 12
characters)
- Testing a call
There are no other extensions provisioned yet in our server, but we can still do some basic
tests, to ensure we can receive and transmit audio.
From you registered SIP Client dial *43, This is an echo test where you should here a short
introduction, and then you can speak and here yourself echo back.
If you click on Admin > Feature Codes for more similar test extensions.
Troubleshooting
- Forbidden
When rolling out anything like this, you should take it step by step and test along the way, as
we have shown in this example. One of the most popular errors you may have is with
registering your Sip client. This is why we want to start with it being on the same network as
well as simple passwords. If you do receive a message Forbidden on your Sip client, be
sure
You can also view different logs on your Asterisk server through the FreePBX Administration
web interface. Click on Reports > Asterisk Info and this screen will show you how many
extensions are actively registered. You can also click on Reports > Asterisk Logfiles and
scroll through to see if you can retrieve any specific errors about your issue.
Initially I was able to register clients, but certain clients were not able to hang-up calls
properly. I went into the asterisk console
asterisk -rvvvv
This allows me to see registration info as well as call flow. I noticed some ack errors due to
different IP addresses on the server. My Raspberry Pi Asterisk server had 2 IP addresses!
If you only have your Raspberry Pi set to DHCP, this is not a problem, but I went ahead and
statically assigned an IP address in /etc/network/interfaces, but for some reason with the
Raspbian image I am using, setting up a static IP does not disable it from also receiving a
DHCP address. The confusing part was running
ifconfig
only showed my static IP, the way I confirmed the 2 addresses, was to run a nmap scan from
another host computer.
The fix...
First you need to be sure you properly setup your /etc/network/interfaces file to set a static
IP, then
Edit /etc/dhcpcd.conf
nano /etc/dhcpcd.conf
denyinterfaces eth0
Substitute the interface eth0 if using a different interface. Reboot your Pi, and you will no
longer receive a DHCP address on eth0.
Conclusion
Asterisk, along with the front end FreePBX is a powerful communications platform. The
basic installation on a Raspberry Pi 2 is fairly straight forward as shown in this example but
this platform does contain many more advanced features that you can completely customise
to meet your needs. If it's for your home, small business, or R&D projects, this solution is
sure to meet your needs in the VoIP world.
References:
Raspberry Pi Model:
Raspberry Pi 2 Model B
Raspberry Pi Image:
cat /etc/*-release:
Kernel:
4.1.15-v7+ GNU/Linux
Asterisk:
Asterisk 11.21.0
FreePbx:
FreePBX 13.0.51
http://www.raspberry-asterisk.org (http://www.raspberry-asterisk.org)
http://wl500g.info/showthread.php?14885-Asterisk-Incorrect-time-in-CDR
(http://wl500g.info/showthread.php?14885-Asterisk-Incorrect-time-in-CDR)
Read 55299 times Last modified on Thursday, 10 March 2016 20:49
© 2018 AlgisSalys.com - electronics, amateur ham radio, security and more Back to Top