A Complete HostedPBX Solution

FusionPBX and CGRT Billing


FusionPBX can be used as a highly available single or domain based multi-tenant PBX, carrier grade switch, call center server, fax server, voip server, voicemail server, conference server, voice application server, appliance framework and more. FreeSWITCHâ„¢ is a highly scalable, multi-threaded, multi-platform communication platform.

It provides unlimited extensions, voicemail-to-email, music on hold, call parking, call center, call queues, phone provisioning and many other features. It provides the functionality your business needs and brings corporate level phone system features to small, medium and large businesses.

CGRT Billing is a complete Switch and Billing Solution is currently being used in production and powering many VoIP business such as Wholesale Termination, Wholesale DID / Business SIP Trunking and Hosted PBX and Residential VoIP around the world!
CGRT Billing was developed to fill a much needed gap in the marketplace for an easy to use yet reliable, scalable Carrier Grade RealTime Billing Platform.

CGRT Billing compliments FusionPBX to build to truly scalable HostedPBX Platform.

How Does It Work

Step 1 – Create Tenant Account in CGRT Billing

Since FusionPBX is multi-tenant each Tenant is treated as a separate company therefore in CGRT Billing we create a separate client (customer) for each FusionPBX Tenant. Once the client is created in CGRT Billing we also need to create a SIP Account for that client.

We need to make a note of the Accountcode and the SIP Account Username as we will need them for the next step

Step 2 – Configure Variables for SIP Headers

In FusionPBX, select the Tenant to be configured from the domain selector on the right of the menu.
From the Menu go to Dialplan >> Dialplan Manager and click on the pencil to edit Variables (usually 3rd from the top).
We need to add the variables sip_h_X-accountcode and sip_h_X-username to the variables so that calls will get correctly authenticated in CGRT Billing.

We also have other optional variables such as sip_h_X-site, sip_h_X-dept and sip_h_X-extension that can be added. If added these optional variables are also passed to CGRT Billing in the SIP Header and allows the ability to generate CDR Reports or Summary Reports that include these variables.

For example a company might have branches / offices in different locations and might therefore have a separate PBX for each but in CGRT Billing they only need to have one client account because in theory the head office might be responsible for the telephone bills

Step 3 – Create Global SIP Trunk

In FusionPBX we just need to create a single Global Trunk to CGRT Billing as follows:

Trunk to CGRT

Note here Username and Password for this gateway are not required but Freeswitch requires them so we just put the words USERNAME and PASSWORD in those fields.
Also we need to set:

Register = False
Profile = external or which ever profile you are using for this Trunk.

Also under Advanced make sure you set

Caller ID In From = True
Domain = Global

Click SAVE when done and if the gateway has been configured it should look like this:


Step 4 – Create Outbound Routes

Create your Outbound routes as normal.

Step 5 – Modify Freeswitch Dialplan

Do this on each of the CGRT Billing Freeswitch Servers

cd /etc/freeswitch/dialplan/
nano public.xml

and enter this block just before the section starting extension name=”.*”.

When you have finished save the file then issue the commands.

Step 6 – Add FusionPBX Servers to ACL List

Add the FusionPBX servers to the ACL List in CGRT Billing.

In CGRT Billing:

Go to the Configuration Menu >> ACL List
Add the IP(s) of your FusionPBX Server(s)
Click SAVE when done

Step 7 – Reload Configuration

The final step to get outbound calls working and billing between FusionPBX and CGRT Billing:

Go to the Status Menu >> SIP Status
Click the Reload ACL button
Click the Reload XML button

Now your system should be able to make outbound calls.

Step 8 – Integrate CGRT Billing Module

The CGRT Billing Module allows your FusionPBX Tenants to access CDRs, Invoices, Reports etc without the need to Login to CGRT Billing.
We provide this module for FREE when you purchase a CGRT Billing License.

Copy the CGRT folder to /var/www/

then create a symlink to it

ln -s /var/www/cgrt /var/www/fusionpbx/app/cgrt
chown -R www-data:www-data /var/www/cgrt
chown -R www-data:www-data /var/www/fusionpbx

The reason why we are not copying the folder straight into the Fusionpbx APPs directory is to avoid problems in the future like updates or accidental deletion.

cd /var/www/cgrt
nano config.php

Here you need to configure the following variables:

ROOT_API — This the URL for your CGRT Billing Server

Save the file then in FusionPBX go to Advanced >> Upgrade
Check “App Defaults” and “Menu Defaults” then click “Execute” at the bottom right of the page. You should see a new Menu appear called “Billing”.

Now go and make your way prosperous!!

Leave a Reply