Host your own PBX – A Beginners Guide


This blog is a good place to start if you’re  just starting out with VOIP and want to run your own PBX, but note very well that it is just a getting started guide! This blog focus’s on how to setup a single PBX with two public telephone numbers that one can route to handsets (generally soft-phones on one’s mobile phones) for incoming calls, and for handsets to be able to make outgoing calls or internal calls whether those handsets are connected to the PBX internally or externally. For my proof of concept I’ve used a Single Board Computer (my SBC is a Raspberry PI 3B+) with Incredible PBX installed on the Raspberry PI. Although I’ve installed Incredible PBX (also known as PBXinaflash), there are many flavours of Asterisk/FreePBX based PBX’s that can be installed on many hardware platforms. What I’m writing here is relevant for all flavours of Asterisk/FreePBX based PBX’s.

The following picture shows the setup I am documenting in this blog.

The VOIP provider(s) will route all inbound calls for your telephone number(s) to your PBX, and the PBX will then route the call to a local handset(s)/softphone(s). The VOIP provider(s) will also route all outbound calls to external telephone numbers.


The scope of this document is basically mentioned in the Introduction. The scope is to explain how to connect handsets to a PBX to make internal and external calls.

Not in Scope:
Minimum HW requirements
How to trunk to potential Internal PBX’s (e.g. additional Incredible PBX’s)
How to encrypt phone calls
Video calling
Call recording
Combox features
Interactive Voice Response (IVR – “press 1 for English, drücken Sie 2 für Deutsch….”)
and much more.

Getting started

The first thing to do is to buy the right equipment and install the base system. You should find everything you need here –, and here “” (at the time of writing, the exact “Nerdvittles” tutorial is documented in the “” link above). The Nerdvittles has a lot of excellent information, but a lot of that information I am not using. For example, I am not interested in Wifi, Fax, Mail, or how to configure trunks to North American VOIP providers, and I also have not followed all the  Incredible PBX recommendations as I’m only doing proof of concept. For example, I am using a RPI3+ B with 1GB RAM and a 8GB SD card.

The nerdvittles documentation fails to point out that you should really use a static internal IP address, so I’ll explain here how I did it as it wasn’t as straightforward as I thought it would be.

I logged in through a terminal window and issued the command “ifconfig”. When I looked at the name given for my ethernet interface, it was “enxb827eb244acc”, and not “eth0” as I am use to. I changed this to “eth0” through “raspi-config”, selecting “Advanced Options”, “Network Interface Names” and disabling “predictable network i/f names” (the system will reboot after changing this setting). Alternatively you can use that long interface name, or take this interesting solution that I found – Once Incredible PBX was available again I set the static IP address by editting /etc/dhcpcd.conf (nano /etc/dhcpcd.conf) and changed the following lines to meet my needs

# Example static IP configuration:
#interface eth0
#static ip_address=
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=
#static domain_name_servers= fd51:42f8:caae:d92e::1

You will have to issue the command “service networking restart” for the change to take place, or simply just reboot the server again.

Many of you, like myself, will only have a single dynamic Internet IP address. For those of you that have a dynamic Internet IP address provided from your service provider, it is strongly recommended that you register and setup with a Dynamic DNS provider so you can access the Incredible PBX from the Internet with a name like “” instead of your WAN IP address which will change from time-to-time. There are plenty of Dynamic DNS providers to choose from.

Another thing I have done differently compared to the Nerdvittles documentation is that I have not opened any incoming ports for SIP traffic on my firewall. Instead I have just opened the IAX2 port, UDP port 4569 which is required for my soft phones. You might be asking yourself how can SIP trunking to my VOIP providers work. This works because I have one free single telephone number per provider, and I am connecting from my Incredible PBX to the provider, and like most home user firewall configurations, all ports outbound are open. My Incredible PBX always keeps the connection to the SIP service provider alive. If you want to open incoming UDP ports 10000-20000 and UDP ports 5060, 5061 for incoming SIP so you can use SIP soft phones go ahead, but I’m not covering that in this blog. With an incoming SIP configuration one has a much wider range of soft phones one can use, but I want to use IAX2 softphones.  I use Zoiper as my softphone as it can make calls using the IAX2 protocol as well a the SIP protocol. Zoiper is available for Android and IOS mobile phones and tablets, and one can also install it on your Windows, Apple, Linux laptop.

