Twilio Elastic SIP Trunk with Raspberry Pi 4

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What is the purpose of a PBX?

  • To connect computers to the internet.
  • To manage email servers within an organization.
  • To provide mobile phone service to employees.
  • To connect telephone handsets in an organization with the public telephone network. (correct)

A modern PBX implementation with Raspberry Pi 4 can only work with traditional telephone handsets and cannot utilize web-based softphones or mobile clients.

False (B)

What is a recommended minimum RAM for a Raspberry Pi 4 to run 3CX software?

  • 4 GB (correct)
  • 1 GB
  • 8 GB
  • 2 GB

Besides the Raspberry Pi 4, which of the following is a necessary component for the described project?

<p>A Twilio account (A)</p> Signup and view all the answers

SIP phones are always required for the 3CX software to function correctly.

<p>False (B)</p> Signup and view all the answers

What is the purpose of configuring port forwarding in the router for SIP and RTP traffic?

<p>To allow inbound calls to the 3CX PBX. (A)</p> Signup and view all the answers

What is the 3CX dynamic DNS service used for?

<p>To create a custom 3CX domain, ensuring phone calls from Twilio find the home network even if the public IP changes. (C)</p> Signup and view all the answers

What must be configured on the PBX to direct outbound calls to the Twilio SIP trunk?

<p>A dial plan. (A)</p> Signup and view all the answers

To associate a phone number with an extension for direct inbound calls, you need to configure ______ (DID).

<p>Direct Inward Dialing</p> Signup and view all the answers

Enabling emergency calling is supported by Twilio in every country.

<p>False (B)</p> Signup and view all the answers

What is the recommended network connection method for a Raspberry Pi used as a PBX to ensure better network performance and call quality?

<p>Ethernet (D)</p> Signup and view all the answers

Which of the following methods is suitable for assigning a static IP address to your Raspberry Pi?

<p>Either by configuring it in the device itself or by reserving a fixed address in your router's DHCP table. (A)</p> Signup and view all the answers

What protocol is used to allow for remote access and desktop sharing to a Raspberry Pi?

<p>VNC</p> Signup and view all the answers

Why is enabling public key authentication recommended for SSH access to the Raspberry Pi?

<p>To simplify SSH access by eliminating the need to enter a password each time. (B)</p> Signup and view all the answers

The license key obtained from 3CX is only valid for a trial period and does not allow for concurrent calls.

<p>False (B)</p> Signup and view all the answers

During the installation of 3CX software, which option should be selected when prompted to choose between 3CX PBX or SBC for this project?

<p>3CX PBX (C)</p> Signup and view all the answers

What is the purpose of running the 3CX Configuration Tool after installing the 3CX software?

<p>To configure the PBX settings. (A)</p> Signup and view all the answers

What is the default username used to connect to the Pi using SSH?

<p>pi</p> Signup and view all the answers

When configuring the PBX, what type of public IP address should you select if you are on a consumer broadband network?

<p>Dynamic IP (C)</p> Signup and view all the answers

Once a custom 3CX domain is created, the Internet service provider cannot change the IP address associated with it.

<p>False (B)</p> Signup and view all the answers

What are the three fundamental tasks in configuring a PBX?

<p>Defining extensions and their users, creating trunks to the PSTN, and creating a dial plan. (B)</p> Signup and view all the answers

What can be disabled in the router to prevent unintended side effects with SIP phones?

<p>SIP Application-Level Gateway (ALG) (D)</p> Signup and view all the answers

3CX offers an integrated tool to verify if the necessary firewall changes have been correctly implemented.

<p>True (A)</p> Signup and view all the answers

What default extension number is created for the operator during the initial setup of 3CX?

<p>100 (B)</p> Signup and view all the answers

The 3CX user portal includes which type of client, allowing users to make and receive calls directly in their browser?

<p>WebRTC (C)</p> Signup and view all the answers

Once an extension is created, it is impossible to change the assigned extension number.

<p>False (B)</p> Signup and view all the answers

