Channel Variables - Data Collection

FreePBX/Asterisk 14

Hey everyone!

I have an appointment reminder process nearly ready to launch. The reminder system uses call files to make the outbound call to the customers. The dial plan uses customer prompts to fill out variables that will be useful for later reporting. I am trying to figure out how best to collect the data from Asterisk.

I want to write these variables out as the call progresses. Incase the caller hangs up mid-treatment, I could still know how far they got. There will be thousands of calls per day, but probably only 50-100 calls at a time.

From what understand I can do, I could write to a external DB, I could write to astdb, or the same way I can build a .call file from the dial plan (, I could write a .info from the dial plan to collect those variables. Ultimately the results need to ship to my external reporting system.

What do you guys think is the best approach? I like the idea of writing an .info file or using astdb to stay local. That way if something happened to the network or external DB I wouldn’t lose my variables.

If I make a .info file can I use one .info file to collect all the results? Or will having 50 calls all trying to write at the same time cause a problem? I like the idea of having one results file that can be moved at the end of the day, vs. 1,000s of individual .info files.

Ultimately I want to implement whatever will be the most resource efficient approach. What do you guys think? Is writing to Astdb more efficient? Is there a better way to locally do this? The commercial modules, which I’ve purchased, are not flexible enough for this projects requirements.


FWIW, I use astdb for very similar applications, sqlite3 is very fast and simple. but If you go that route I advise you to use asterisk commsnds to export or import as iasterisk’s database code is thread safe but not multiuser safe.

To maintain the current state of the calls/interviews i would get and put from your ‘family’ directly in your dialplan

1 Like

Haha! Thanks dicko! I was actually just going to message you, but thought it would be better on the public fourm.

One more question. Is there an easy way to pull the results at once? I need to do a once a day dump of the results to our reporting system.

rasterisk -x ‘database query . . . .’

where . . . is a sqlite3 acceptable sql statement

“select * from astdb where key like %xxx%.”

including the escaping of quote within quotes, single and double :slight_smile:

rasterisk -x "database query \"SELECT * FROM astdb WHERE key LIKE \'/YOURFAMILY/%\' \""

1 Like

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