One last thing to mention, that Nerdvittles fail to mention is “SIP-ALG” (Session Initiation Protocol – Application Layer Gateway). “SIP-ALG” is implemented on most modem/routers. In general it should be disabled. If you want to understand more about “SIP-ALG” there are plenty of explanations to be found on the Internet.


Configuration is done by pointing your browser at the internal IP address of your Incredible PBX and logging in as admin. If you do not know your password you skipped an important part in the Sourceforge/Nerdvittles documentation, like myself. 🙂 To set the “admin” password you’ll need to logon to the Incredible PBX server, using SSH, as the “root” user and run “./admin-pw-change”.

I intend to use as many graphical illustrations as possible to show you how to configure and to only explain the essential settings.

The Incredible PBX logon process for administrators.

  • From your PC/laptop/notebook point your browser to “http://your.incredibles.pbx.ip.address/
  • Select “Incredible PBX Admin” for the credentials login dialogue

Once logged in I set about removing a lot of the settings that Incredible PBX had put in place to various North American SIP providers. Although the settings (generally trunks) are disabled I didn’t want irrelevant settings hanging around. You can leave them there if you want but it just was a nuisance for me.

The first thing to do is to take 2 smartphones and install a SIP client App on both of them. There are many Apps out there but I’ve chosen Zoiper because I want a client that works with IAX2 besides SIP. As I explained earlier, it’s far easier to work with IAX2 when trying to connect your handsets through a firewall. With the App Zoiper one can connect via SIP or IAX2.

Now it is time to make a simple call so lets configure one handset with Zoiper SIP with extension number 201 and the other handset as Zoiper IAX2 with the extension number 202. NOTE: I’m starting from 200. I’ve done this deliberately as a lot of countries use numbers in the 100, 800, 900 range as special numbers. One should think about how one assigns extensions numbers as one might want to assign numbers to different groups or regions, for example 200-299 for sales, 300-399 for support, etc. Or in future one might like to route a set of numbers to another PBX (trunking). Anyhow, I recommend you follow this blog for the time being.

Setup SIP extension 201

Click on the tab “Applications” and select “Extensions”

Once the Extensions screen is displayed, under the “All Extensions” tab, select “+ Add Extension”, “+ Add New Sip….”. NOTE: I recommend one chooses “Add New Sip (legacy)….” to start with. The reason being is that Incredible PBX is setup to use the default SIP port (UDP port 5060) for legacy SIP. For pjsip extensions Incredible PBX defaults to a non-standard UDP port 5061. Once again, I recommend you follow this blog and experiment later with pjsip settings.

On the “Add SIP Extension” screen you only need to fill in 3 fields (or 2 if you accept the “Secret” offered). The “User Extension” will be “201” for the purpose of following this documentation. The “Display Name” is free text but using your name makes sense, maybe for testing a good display name would be “Your Name SIP”. The “Secret” is the password you want for extension 201.

  • Enter a User Extension – “201”
  • Enter a “Display Name” – “Your Name SIP”
  • Enter a “Secret” or accept the Secret offered.
  • Select “Submit”
  • Select “Apply Config”

Make sure to “Submit” your input and “Apply Config”.

Setup IAX2 extension 202

The process is the same as above except, of course, one would be adding an IAX2 extension, using “202” as the “User Extension”, and using a “Display Name” of “Your Name IAX2″ . For testing I always use the same “Secret” to simplify things.

Setup SIP or AIX2 Softphone using the App Zoiper