In the Twilio console, which option is used to create a new SIP trunk?

<p>Elastic SIP Trunking &gt; Trunks &gt; Create New SIP Trunk (A)</p> Signup and view all the answers

What is set under the Termination settings in the Twilio console?

<p>SIP domain name for directing traffic towards Twilio. (B)</p> Signup and view all the answers

If the IP address isn't static for authenticating calls on Twilio, which credentials should be used?

<p>Username/password credentials (B)</p> Signup and view all the answers

The Priority and Weight settings in the Origination settings of a SIP trunk must be configured with specific, non-default values for proper load balancing and failover.

<p>False (B)</p> Signup and view all the answers

What information is needed from the Twilio SIP Trunk in order to configure a SIP Trunk on 3CX?

<p>Friendly Name, registrar, Sip user ID and its Password (D)</p> Signup and view all the answers

What is the purpose of creating a dial plan in 3CX?

<p>To route calls to different destinations based on dialed numbers. (A)</p> Signup and view all the answers

The rules within a dial plan are evaluated randomly to determine the best route for a call.

<p>False (B)</p> Signup and view all the answers

For emergency calling configuration, overriding the caller ID is used when...

<p>the caller ID is not a phone number associated with your registered street address (A)</p> Signup and view all the answers

In the context of PBX security, what is a common threat to be aware of?

<p>Unauthorized access and fraudulent phone calls. (C)</p> Signup and view all the answers

To limit the destinations a PBX can call mitigating successful hacks, administrators can configure ______ in the Twilio console.

<p>restricting the destinations</p> Signup and view all the answers

What has Twilio implemented to address fake caller ID usage?

<p>The STIR/SHAKEN framework and verified caller ID. (B)</p> Signup and view all the answers

Why might it be necessary to upgrade the firmware after unboxing a SIP phone for use with a 3CX PBX?

<p>To enable all features of the SIP phone to function properly with the PBX. (D)</p> Signup and view all the answers

If a SIP phone does not appear in the 3CX dashboard, it is impossible to connect it to the PBX without manual configuration.

<p>False (B)</p> Signup and view all the answers

What is the multicast IP address that SIP phones use to advertise their presence on the local network?

<p>224.0.1.75 (C)</p> Signup and view all the answers

After configuring the SIP ID for extensions, what changes should be made in the Twilio console to configure an available phone number to dial extensions directly?

<p>Select the drop-down item TwiML Bin and choose the dial 3CX extension code (A)</p> Signup and view all the answers

Flashcards

What is a PBX?

Connects telephone handsets in an organization with the public switched telephone network (PSTN).

What are Softphones?

Web-based phone software and mobile clients. It can be run in the cloud.

Why use Ethernet over WiFi?

Ensure better network performance and call quality compared to WiFi.

Why Configure a Static IP Address?

A permanent address ensures consistent access.

Signup and view all the flashcards

What are the commands 'sudo ifconfig eth0 down' and 'sudo ifconfig eth0 up' used for?

Used to refresh the interface so that the new IP address is used.

Signup and view all the flashcards

Why enable SSH and VNC?

Allows access to your Pi from other computers.

Signup and view all the flashcards

What does VNC do?

Creates an encrypted, authenticated remote connection to a computer.

Signup and view all the flashcards

What does SSH do?

Enables secure remote login to a computer.

Signup and view all the flashcards

What does a 3CX license key provide?

Free license key, good for up to eight concurrent calls.

Signup and view all the flashcards

What is the role of port configuration?

Configures the ports used for HTTP, HTTPS, SIP and the 3CX tunnel protocol, useful for adminstering the PBX

Signup and view all the flashcards

What is Direct Inward Dialing (DID)?

Assign a phone number to a specific extension.

Signup and view all the flashcards

What is a dial plan?

A plan on the PBX to direct outbound calls to SIP trunk

Signup and view all the flashcards

What is public key authentication?

A way to streamline SSH access by doing away with passwords

Signup and view all the flashcards

