Self-Hosted Private VoIP with FreePBX

Published 2026-08-13 18:39 1482 words 8 min read

Madobi Nanami avatar

Madobi Nanami

Nanami 的个人技术博客,记录网络、运维、虚拟化与逆向的实践。

Introduction As technology races ahead, surveillance by corporations and agencies grows more aggressive, and information security is now something everyone should care about. Phones are something we...

Introduction

As technology races ahead, surveillance by corporations and agencies grows more aggressive, and information security is now something everyone should care about. Phones are something we all use every day. Ordinary phone calls can be intercepted and monitored by carriers with ease, which makes them a poor choice for important conversations. To give my phone calls much stronger privacy, this article documents the whole process of building a private VoIP phone system for readers who need one.

What Is VoIP?

VoIP (Voice over IP) is a protocol for voice calls. It encapsulates real-time audio streams into IP packets and carries them over internet infrastructure. We can encrypt those packets to a degree, which is what gives us privacy.

Planning

I have a VPN network that lets my home, my school and some friends’ networks talk to each other. This VoIP system needs to carry phone traffic inside that VPN while staying unreachable from the public internet. That means the firewall has to be scoped to the VPN subnet and the internal subnets of the networks mentioned above.

Requirements

  • A server / KVM instance that can run Debian 12 (the guest needs at least 2G RAM and 20G disk)
  • A VPN network (optional)

Disclaimer

This article is for technical discussion only. Do not use these techniques for anything unlawful. I have given the necessary warnings; any consequences caused by readers are unrelated to this article, to me, or to this site!


Let’s Start

1. Installing FreePBX

Q. What is FreePBX? A. FreePBX is a free, open-source IP telephony management tool built on the Asterisk platform. It has a user-friendly WebUI, and is one of the most widely deployed open-source business communications systems in the world, with millions of active installs. It has a large developer and community base and extensive documentation, and its features can be customised and extended as modules. Very convenient.

1.1 Installing from the ISO

  • Go to the FreePBX download page and download the latest FreePBX install image
  • Boot the image and choose the first option to install directly. Pick it and you get 30 seconds to read a help document, then the installer page appears. The whole installation is automatic — you don’t need to do anything, just wait for it to finish.

1.2 Installing Manually

This method requires Debian 12 (bookworm). If you use Proxmox VE as your host like I do, I recommend the Debian 12 Cloud Init image.

  • Run the install script with this command
wget https://github.com/FreePBX/sng_freepbx_debian_install/raw/master/sng_freepbx_debian_install.sh -O /tmp/sng_freepbx_debian_install.sh && bash /tmp/sng_freepbx_debian_install.sh

The script installs every required package automatically. The whole process takes about half an hour, so just be patient.

You may need a working connection to reach GitHub

2. Configuring FreePBX

2.1 Initial Setup

  • When installation finishes, open the WebUI by visiting the server IP on the default port 80.
  • Fill in the admin username, password, email address and so on as prompted, then complete setup.
  • After logging in you are taken to the server initialisation page. Click Active to activate the server.
  • You will be asked to create a Portal Account. Enter your email and the server checks availability automatically.
  • After that, follow the WebUI prompts to finish the configuration.

2.2 Basic Configuration

2.2.1 Firewall
  • Go to Connectivity -> Firewall to configure the firewall
  • Open the Interfaces tab to configure interfaces. This lists every network interface available on your server. Then set the default zone under Default Zone.
Default ZoneNameDescriptionSecurity
InternetInternetAllows all SIP clients on the network to connect, except blacklisted onesLowest
LocalLocalAllows only trusted local trafficHigh
OtherOtherAllows only other types of trafficHigh
RejectRejectRejects all trafficHighest
TrustedTrustedAllows only trusted trafficHigh

Pick the firewall zone for each interface as needed. In this article’s scenario, Local is enough. When done, click Update Interfaces at the bottom right to apply the firewall configuration

  • Open the Networks tab to configure trusted networks. The server automatically adds the local subnet and the address of the device you use to reach the WebUI to the trusted zone. You can also add them manually here. The address ranges you enter must follow CIDR notation (e.g. 192.168.1.0/24, 10.0.0.0/8) Click Save at the bottom right when done
2.2.2 SIP Trunks

If you need to connect your system to an external SIP system to reach other VoIP servers around the world, you need to configure a trunk. This article does not require one, but for the sake of a more general tutorial, here is how.

  • First buy service from a SIP provider (such as VoIP.ms or Twilio)
  • Go to Connectivity -> Trunks and click Add Trunk
  • Choose the matching type based on the details your provider gives you, fill in the data and save
2.2.3 Creating Extensions (Adding Users)
  • Go to Connectivity -> Extensions and click Quick Create Extension to add an extension quickly, then fill in the parameters as prompted
ParameterMeaningDetails
TypeExtension typeJust choose chan_pjsip. It is the modern SIP stack FreePBX recommends and uses by default, with better compatibility, IPv6 support and stronger encryption
Extension NumberExtension numberThe number used for internal and external calls
Display NameDisplay nameThe name shown when this extension calls
Outbound Caller IDOutbound caller IDThe number the other party sees when you call out through a SIP trunk
Email AddressEmailThe email associated with this extension

Example configuration

FreePBX extension configuration example
FreePBX extension configuration example

  • Click next once you’re done, then keep filling in the remaining fields as prompted
ParameterMeaningDetails
Enable Find Me/Follow MeFind Me/Follow MeMulti-device forwarding. When someone calls your number, the system can ring your other extensions at the same time or in sequence
ParkingLotParking lotCall parking lets you put a live call on hold under a number, then pick it up from another extension and continue talking
Create User Manager UserCreate a User Manager userWhether to create a Web login account in the FreePBX user control panel
User Manager GroupsUser Manager groupThe permission group assigned to this user
Enable VoicemailEnable voicemailLets callers leave a message when you don’t answer or are busy
Voicemail PINVoicemail PINThe PIN you enter on the phone keypad to listen to messages

Example configuration

FreePBX voicemail example configuration
FreePBX voicemail example configuration

  • When done, click Finish. Then click the edit button to the right of the user to open the edit page
  • Find the user password: move the pointer into the field and the password is revealed. Copy and record it, and change it now if you want to.
  • When everything is configured, go back to the user list and click the red Apply Config button at the top right to commit the changes.

3. Configuring the Client

There are many SIP dialer clients. Here we use ZoiPer as an example. On Android you can install it from the Play Store; for desktop, get it from the official site.

  • Open the app and fill in the Username @ PBX/VoIP provider field in the form extension number @ IP address

For example 10001@192.168.1.24

  • Enter the user password you recorded, then click Login.
  • Just click next on the following two pages; you then reach a page that tests connection reachability. In my environment SIP UDP worked.

Note: if you are behind an HTTP proxy or transparent proxy, it may not work! Please disable your proxy for now

  • Once you’re on the main page, you can try making a call.

That completes the basic server and client configuration. FreePBX is extremely capable, and I highly recommend exploring its other features yourself. This article only covers the basics. If I get the chance, I will write a follow-up on advanced configuration.


Afterword

I’m not a professional, so please point out any mistakes or omissions. Thanks for reading!


If you enjoyed this, leave a comment~

Random Posts

Loading...