call/DID tracking for marketing purposes

I dont know the best way to do this, but I’m looking for a way to track how many calls are coming in from what phone number for in an easily readable format. There are services for this but it seems like it’s an easy thing to accomplish if there’s a better way to filter the CDRs. CDRs have way too much data to be useful to someone that doesnt understand the PBX or doesnt want to sift through tons of lines for a single call to see which one was answered.

Example is having different phone numbers published on Yelp, vs Google, vs in newsletter emails and tracking how much traffic each one generates.

Is there a module I’m missing?


So you want call records but you don’t want all the data that comes with the call records? You can export from the cdr table manually:

/usr/bin/mysql -e "select 'Timestamp', 'CallerID', 'IncomingDID', 'Duration' union all select calldate as Timestamp, src as CallerID, did as IncomingDID, duration as Duration from cdr where calldate > date_sub(now(), interval 24 HOUR) and (did='6195551234') into outfile '/tmp/report.csv' fields terminated by ',' optionally enclosed by '\"'" asteriskcdrdb
echo "$(date --date='yesterday' +'Call Report %Y/%m/%d')" | mutt -s "Custom Call Report" -a /tmp/report.csv -- [email protected]

This essentially exports all incoming calls to the number 6195551234 in the last 24 hours, but only gives you Timestamp, caller id, did, and duration.

1 Like

Kind of, I want something I can let the customer play with that will give totals for how many calls came into each DID. If all the other data is still there that’s fine, but i need to easily be able to count how many calls came into inbound route A, B, C, etc in whatever the selected time range is.

That scripts turns it into CSV so your customer can just use Excel to count calls. Put their email address in at the end and have this run nightly, weekly, monthly, whatever.

1 Like

About | Asternic Call Center Stats

Call Event Logging - PBX GUI - Documentation (

FreePBX does not have a good/easy way to provide you with the information easily. As already mentioned by others, it’s either a custom script application or a third party service/application.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.