Connect to asteriskcdrdb for billing

Tags: #<Tag:0x00007fb47c6e4550>

(Mo The Mighty) #1


I am trying to integrate with the JBILLING platform and they need to pull CDR data. The ultimate goal would be to pull this data as frequently as every two minutes. However, that part of it isn’t necessarily my burden to bear.

My question is, what is the best means for me to securely provide access to the asteriskcdrdb for the developer so they may integrate into their platform?

Thanks in advance for the advice!

(Dave Burgess) #2

I don’t think there’s a “best” since so much of this will be situational.

In development, a copy of the database from your live server should provide plenty of data. Throw it onto a MariaDB server and go to town.

When you are preparing to go live, you have a few choices, depending on ‘no kidding’ what you are going to do with the data requirements. Most billing systems work monthly, so a once-a-month backup and restore of the data to another server would work. If you really do need every five-minute access to the database, you might still want to consider a mysqldump using a where clause that only pulls the last (say) 10 minutes worth of the data and ignore duplicate records. If you want “live” access to the data, you can open the database server to a specific user and host in the user table and pull the data live from the table.

Another possibility is to not use the MySQL data and use the CDR text file. You can open that with “tail -F” and watch the data stream into your application in real time, really reducing the load on the database engine and probably improving performance. The system can be configured to produce both a CSV and MySQL Databases, so this particular nut is yours to crack.

None of these is a ‘best’ solution. It really is going to depend on what you’re willing to accept as performance limits and system overhead, as well as what kind of server network you are looking at. There are no ‘wrong’ answers at this point; there might be a wrong question, but no wrong answers. :slight_smile:

Use the username and password “read obly” credentials on the cdr table in the asteriskcdrdb database tied to their specific development host. When you go live, change the host address and allow the operational application access instead.

(Mo The Mighty) #3


Huge thanks for the insight!

If we were to go the “tail - F” route, would we need to perform the steps outlined here:

I only ask because I navigated to /var/log/asterisk/cdr-csv and there is currently nothing in there. So, I assume that I might need to modify the configuration file.


You will probably need a populated /etc/asterisk/cdr.conf to get the csv records working


. . . ; In the example config files, all formats are commented
; out except for the cdr-csv format. . . .

(Mo The Mighty) #5


Thank you very much for your time and response!

Y’all have been a big help. I’m going to really dive into this for the rest of the day and see where I get.

Thanks again.

(TheJames) #6

CDR in 15 supports graphql.

This is probably the “best” way


To answer the original question, if you set up a secure ACL mariadb connection to the asteriskcdrdb you can ‘poll’ it at whatever period you want, just remember the latest uniqueid and construct you SQL query to only return data greater than the saved uniqueid next time around.

(system) closed #8

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