Why Secure your PBX?

Prevent hackers from running up large phone charges.

Signup and view all the flashcards

What is significant about ports 5060, 5061, 5090 and 5001?

The ports that need to be configured to allow inboud calls

Signup and view all the flashcards

Study Notes

Twilio Instructions

  • A $100 Raspberry Pi 4 computer connected to a Twilio Elastic SIP trunk can be used to run a phone system.
  • The 3CX PBX (Public Branch eXchange) software can be used, which is easy to administer and free for small deployments.
  • Traditionally, a PBX connected telephone handsets to the public switched telephone network (PSTN).
  • Modern implementations with Raspberry Pi 4 can use handsets, web-based softphones, and mobile clients.
  • The 3CX PBX can be administered with a web browser, but IP networking knowledge and Linux command line comfort are needed.
  • A consumer-grade Internet connection without a sophisticated firewall is assumed.

What You'll Need

  • A Raspberry Pi 4 with at least 4GB of memory is required.
  • The CanaKit and The Pi Hut Raspberry Pi 4 starter kits are recommended as they have a case, power supply, microSD card and the necessary cables, and both come with a 32 GB microSD card.
  • Needed for initial configuration are are a USB keyboard, mouse and HDMI-equipped monitor.
  • The 3CX software and a license key are needed.
  • A Twilio account is needed and a new account can receive a $10 credit upon upgrading to a paid account.
  • SIP phones are optional
  • The 3CX software has a list of supported devices
  • A model equipped with WiFi or one that is compatible with a WiFi adapter is needed, if the work area lacks a wired Ethernet connection.

What You Are Building

  • The 3CX PBX software will be hosted on your home network, running on the Raspberry Pi.
  • The PBX will be configured using the 3CX web dashboard after setting up the Pi and installing the 3CX software.
  • Inbound calls must be allowed before communicating with the outside world.
  • You will need to configure port forwarding in your router for SIP and RTP traffic.
  • The proprietary 3CX tunnel protocol must be forwarded if you want to use the 3CX mobile app outside of your home network.
  • Port forwarding is also needed to manage the PBX remotely.
  • Communication will be through the 3CX web client (a web browser softphone), the 3CX mobile app, and optional SIP phones through creating extensions.
  • SIP trunk configuration on both Twilio and the 3CX PBX is needed to make calls to and from the PSTN.
  • The 3CX dynamic DNS service can be utilized to create a custom 3CX domain, ensuring calls from Twilio reach your network.
  • A unique Twilio SIP domain will also be created so Twilio can associate inbound calls with your PBX account.

Setting Up the Raspberry Pi

  • Assemble the kit and install the Raspbian Linux operating system, selecting language, keyboard layout, timezone, and WiFi credentials
  • The software should be upgraded to the latest version, replacing the initial boot software ("NOOBS") on the SD card with the Linux file system.
  • Connecting via Ethernet port is recommended over WiFi for better network performance and call quality and can avoid issues with plug-and-play phone networking

Configuring a Static IP Address

  • To configure an IP address for your Raspberry Pi, either assign a static IP address to your Raspberry Pi or reserve a fixed address in your router's DHCP table.
  • To configure the IP address in the Raspberry Pi, append lines to /etc/dhcpcd.conf using the built-in text editor.
    • For a local Subnet of 192.168.1.0/24 and a router of 192.168.1.1 with a Pi IP address of 192.168.1.200 the following line will be used:
    • Static ip_address=192.168.1.200/24 static routers=192.168.1.1

Refreshing the Interface and Ping

  • The interface must should be refreshed for the new IP address to be used
$ sudo ifconfig eth0 down
$ sudo ifconfig eth0 up
  • If the Pi's WiFi interface is used instead of Ethernet, the interface name is wlan0.
  • The Raspberry Pi should be pinged from a different computer to ensure the Pi is running
  • CTRL + C will end the ping

