FreePBX and Zen Digital Voice

Recently I took the plunge and upgraded to Full-Fibre FTTP with Zen. Zen has been one of my internet providers off and on for over 20 years. Even though I once applied there and they turned me down, I still have a soft spot for them.

As part of a money saving effort along with improving my internet speeds, I needed to do something with the telephone number coming in to my house. Fortunately, I have been playing with Asterisk for quite a few years now (around 20), and I have a good working knowledge of it. I also had a spare raspberry pi and was looking for a low cost - low maintenance solution. Asterisk also integrates with Home Assistant.

The Raspberry PI is a PI 4 with 8Gb Ram - you could get away with less, but this is going to be my home phone system, so I want it working well. The operating system for the the raspberry pi I chose was initially called PBX In A Flash (PIAF), but is now called IncrediblePBX. You can find details of how to install it on the website, and it's not just limited to Raspberry PIs. The Operating system gave me a build of Asterisk along with the main gui that people use for Asterisk, FreePBX. You can, of course, install Asterisk and FreePBX on your own hardware, and this should still work.

In addition, you will need a handset or soft phone client of some description. Linphone is the one I use for Android, but I'm not going to go further in to it's set up in this post.

In order to set up the pbx trunk in FreePBX, you will need a few details. These are:

1) Your DDI (Direct Dial In number), sometimes called the trunk number. This is the number your landline has. I will be refering to this as DDI throughout.

2) Your digital voice password - This can be found under services on Zen's old portal. Unfortunately, it doesn't seem to be on the new one.

Once you have this information, you need to configure a trunk in FreePBX. This is done by going to Connectivity -> trunks in the admin section of the webgui. The type of trunk you want to create will be PJSIP. The trunk name will be the DDI, as will the CallerID on the general tab.

On the PJSIP settings tab (General), set the following details:

username       : <Your DDI>
authname       : <Your DDI>
secret         : <the password from the Zen portal>
Authentication : outbound 
registration   : send
SIP server     : voip2.zen.co.uk
SIP Port       : 5060
Context        : from-pstn
Transport      : 0.0.0.0-udp

On the PJSIP advanced settings, set the following:

Outbound Proxy : sip:voip2.zen.co.uk\;lr\;hide
From Domain    : voip2.zen.co.uk
Match (Permit) : voip.zen.co.uk,voip2.zen.co.uk

Next we need to set up an Outbound route. This allows the trunk to be used from the dial plan. The settings for this are found in Connectivity -> Outbound Routes. Create a new outbound route if required.

Under Route settings, set the route CID to be the DDI of the new route. At the bottom of the routes, set the trunk to be the one named after the DDI you are using.

Under Dial Patterns, set the dial patterns that you wish to use. I suggest that you have at least one for "999", "101" and "112". Some of the other numbers can be set up as aliases. You may also need a dial plan that has 0XXXXXXXXXX to match any number that you just dial. If you want to match a local number, you may want one for XXXXXXX, but with a prepend of your area code.

Once completed, verify that you can now make outbound calls. Assuming that all is ok, you are ready to move on to incoming calls. If not, check the logs from the Asterisk display and check that the trunk is registered correctly.

Incoming calls may work out of the box. Try dialling the number and verify that Asterisk sees something, either via the logs or the command line. If they don't, that may well be because Zen sends the calls to the first IP address that is usable associated with your broadband circuit. This requires a phone call, email or chat via the messaging portal to change the IP address that the calls are sent to.

Once done, you now have your phone system setup and running.

As an Amazon Associate I earn from qualifying purchases.

If you have found this post useful, please consider donating.