So as to keep this getting started guide as simple as possible, I’m showing you here how to simply connect internal Softphones  using the internal IP address of the Incredible PBX server.
NOTE: I actually connect using the hostname by which my Incredible PBX server is known as on the Internet (e.g., but this guide is to get you started so please stick to using the IP address for ease of following this blog. Once again, my recommendation is to experiment and perfect things later.

Here is a graphical explanation of how to connect your Zoiper Softphone to SIP extension 201. On starting Zoiper for the first time you will be asked to setup an account

  • Username is the extension number, so in our example “201”.
  • Enter the password (the value in the “Secret” field) for extension “201”.
  • Select “Create an account”.


  • Enter the internal IP address of the Incredible PBX server.
  • Select “Next”.


  • Select “Skip”.


  • Select SIP UDP (should be the only option automatically selected if one is following this guide).
  • Select “Finish”.

Now take your second Softphone and set up Extension “202” exactly the same way. It should be automatically recognised as an IAX UDP phone. You are now ready to test internal phone calls by making calls from 201 <-> 202.


If you cannot make 201 <-> 202 internal calls, check that the Softphones registered fine.

  • Start the Zoiper Softphones.
  • Select the 3 parallel bars

After the selecting the 3 parallel bars next to “Search ….” you should get a screen like this


If you don’t have the “Account is ready” then check the “settings” (or delete and create the account again), or logon to the Incredible PBX server and check within asterisk, or look at the log. I prefer to look at the log with the command “tail -f /var/log/asterisk/full”. One can also debug/troubleshoot within Incredible PBX with the command “asterisk -rv”.

Trunk Configuration to Public VOIP provider

Here I have “cheated” a bit. I use two Public VOIP providers here in Switzerland, but have not paid for trunking. I have one “pay as you go” number from each provider which, I believe, makes a small difference to how your trunk is setup. Also, I believe, this is the reason why I don’t have to open up many incoming ports on my firewall for SIP connectivity. Please note that I have written “I believe” as I have never proved this! You will also notice that the VOIP providers I am using here in Switzerland are two excellent providers, Phonestar and Sipcall.

There are many settings but the majority can be left at their default values. It’s possible that these settings might not work for your provider, but should work for most.

  • Select Connectivity/Trunks
  • Select “+ Add Trunk”
  • (most probably) select “+ Add SIP (chan_pjsip) Trunk”

On selecting  “+ Add SIP (chan_pjsip) Trunk” should take you to the following screen where, on the “General” tab you:

  • Provide a meaningful “Trunk Name”.
  • Provide a “Outbound Caller ID”. Commonly your phone number.
  • Click “Submit”

Next, select the “pjsip settings” tab

  • Enter the Username/Secret provided by your VOIP provider.
  • Enter your SIP Server provided by your provider.
  • Enter SIP Server port which is normally 5060
  • Enter Context “from-pstn-toheader”. NOTE: the default for Context is “from-pstn” is what I believe would be correct if one had actually subscribed to trunking from the VOIP provider.
  • Click “Submit” then click “Apply Config”

To see if this is working, login to your VOIP provider administration web-site and see whether your Incredible PBX has successfully registered. Alternatively look in the log file for the appropriate log entry.

We now are at a point where we can make internal calls and we are connected to the VOIP service provider(s).

Calls between handsets outside the internal network

As mentioned in the “Getting Started” Section, I have decided not to open a load of ports on my firewall router, so SIP softphones can’t connect to my Incredible PBX server from the the Internet, but I have opened one port so that Zoiper IAX2 configured softphones can connect.  The port to open on your Router is UDP port 4569 and connect it to your incredible PBX server.

The configuration for your IAX2 softphone is exactly the same as explained in “Setup SIP or AIX2 Softphone using the App Zoiper”, but you will need to use the Internet facing IP address of your Router.

NOTE: As explained earlier, I don’t have a fixed Internet IP address so I use Dynamic DNS and a typical Internet styled host name like “” to connect to my Incredible PBX. This enables me to use a single configuration for my smartphone regardless of whether I’m on my internal network or Internet. Setting up Dynamic DNS is outside the scope of this blog.

Now we need to handle outgoing calls – e.g. An internal Softphone wants to make an external call. We also need to know how to handle incoming calls from our VOIP provider(s) – e.g. Someone, somewhere in the world, wants to call you on your number. Before we do this make an adjustment to the SIP settings.

Adjust SIP Settings

  • NAT Settings enter the “External Address” (the Internet host name), or click on “Detect Network Settings” which should fill in the field automatically with the Internet IP address.
  • Enter “Local Networks”
  • “Submit” and “Apply Config”

Outbound Call Routing

  • Select the tab Connectivity and the option “Outbound Routes”
  • Select “+ Add Outbound Route”

Following is how I added the Outbound route for one of my VOIP providers (Phonestar).

  • Select “Route Settings” tab
  • Fill in the field “Route Name” with a meaningful name of your choice
  • Select from the drop-down “Trunk Sequence for Matched Routes” the trunk you previously created.
  • Select “Submit”

  • Click on the “Dial Patterns” tab
  • Enter [+0]xx. in the match pattern field
  • Select “Submit”
  • Select “Apply Config”

One may need to study dial patterns closer to meet their full needs. The dial pattern I have used indicates that all calls starting with “0” use this trunk. The simple logic being any call starting with any digit from “1 – 9” remains within Incredible PBX, and any call starting with “0” is passed over to my VOIP provider. As always, stick to doing what is in this blog and experiment later.

For those that noted there is a “#1” in the prefix field, this is there because I use Sipcall as the default VOIP provider for outgoing calls (so no prefix). With the #1 the Phonestar trunk will be used and not the Sipcall trunk. Therefore, instead of dialling “0441234567”, I would dial #10441234567″.

Test by making a call to any number starting with “0”.  If you have problems do troubleshooting as mentioned previously. Also don’t forget the problem might be your “Sip-ALG” setting on your firewall.

Hopefully one now has internal calls and outbound calls working fine, so let’s get the last step working, inbound calls.

Inbound Call Routing

You will notice that for an incoming call from my Sipcall trunk, I route the call to a single extension (NOTE: I’ve got more extensions defined than just “201” and “202” that I’ve used in this blog). For incoming calls from my Phonestar trunk, I route the call to several phones (Ring Group). I am not going into details about creating Ring Groups, but will mention that you can create “Ring Groups”, by going to the “Applications” tab and selecting “Ring Groups”.

Inbound Call Routing

For initial testing only set up an Inbound Route for one of your VOIP providers.

  • Select the tab “Connectivity” and then “Inbound Routes”
  • Select “+Add Inbound Route”

  • Select the “General” tab
  • Provide a meaningful “Description”
  • Leave “DID Number” field empty for initial testing (I’ll explain providing a DID later)
  • “Set Destination” to “Extension” then choose the extension number to be rung – e.g. “201” or “202”
  • Select “Submit”
  • Select “Apply Config”

Test incoming calls are working by calling your VOIP telephone number from your mobile or landline phone for example. Make sure you are not using your mobile phone that you have also setup as a softphone to receive calls! 🙂

Any problems, do the troubleshooting I keep mentioning and don’t forget that it could be your firewall Sip-ALG setting.

Inbound Call Routing using DID (Direct Inward Dialing)

The DID is provided by your VOIP provider. If you have multiple VOIP providers then quite possibly you will want to route information dependent on whether the external caller dialed number “A” or number “B”. If you want all Inbound calls to be routed to the same phones, regardless of what number was dialed then you don’t need to concern yourself with “DID Number” and just leave the “DID Number” field blank.

If you do want to do Inbound routing dependent on what number is called, you have to make an Inbound Route for every DID (in my case every VOIP provider) like I have done.

The graphic again showing my 2 inbound routes

I had problem with defining the DID. As I explained earlier I had to change the “context” setting on the trunk. Here is a snippet of what I wrote from setting up your trunk:

  • Enter Context “from-pstn-toheader”. NOTE: the default for Context is “from-pstn” is what I believe would be correct if one had actually subscribed to trunking from the VOIP provider.

You can see if your Incredible PBX server is finding the DID by looking at the logs. If things aren’t working when you have defined a DID, you’ll probably get what I was getting in the log which was the word “Forbidden”. If you are getting “Forbidden”, then maybe your VOIP provider isn’t sending a DID, you need to change your context to “from-pstn”, or you entered an incorrect DID. If/when it is working correctly you will see lines with “your-DID@from-pstn” in the log. Example – “41192462386@from-pstn” where “41192462386” is your DID. NOTE: if you have subscribed to trunking from your VOIP provider, which I haven’t, your DID’s are probably much shorter with 3 or 4 digits.


Although there are many features not covered, and the features covered only cover the essentials to get going with Incredible PBX, I trust one has learned a lot and is inspired to look deeper into Incredible PBX/Asterisk.

Have fun! 🙂

Take full advantage of your Smartphone for minimum cost

If you are like me, I’m always looking at how to reduce my costs and still get everything I really want. In this article I’m going to cover how to cut your Smartphone costs close to zero.

If you have a Smartphone that you need for business, or are a person that needs, or likes, to make a lot of voice calls for a lot of hours at anytime you want, or can’t wait to surf the net, then this article is probably not for you although it might contain some information that you might find useful.

Seeing as you are still reading I assume you are interested in cutting your mobile costs. Ask yourself “what do I generally do with my Smartphone?”. If you are like me, I use my Smartphone as a Pocket Computer. I generally use my Smartphone to consume information, access social media, to text, and to make the occasional call. Now let’s move onto what most probably interests you about this article – “how do I cut my costs close to zero?”.

Start by going with a minimum contract, or better still prepay. Now you need to understand what your Smartphone has, and how it communicates with the outside world. You have a mobile network (generally referred to as G3, G4 networks), Wifi, Bluetooth, and GPS (used for maps and localising where you are). The part that is costing you the money is the use of the G3, G4 mobile networks, so start by switching of “Mobile data”, or setting it to zero megabytes. NOTE VERY WELL: You don’t need “Mobile data” to make a call, receive a call, or to send an SMS, but do for MMS (does anyone send MMS’s nowadays?)!!! Another way of looking at it is that your Smartphone now has all the functionality of those fine Nokia phones of Yesteryear plus Wifi, Bluetooth and GPS. Wifi and GPS is what I need to make my phone “smart”! Always have Wifi and GPS turned on. A small tip, if you’re buying a new phone, try and get one that supports the latest Wifi protocols. For the big cost saving Wifi is the key, so let’s now talk about Wifi.

Most people have Internet at home and one can connect to the Internet via Wifi. There are now more and more public Wifi hotspots to connect to, and many bars, shops, restaurants, airports etc. have Wifi hotspots to connect to for free for their customers. With a Wifi connection you can now use your favourite Apps to make a call or send a text or make a call for free (WhatsApp, Facebook, Facetime, Skype etc.), although there is the limitation that you’re friends need to be online within that App. In a separate article I have written how to use your “home phone” number on your Smartphone by using a VOIP provider – Landline/Festnetz Telephony (VOIP). Making landline calls are generally a lot cheaper than making mobile calls in most lands.

If you are traveling do look at what your provider charges you. I find it an absolute cheek that you often get charged a lot for incoming calls by many providers and the cost is often quite significant. I recently deactivated my Sim on a trip abroad as my provider was charging far too much for outgoing and incoming calls. In this instance I used Apps liked those mentioned above and my “home phone” number to make calls using a VOIP App – read the article Landline/Festnetz Telephony (VOIP). You might find it in your interest to buy a local pre-pay Sim card, or even buy a package from your service provider, when abroad. Personally, I would go with a local pre-pay Sim card.

Something I find very useful, especially when abroad in unfamiliar territory is the App “Maps”.  “Maps” needs GPS so you generally don’t need mobile data or Wifi. You will need Wifi to initially plan your route. I would suggest planning your route and then downloading it for offline use. I find offline maps extremely useful when abroad and trying to find my way “home”.  To download an offline map search for an area, for example London, and not a specific address. This short video shows how:

To repeat, offline maps are perfect when no Wifi is available and you don’t want to use data connectivity (especially if you’re abroad!). Following on from the example above we can know plan a route within London as shown here:

I generally use an offline map to go from “my location” to somewhere I want to go to and just follow the blue dot. The blue dot shows your current location. Also note that the beam on the blue dot shows the direction you are facing if you are holding your phone in the same direction.

To summarise for absolute minimum costs:

  1. Go prepay
  2. Understand the difference between “Mobile data” and Wifi
  3. Utilise Wifi whenever possible
  4. Control that urge to quickly use Facebook, Twitter, WhatsApp when no Wifi is available
  5. Switch off “Mobile data” or make sure it’s set to zero Megabytes
  6. Switch off “Roaming”

You can still keep your costs low even if you buy and use a mobile data plan. Just remember to maximise Wifi data connectivity and ensure that your Apps don’t unnecessarily use Cellular data connectivity. Good practice is to just switch on “Mobile data” (Cellular data connectivity) when you need it, then switch it off when not using the phone or have Wifi.

Hope you have enjoyed this article. Make a comment if you have a tip you’d like to pass on.


Landline/Festnetz Telephony (VOIP)

Telephony over the Internet (VOIP, which stands for Voice Over Internet Protocol) is nothing new, and is what your telephone service provider will have been doing for quite a while. Only the line from your home to your telephone service provider isn’t, or hasn’t been, via the Internet but via telephone cables. A lot of you will still have your analogue or ISDN connection to your telephone service provider, and most telephone service providers are making easy money by charging you a monthly connection charge, or a flat monthly fee for “free calls” within your land. Why pay a monthly connection charge, monthly fee? When I moved over to VOIP several years ago it proved to be a major money saver. I had Cable for the Internet and ISDN lines for telephones, and I was paying plenty of money just for the ISDN connection. I cancelled my contract with the telephone provider and set up VOIP (e.g telephony over the Internet).

There are probably many of you asking why do I need a landline when I have a mobile subscription? My answer is that you are probably wasting too much money on your mobile subscription, or on making calls.

There are many VOIP providers out there that will provide you with a typical local landline number, or maybe you’d like a telephone number that is in another part of the world. Generally one can also port their existing phone number to their new VOIP provider if one wishes to keep their existing number. NOTE VERY WELL, there are plenty of VOIP providers that just provide a service to make calls. Find a VOIP provider that will give you the full service of incoming and outgoing calls with a geographical number.

The advantage of going with a VOIP provider is that you can take your number with you wherever you are in the world. You can set up your handsets in your house, or you can set up your Smartphone, laptop, or tablet by installing a SIP client (An App/Client Application to make your smartphone, laptop, tablet work like a landline phone). If you don’t have handsets, or don’t want to purchase handsets, just use your Smartphone (or an old Smartphone) and connect over a good Wifi connection. I’ll first go through the benefits of using it as your typical static landline phone, and then I’ll tell you how to also use it as your cheap mobile solution.

Nowadays there is a high chance that your ISP (Internet Service Provider) offers you Internet + phone but they always charge you extra for the phone part. It’s generally a good option especially but I haven’t taken this option from my ISP as I’m only a casual phone user and don’t want to pay that extra cost a month when local calls are just 2 or 3 Euro cents a minute. If the monthly fee option is good for you, you just need to plug your existing ISDN or Analogue phone into a special port on the Modem/Router provided by your ISP. I have taken a different approach which works out cheaper and more comfortable for me. As I like to have static phones about the house I bought IP phone equipment specifically for VOIP (be careful, most stores selling handsets and base stations are still mainly selling Analogue, ISDN equipment. I strongly recommend VOIP phone equipment).  In my case I have a Siemens Gigaset with a couple of handsets. The base station of the Siemens Gigaset I connect to a LAN socket on my Router. NOTE VERY WELL: You don’t need to do any of this setup if you are fine with just using your Smartphone as a typical static phone as well as a mobile which is explained below.

People are realising that they save a bundle of money by using VOIP over their Smartphone without knowing it’s VOIP. Apps like Facetime, WhatsApp, Skype, and many more VOIP apps but a bit restrictive at the moment (e.g. the recipient of your call has to have a Smartphone and/or the same App installed on their device).  Wouldn’t it be nice to just call regular phone numbers and receive calls on your landline number while on the move? Just think of the cost savings if you were to be in far away lands and you want to call friends and family back home who don’t necessarily have a Smartphone, or those Apps like Facetime, WhatsApp, Facebook. If only you could take your home (landline) number with you. Well this is easy using a VOIP provider. I live in Switzerland and I use 2 VOIP providers (Sipcall and Phonestar) although only one is necessary. There is a lot of choice out there so look around and make sure it’s good for incoming calls as well (e.g. they provided you with a number, or they will port your landline number). All you need to do is to install a SIP client on your Smartphone (make a search for “sip”. There are many, but I can tell you that I use “VoIP by Antisip” and “Zoiper” on my Android Smartphone). Configure the SIP client to connect to your VOIP provider and you’re ready to go. Your VOIP provider will give you instructions on how to connect to their service. NOTE VERY WELL, that I strongly recommend that you configure your SIP client to connect over Wifi only. If you allow it to connect over your 3G, 4G mobile network then you will be using mobile data which will be very expensive if travelling. To have good voice quality you will need a decent Wifi connection of course.

Have fun and please comment if you have any tips, recommendations.