How to track outbound calls on a FreePBX based system

Asternic CCStats will report queue based activity. That means that only inbound calls that go into queues will be reported. However, there is a method to enable outbound call tracking by using a custom dialplan that intercepts outbound trunks calls under FreePBX and updates the queue_log file with their activity.

The included dialplan will only track calls for extensions that have an account code set inside FreePBX preferences.


If you use the pinset module, or any other module that uses account codes, it will conflict with the included outbound track dialplan. However, it is possible to customize the dialplan a little bit to not use account codes but track all calls and using a unique name for the outbound queue like 'Outbound'

The dialplan file is located in /usr/src/asternic-stats-pro-2.2.7/FreePBX/extensions_custom_asternic_outbound_freepbx.conf

You have to copy it over to your /etc/asterisk directory with the command:

cp /usr/src/asternic-stats-pro-2.2.7/FreePBX/extensions_custom_asternic_outbound_freepbx.conf /etc/asterisk

Then you have to include that dialplan into Asterisk. For doing so, you will have to use your favorite text editor to modify the /etc/asterisk/extensions_custom.conf file and add at the end of it:

#include extensions_custom_asternic_outbound_freepbx.conf

Finally restart your asterisk dialplan:

asterisk -rx "dialplan reload"

Once that is done, the only thing left to do is edit an extension inside FreePBX, and set an account code for it. The account code you use will be used as afake queue name in queue_log. You should use the same account code on the extensions you want to track outbound calling so their calls will be grouped under the same queue. We recommend to use a name like "Outbound" or similar.


Do not use the same name for outbound calls than you have for inbound queues, as any outbound call that fails will be logged as an ABANDON, and will impact the inbound metrics in a bad way

Also, this context has the limitation of not following failover trunks. If your configuration depends on failover trunks, do not use this macro for tracking outbound calls, but use instead this one: extensions_custom_asternic_outbound_freepbx_failover.conf

To test, perform outbound calls with any of the extensions with an account code set, after a short while, you will see a new Queue appear as available in the Asternic Reports, that will include those calls. Refer to the Administrator Guide in order to see how to separate Distribution reports based in call flow/direction to separate reports for inbound and outbound calls further.

Did you find this article useful?