Enabling Remote Access

  • Remote access should be enabled on the pi through SSH and the VNC remote Desktop
  • This can be done by selecting Preferences > Raspberry Pi Configuration then selecting the Interfaces tab, and enabling SSH and VNC.
  • The VNC Server icon in the task bar is then clicked, then Options and then Security to set Encryption to Prefer off, and Authentication to VNC password.

Connecting to the Pi Remotely

  • A VNC client can connect to the Pi from a remote system with the Pi IP address, and the password set.
  • On a Mac, the Screen Sharing app is a strong option.
  • On Windows, RealVNC's VNC Viewer can be paired with the VNC Server.
  • If accessing the Pi remotely without a monitor physically attached, a non-default screen resolution must be set to avoid a "Cannot currently show the desktop" message.
  • From a terminal session, run the command sudo raspi-config, navigate to Display Options > D1 Resolution, and pick a non-default resolutions, DMT Mode xx:.
  • After choosing new resolution tab to and press the Return key to reboot your Pi

Booting in Command Line Mode

  • The raspi-config command tell the Pi to boot into command line mode instead of graphical user interface.
  • This can be done by navigating to System Options > S5 Boot / Auto Login, select B1 Console or B2 Console / Auto Login, tab to and press Return to reboot

Streamlining SSH Access

  • SSH Access can be streamlined by enabling your Pi by enabling public key authentication
  • Instead of using a password each time, the SSH connection attempt is signed by the client system using your private key.
  • The SSH Sever will then checks the user's public key
  • the ssh-keygen command is used to to create the public/private key pair
  • the ssh-copy-id command uploads the public key to the Pi

Issues with Windows and SSH

  • Windows 10 may not support the ssh-copy-id command. The key will need to be copied manually.

Obtaining a 3CX License Key

  • An account should be made at the 3CX download page
  • Provide the required information to obtain the license key

Installing the 3CX PBX Software

  • Connect to the Pi using SSH and the static IP address defined earlier.
  • The default username is pi
$ ssh [email protected] Linux raspberrypi 5.10.17-v7l+ #1403 SMP Mon Feb 22 11:33:35 GMT 2021 armv7l …`
  • to download and install the 3CX software run:
pi@raspberrypi:~ $ wget https://downloads-global.3cx.com/downloads/misc/d10pi.zip; sudo bash d10pi.zip. … Reading package lists... Done
  • Select either the 3CX PBX or SBC. Pick the PBX (simply referred to as '3CX').
  • Accept the License Agreement when prompted with tab to and return
  • Select to use a web browser when asked about how to run the 3CX Configuration Tool.
Welcome to the 3CX Configuration Tool Help https://www.3cx.com/docs/manual/ Select how to run the tool: (1) Using a Web Browser (2) From command line Enter option: 1 Starting PBX Web configuration tool... Launch this URL from a browser on another machine:

Interrupted Installation of 3CX

  • If this is a cloud machine and the link shows a local IP address then you need to replace the local IP with your public IP address.
  • To restart the installation due to an interruption or mistake use:
$ sudo /usr/sbin/3CXWizard --cleanup

Initial Configuration of the PBX

  • Connect to the PBX configuration tool via the URL supplied
  • Follow the guidance of the configuration wizard including
    1. Select New install and input your license key.
    1. Create an administrator account with a username and password.
    1. The installer will auto-detect your public IP address. Accept it.
    1. Choosing Whether to have a static or dynamic public IP address (if a consumer broadband network, Dynamic IP option will be chosen)>
    1. 3CX creates a dynamic DNS entry for your PBX, as a subdomain of one of 3CX's several regional domains but requires an internet Service provider so your IP address can be automatically updated in DNS record.

Configuring SIP trunk

  • To configure the Twilio SIP trunk to send inbound calls to domain welbourn.my3cx.us,
  • Ports for HTTP, HTTPS, SIP and the 3CX tunnel protocol. Note that the HTTPS port is used both for administering the PBX and for accessing the web client.
  • Select the Raspberry Pi's default network adapter and local IP addresses for phones, rather than DNS

