Connect to asteriskcdrdb for billing

Hello,

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!

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.

1 Like

Dave,

Huge thanks for the insight!

If we were to go the “tail - F” route, would we need to perform the steps outlined here: https://wiki.freepbx.org/display/FPG/Enable+CSV+of+CDRs

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.

1 Like

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

Note

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

2 Likes

Dicko,

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.

CDR in 15 supports graphql.

This is probably the “best” way

1 Like

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.

2 Likes

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