1. Home
  2. Docs
  3. PBX Settings
  4. FreePBX Settings – HTTP Setup (Recommended – Works on all FreePBX versions)

FreePBX Settings – HTTP Setup (Recommended – Works on all FreePBX versions)

PBX Shield allows you to use HTTP to query your PBX profile. What this means is that you are able to send more information to PBX Shield in a more efficient and quicker format.

Setting up FreePBX to use HTTP is relatively easy as long as you are happy to edit one (1) configuration file.

Note: Instead of using HTTP, you can also use an extra Trunk on your PBX to setup PBX Shield. You can try this here: FreePBX trunk settings page. – You only need to do the trunk settings or the HTTP settings, not both.

Why should I use HTTP instead of a trunk?

There are two main reasons why you should use HTTP instead of a trunk for adding PBX Shield to your PBX.

  • By using HTTP, even if an attacker gains access to your PBX web interface they won’t be able to disable PBX Shield easily. In most cases, they won’t even know its being used.
  • The HTTP version of PBX Shield is more scalable then the trunk version and relies on less data handling. If you are looking at putting through high call volumes we would always recommend using our HTTP implementation.

Lets get started

To add PBX Shield to FreePBX using the HTTP method you will need to install the config editor module.

Installing config editor

To install the config editor click on admin->module admin from the top menu.

FreePBX Module Admin

Once inside the module admin you will need to choose to install the Config Editor module. To do this, click on “Check Online”

FreePBX – Check online module admin

Once you have clicked on check online, wait a moment and the online list of available modules will appear. Choose the Config Editor module and then choose to install it.

Once the module has been installed into FreePBX you will be able to choose it from the admin->config editor menu.

When you have choosen it, you will be presented with a list of configuration files for your FreePBX installation. The only file we want to edit is the extensions_custom.conf file. The commands in this file are executed just before an outbound call through a SIP trunk is made.

Once you have clicked on extensions_custom.conf you will get the file contents in the right window. In most cases this will be blank. We will want to add the below information to the right window.

Making sure to change “YOUR_PBX_ID” in this configuration to your actual PBX ID. If you haven’t got your PBX ID, click here to get it.

exten => s,1,Set(pua=${URIENCODE(${PJSIP_HEADER(read,User-Agent)})})
exten => s,n,Set(pipcut=${CHANNEL(pjsip,remote_addr)})
exten => s,n,Set(pip=${CUT(pipcut,:,1)})
exten => s,n,Set(pcid=${URIENCODE(${CALLERID(num)})})
exten => s,n,Set(pdnid=${URIENCODE(${DIAL_NUMBER})})
exten => s,n,Set(pbxid=YOUR_PBX_ID) ; CHANGE YOUR_PBX_ID
exten => s,n,Set(result=${CURL(https://purl.pbxshield.com/pbxshield.php?debug=no&pbxid=${pbxid}&dnid=${pdnid}&cid=${pcid}&ip=${pip}&useragent=${pua})})
exten => s,n,ExecIf($[“${result}” = “block”]?Hangup())

Once done, your configuration should look like this:

Note: Make sure to change YOUR_PBX_ID to your actual PBX ID.

Once you have copied and pasted the information, choose the Save button to save the changes to the file. Then click on the Apply Config button to apply your changes to FreePBX and make them active.

FreePBX – Save button
FreePBX – Apply Config button

Your all done! Lets test it.

Your PBX should now be connected to PBX Shield. To test that everything is working properly, please use our testing guide.

Optional: Securing your PBX a little more

For those of you who would like to secure your PBX a little more, you can also disable or delete the config editor when you are done. This limits any potential intruders ability to wind back changes or edit your configuration files directly.

Was this article helpful to you? Yes No