3XC cloud configuration

  • 3CX's cloud-based configuration server will create a fully qualified domain name and a security certificate.
  • Set the length of extension numbers (default to three).
  • Enter the administrator email address (used for system notifications).
  • Select your country and time zone.
  • Create an operator extension (the default destination for inbound calls)
    • For 3-digit extensions, the operator extension defaults to 100
    • the default for voicemail is 999, which overlaps emergency number used in several countries.
  • Define geographic permissions for which countries can be called. Twilio also requires separate permission enabling through the Twilio Console for international calling
  • Language for system prompts can be selected.
  • Configuration confirms when complete

Logging Into the 3XC Dashboard

  • Use The Local URL from 3XC cloud configuration (http://192.168.1.200:5000) and the administrator credentials from configuration, to login to your 3CX administrative dashboard:

Configuring the 3 Tasks of PBX

  • Three tasks:
    • 1.Define extensions and their users.
    • 2.Create trunks to the PSTN.
    • 3.Create a dial plan to enable calls between extensions and the PSTN.

Configuring Inbound Calls

  • To configure the router firewall to allow inbound calls and remote access to the 3CX portal from outside of the local network,
  • The 3CX documentation is helpful
  • Use the following ports:
  • SIP Port Range 5060 Transport protocol UDP + TCP
  • TLS Port Range 5061 Transport protocol TCP
  • 3CX Tunnel 5090 Transport protocol UDP + TCP
  • 3CX Portal (HTTPS) 5001 Transport protocol TCP
  • RTP 9000-10999 Transport protocol UDP

Router SIP Application-Level Gateway

  • Routers may come equipped with SIP Application-Level Gateway that will facilitate outbound traffic from phones to SIP servers, disable this feature in router settings

3XC Firewall Checker

  • The 3CX Firewall Checker can be run by clicking Firewall in the 3CX Dashboard, and then Run.

Consequence Of A Failed Firewall

  • The consequences of a failed firewall check are that inbound calls will fail if SIP is not forwarded properly, or you won't be able to hear the other party if media is not forwarded.

Defining Extensions

  • By default, extensions are first set up when initializing 3XC

Retrieving Admin Extension Info

  • The admin's email receives an extension number and an auto-generated password

Logging Into The Admin User Portal

  • Once logged in, the user portal comes equipped with a WebRTC client, so you can make and receive calls
  • There also are extensions directly available
  • Click on Add and supplying the user's name to add more extensions

Welcoming New Users

  • New users get an email containing login details
  • At this point, it would be useful to have a second device to make and receive calls, so download the iOS or Android 3CX mobile app and the QR code will assist in connecting.

Connecting Web Browser And Mobile Contacts

  • Calls are enabled between contacts by tapping said contact.

Things You Can Do With An Extension

  • Configure voicemail
  • Define rules for call forwarding
  • Configure a mobile number to use with call forwarding or simultaneous ring
  • Configure a phone number to be used for outbound caller ID instead of the number associated with the SIP trunk

Creating a SIP Trunk Through Twilio

  • In the Twilio Console, select Elastic SIP Trunking > Trunks and click on Create new SIP Trunk

Twilio Trunk Settings

  • Accept the defaults under General Settings
  • Next, click on Termination in the menu bar handles outbound calls from your PBX through Twilio to the PSTN
  • A unique name among Twilio customers.

Terminating Calls Through SIP

  • The domain name has the following purposes
    • It identifies the Twilio account to which your calls belong
    • When you make an outbound call from the PBX this domain name should appear in the SIP signaling (SIP server IP addresses cannot be used)
  • AS the terminology suggests, DNS lookup to get the IP addresses of Twilio's SIP servers, choose the closest regional variant to ensure call quality.
  • IP address is not static, so credentials are used
  • Click the plus sign, give your credential list descriptive name and add a username and password
  • Click to Create the credential list, and they Save. Click on the Origination tab this is where inbound calls are specified from the PSTN to PBX (Twilio can contact the PBX) Click on the plus sign to create a new origin URI (Uniform Resource Identifier, informally called a SIP address) fill in the details of your 3CX PBX's domain name, prepended with the string sip: (in my case, sip:welbourn.my3cxus). Click on Add and then Save (If load balancing and failover are enabled, then the Prioirity and Weight settings will be used One or more phone numbers are required to be on your configured dial sip truck on Twilio.

3XC Portal Setup for Twilio

  • To initiate calls to 3XC the 3CX portal, select SIP Trunks > Add SIP Trunk:

3CX Configuration - Provider Tab:

  • Select Country, Select Worldwide and then Twilio as your provider, use one of the
  • Phone Numbers then added in the previous step. This number will be the caller ID Fill and create a new truck

Twilio OK, cancel options

  • Input the regional variant of the Twilio SIP domain name (in my case, welbourn.pstn.ashburn.twilio.com).
  • Set Type of Authentication to Do Not Require-IP Based, and enter the username/password you created with in Twilio Console Note that the authentication is still misleading as Twilio will still challenge the PBX to authenticate through the credentials. From the PSN go to the trunk, and very the default operator

Problems can occur with verifying 3XC FQDN The route needs to be configured to E/.164

The credentials should match for best results

Creating A Dial Plan

  • The main goal of this plan is to route E.164 format numbers to your Twilio SIP truck. And have people who start with + sign
  • The user can press the '+' sign to forward numbers to Twilio to allow calls as a truck

Dialing And Examples

This can support both the US, Canadian, and UK dialing codes that allow +1 The rules are evaluated in the order given to match both inter national (100) to the national prefix ('"0')

Emergency calling should not be configured as part of the regular dial plan Twilio SIP domain needs to be spelled Entries in 3CX needs to mact the Twilio trunk

  • Route Inbound Calls With DIDs With Inward Calling
  • Click on numbers cab 3XC trunk > Add DID

Select the extension direct inward dialing and the numbers through said list

Select the drop down of the list of said numbers Call the DID and verify it works

Configuring a Call For SIP

  • 3XC Mobile and the web apps can receive calls You need to use SIP phone (and that it's on the call list of supported phones)
  • Update the firmware
  • Reset to factory settings (as a step)

Upgrade Phones

  • When the phone is upgraded itll add itself to the presence on your local network multicast code

Adding Phones By Code

  • Assign phone to that said # to the extensions capabilities

Provision A Phone

  • Provision a phone to plug and play Note the more version

What if phone doesnt show up

Reason 1

  • The IP Address has been blocked with the previous install from 3XC Dash Remove if applicatble

Reasson 2

  • The PBX may not listen to the SIP multicast Run netstat -9 on the Pi If SIP.mcast.net is missing is needed to restart to SIP server
  • And select 3XC phone system > restart button on the services area

What to Do if You Can't Provision Plug And Play

You can fall back on legenary 3XC codes and guides to help

Use of Dial Extensions With Programmable Voice

This includes 3XC Portal to see when the call was meant to start you need > FQDN> Alow calls from SIP URI

Addressing Extension

  • There will be none. The person who has those number will see it as if it will on

Setting User Portions

  • Select the extension and clik on the > the settings > select SIP IO d and press ok

  • Copy and paste into Twilio Bins > the setting to TwilM Select drop down and select in coming and set up Click on Save

Three Things You Could Build

A Dial Extension
Contact URI
Dialer

Emergency Calling Considerations

Address Police, Fire Fighter the will register them for calls on numbers - regulatory

Enable Emergency Calling Check if the right numbers the + 1 Also set a local number

In cananda there are local numbers as well Make sure 3xc

Secure PX

  • Security the register This limits the outside connections so that not Enable remote acess Check your IP for a block Allow for a sip address

Restrict twillos from calling any other services and people on that extension by console

Secure Px

  • Security to
  • Can 3xc secure trunk use Twillo to check sertificate But to be in bound and can't forward to Twilio.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

Use Quizgecko on...
Browser
Browser