Setting up a Raspberry Pi 4 as a 3CX SBC

What is an “SBC?”

SBC stands for Session Border Controller and is a piece of software hosted on your local network that allows IP Phones to connect to a 3CX system hosted in the cloud. 3CX is an IP Phone system that can run virtually anywhere, allowing users to log in on the web, on a mobile phone, or using an IP Phone in the office to make and receive phone calls.

Let’s start with the Raspberry Pi

If you came here hoping for a delicious treat, you’re at the wrong place. The Raspberry Pi is a small form factor computer that can be configured to run in various single-application instances. For example, one might be used as a Network firewall, digital signage transmitter, or home media server. For this use case, it will be installed in an office to connect local IP phones to a 3CX instance hosted on Microsoft Azure.

I would recommend this kit from Amazon, which includes the computer motherboard, a case, power supply, and some other useful accessories.

Build your pi!

Now that we have our kit in hand, let’s open it up and get this thing built so we can start programming it! First, you will want to locate the Raspberry Pi itself. It is in a smaller red box labeled Raspberry Pi 4 Computer. When handling these components, you will want to be careful of static discharge, which could damage the fragile electronics. Ground yourself on some metal nearby before touching the bare PCB.

NOTE: It is very important that you do not insert the MicroSD card provided until AFTER you have put in the case, as insrtuced below.

Next, locate the heatsinks (small metal rectangles with fins) and place them according to the image below (find the red circles with numbers). The large heatsink goes on number 1, the second largest on 2, and the smallest on 3. The orientation is not super important, just make sure they are not hanging off the end of the specified areas. To apply, peel off the blue layer and stick to the components. Be careful not to peel off the sticky pad, but just the blue layer of film.

https://www.canakit.com/Media/CanaKit-Raspberry-Pi-Quick-Start-Guide-4.0.pdf

Next, open the box with the plastic case. Dismantle the case by pulling off the top and bottom. It should end up in three pieces. Now, take the Pi PCB and carefully set it in the bottom tray of the case. Line up the MicroSD card slot on the case with the slot on the PI (see image above). Next, put the side cover back on the bottom insert to hold the Pi in place.

Find the small fan included in the kit and un-package it. Be gentle with the wires to ensure they do not break off from the fan. Take the top lid of the case, with the Raspberry Pi logo on it, and insert the fan on the underside. There are clips that stick out and will hold the fan in place. Use the image below to connect the fan wires to the GPIO (General Purpose Input/Output) of the Pi. Connect the red wire to pin 4 and the black wire to pin 5. (Use the markings around the GPIO area to orient your Pi.)

https://www.canakit.com/Media/CanaKit-Raspberry-Pi-Quick-Start-Guide-4.0.pdf

Once the wires are connected, you can click the lid into place, completing your case!

Finally, locate the MicroSD card from the kit and insert it into the MicroSD slot on the bottom side of the Pi. Insert the card so the logo (red) side of it is facing the bottom of the Pi.

Now we’re ready to install some software!

Setup Raspian OS

For this part, you will need a monitor that accepts HDMI. A TV might work as well. You will also need an extra keyboard and mouse. These should just be temporary, as we will set up another computer to control the Pi.

Use the HDMI cable included in the kit. Connect the smaller end to the Pi’s “0 HDMI” port. Connect the regular-sized end to your monitor or TV. This is also the time to connect your extra keyboard and mouse to the USB ports on the Pi.

Now we are ready to connect the Pi to the power supply. Note that as soon as the Pi is connected to the power supply, it will begin to boot up (turn on). You can use the optional power switch included in the kit if you desire. Connect the USB-C end of the power supply to the “USB-C PWR” port on your Pi. Plug the other end into an open outlet. Once connected to power, you should hear the fan start spinning and your monitor should light up.

A window will appear after a minute or two, titled “NOOBS…” with some version information. Select “Raspberry Pi OS Full (32-bit)” and click the install icon at the top. A popup will appear, select “Yes.” Wait for the installation process to complete. When the installation is complete, you will see a popup saying “Installed Successfully.” Click “OK” and the Pi will reboot.

When your Pi reboots, follow the on-screen directions to get things configured. Do not connect your Pi to Wi-Fi. A wired connection is recommended for this installation.

Configure SSH

For these next steps, your Pi must be connected to your network. Hardwire is recommended.

Follow these directions from https://www.raspberrypi.org/documentation/remote-access/ssh/ to enable SSH. SSH allows you to connect to the shell of your Pi from another computer on your network. This will allow us to run the Pi in headless (no screen) mode.

  1. Launch Raspberry Pi Configuration from the Preferences menu
  2. Navigate to the Interfaces tab
  3. Select Enabled next to SSH
  4. Click OK

Now, to connect, you need to find the IP of your Pi. To do this, open Terminal on the Pi and type ifconfig. Find the line that starts with eth0 and take note of the numbers after inet. For me, the IP is 10.10.1.140.

Use your preferred application to SSH into your Pi. For Mac users, you can use the default Terminal applications. On Windows, PuTTY is a common application. If you want to learn more about SSH, check out this informational page.

Finish configuring your Pi and set up the 3CX SBC

Now that we are SSHed into the Pi, we can are almost done. Follow these directions adapted from 3CX to finish the setup:

NOTE: This section requires some general knowledge about editing files in a Linux shell, though most steps outline what commands to use and what lines to edit.

Set your Hostname

  1. Run the Raspbian configuration utility with the command: sudo raspi-config
  2. Select 2. Network Options and press the <Enter> key.
  3. Select N1 Hostname, press the <Enter> key and then “OK” on the warning dialog.
  4. Enter the Pi’s hostname using only alphanumeric characters and dashes (“-”).
  5. Select <Finish> and then <Yes> to reboot and apply the hostname configuration.

Set a Static IP

  1. Edit the /etc/dhcpcd.conf file to configure the ethernet interface eth0 with the nano editor: sudo nano /etc/dhcpcd.conf
  2. Scroll to the end of the file and add the following lines, making sure to replace the values for interfaceip_addressrouters (gateway) and domain_name_servers based on your LAN settings:

#Ethernet static IP configuration
interface eth0
static ip_address=10.10.1.140
static routers=10.10.1.2
static domain_name_servers=10.10.210 1 8.8.8.8

**These settings apply to my specific network. Your settings will vary depending on your network configuration.
  1. Press the “Ctrl” + “x” key combination, then “y” and <Enter> to confirm writing changes to the file.
  2. Reboot the Pi using:
    sudo reboot
  1. When the Pi boots again, login with “pi” user and verify “eth0” IP address with the command:
    ip a

Install 3CX

  1. Login as user “pi” via SSH
  2. Run the 3CX install script:
wget https://downloads-global.3cx.com/downloads/misc/d10pi.zip; sudo bash d10pi.zip .
  • 3. Select option 2:
    3CX SBC 
  • 4. Follow the on-screen directions, pulling information from your 3CX instance as necessary.

Success! Your Raspberry Pi is now setup as a 3CX SBC. You can now connect your IP phones to the local network and provision them in your 3CX admin panel.

Leave a Reply

Your email address will not be published. Required fields are marked *