Full-blown telephony solutions are just a few steps away, and that all with open-source components and your AVM FritzBox as a trunk to connect via your existing ISDN or analog lines and DECT or analog telephones. With a US$35 investment into a Raspberry Pi, FreePBX, an Asterisk variant, and this manual.
What you can expect from FreePBX with a FritzBox:
- Powerful full-blown telephony system with conference calls, pickup function, ring groups, voicemail, interactive voice systems, follow me functions etc. pp. for probably 10-15 extensions, ideal for SOHO applications
- All with your existing (or cheap to buy) hardware
- A Raspberry Pi Model B and an SD card
- A FritzBox Fon WLAN (here I am using the 7390)
Instead of buying a Raspberry Pi you could also install a PBX on your Synology Diskstation NAS. Even though I own one, I decided for the Raspberry since I don’t want to have the harddisk of my NAS to always run and also Synology only supports Asterisk without the much easier to use FreePBX configuration interface.
Steps to install:
- Download the Raspberry Pi pre-compiled FreePBX package (so-called IncrediblePi) from here. Look after the latest version IncrediblePi-Debian package, download and extract. Follow the installation instructions inside (in readme file) to create an image onto your SD card.
- Boot up your Raspberry Pi connected to your FritzBox’s LAN network with the prepared SD card and find out the IP address of your Raspberry Pi (e.g., by looking into the fritz.box network overviews).
- Within fritz.box, create an IP telephone device, e.g. extension 620, and connect the incoming ISDN/analog line to it (for incoming and outgoing calls). I called my IP telephone/line “PBXCongstarLine1”. Repeat this step for further trunk lines.
- Login into your FreePBX/Asterisk installation with a web browser (in my example: 192.168.178.36), username and password are both “admin” as default.
- For each trunk line under 3. go to Connectivity/trunks in the FreePBX interface and enter the following parameters and submit changes and apply config afterwards:
Trunk name: e.g. PBXCongstarLine1
Outbound caller ID: Your external caller ID, e.g. 0234567890
Trunk name: e.g. PBXConstarLine1 (as you like)
host=192.168.178.1 (your FritzBox IP)
username=620 (or the extension you got for your FritzBox IP telephone)
secret=*the password you chose in FritzBox*
User Context: 620
secret=*password as above*
- Go to Settings/Asterisk SIP settings and fill in the following parameters:
IP configuration: Public
Codecs: Activate ulaw, alaw, GSM and G726
Add another field down at other SIP settings with “insecure” = “port,invite”
- Reboot your Raspberry Pi, typing in reboot.
- After reboot, login to the FreePBX interface, you should now see an online IP trunk.
- Now start adding phone extensions for each phone under Applications/Extensions within your FreePBX web interface.
Extension: e.g., 10
secret: 1234abc *take a safe one*
- Now if one of your phones is a DECT hardware telephone connected to your FritzBox (and not a SIP phone that can directly connect to your FreePBX installation), you need to create a Internet/SIP trunk line on your FritzBox for each telephone. In German FritzBox go to “Eigene Rufnummern” (own telephone numbers) and add an Internet line with the following parameters:
Telephony provider: Other
Internet telephone number: 10 (your FreePBX extension number)
username: 10 (same)
Registrar: 192.168.178.36 (your Raspberry Pi IP address)
- Assign your hardware phones connected to your FritzBox to this trunk line by assigning incoming and outgoing numbers of the respective telephony device to this line under telephone devices (“Telefoniegeräte”).
- Now you have to tell FreePBX how to dial out with your extension to the world by adding routes. Go to Connectivity/Outbound routes and enter the following parameters to let FreePBX dial every minimum 4 digit telephone number via the external trunk line (adjust accordingly for your number patterns):
Route name: e.g. All calls
Dial Patterns/match pattern: XXXX.
Trunk sequence for matched routes: Select the appropriate trunk line, e.g., PBXCongstarLine1
- Now configure the incoming calls behaviour in Connectivity/Inbound routes and select the profile “Default any DID/any CID” to configure all incoming calls at the same time:
Set Destination: Extensions / 10
- Now whenever a call is incoming, extension 10 will ring. All longer telephone numbers that you type into your phones will be routed external. Try to call your mobile, and try to phone internally between your extensions by dialling extension code 10, or 20. All should work by now. It might be that a reboot after full installation might help to get everything going.
- A tip: If things are not working you should look into the log files of Asterisk. The easiest way is to go to Admin/Module admin and install the Reports module called “Asterisk Logfiles”. You can now supervise any calls under Reports/Asterisk Logfiles. If you need more detailed log details, you can install the module “Asterisk CLI”. Once installed, go to “Admin/Asterisk CLI” and then execute the command “sip set debug on”. The aforementioned log file will include all SIP details of all calls being handled.
- Another hint: It might be that when you call your FreePBX from external (e.g, your mobile) you get a free ring tone, but your properly assigned extension does not ring (in the log file you’ll find an error “Spawn extension (from-internal, 620, 8) exited non-zero on ‘SIP/10“. There is a bug in the current FreePBX installation, you can read it here. For me this resolves sometimes after waiting, and I cannot reproduce this error properly. Hope the developers fix this, but don’t worry, at least it is not your fault.
Please let me know if this manual proved to work for your setup as well and if you are using the Raspberry Pi FreePBX successfully in a live setting.
P.S. thanks to lgaetz at pbxinaflash forum we have now an easy and correct version of my manual!