Since 1.3.0, the Billing for FusionPBX has support for deals. A deal is an easy way to overwrite the rate of certain destinations based on some conditions. You will be able to offer deals such as:

  • The first 60 monthly minutes of outbound calls to the 1613 area code will be for free.


Configure the deals_realtime default setting.

Deals Setup

Go to the FusionPBX Billing application, click on the Deals button and by clicking on the + sign, you will be able to add a deal.

fusionpbx add deal


  • direction: is the call direction, inbound, local (extension-to-extension) or outbound.
  • prefix: the starting digits of the number under this deal. It is highly recommended you use the e.164 format.
  • minutes: the number of monthly minutes that this deal covers. The billing will use the billing day on each linked billing profile to decide from what day of the month to start counting.
  • new rate: the new rate to bill the calls that apply to the current deal including the currency. The billing will convert the currency if the billing profile doesn't match the deal currency.
  • notes: anything to remember

You will have your first deal configured. The next step is to assign a given deal to a billing profile.

fusionpbx dealsWhen a call is placed, the call direction and the prefix will be checked. If these match, the used minutes will be calculated, if the used minutes by a given billing profile is less or equal than the specified in the deal, then the new rate will be applied.

Assign Deals to Billing Profiles

To assign a deal to a giving billing profile, click on the + sign that is inside the deal row. You will see a list of the actual billing profiles, just select all the ones you want to apply.

fusionpbx assign deal

After you have successfully selected the desired billing profiles, you will see them listed.

fusionpbx assigned deal

Real-Time vs Crontab Deals

There are two ways to apply the deals: real-time or crontab. The real-time approach will evaluate and overwrite the price (if applicable) right away when the call is hung up. The crontab approach will apply a price correction through the billing_crontab.php script one day before the billing day. Here are some implications and actions per approach:

Real-Time Deals

  • Make sure your CDR has at least the last 30 days in the main CDR database. If you are using any FusionPBX archive capability or you implement your own, you will need to adjust this.
  • Depending on your server load, you may want to install an extra server and send the CDR processing there. Each time the call is done, the deal engine will find if a deal matches, and if it does, then it will calculate all the talked minutes on the last month by accessing the CDR database. This could be a slow query.

Crontab Deals

  • Make sure your CDR has at least the last 30 days of the main CDR database. This is the same constraint as the real-time deals.
  • Make sure you have a crontab that calls at least once a day the billing_crontab.php script.
  • Depending on your server load, you may want to have a billing installation only for the crontab processing.
  • Because the crontab approach works, the balance will be discounted at the normal rate and a price correction will be applied at the end of the period. This means your customers must have enough balance and at the end of the month, it will be refunded. 

Parent-Child Herachichy

When you are using parent-child billing profiles, the children benefit from the parent' deals. Deals are selected following the next criteria:

  1. Deals are selected using the best match, If you have two deals, one matching 1613, and another matching 1613800 and you are calling 16138007370, the second one will hit as it is the best match.
  2. Children's deals supersede parents'.  If the parent and child have the same match, the child's deal will be selected.

About OKay

An IT Company whose mission is generating value with low cost of ownership.

We will offer you Linux based solutions that satisfy your needs. We focus on VoIP & Linux, but we are up for any other challenge you may want to bring.