Storing IVR call variables

Hello world,

I am developing a polling application wherein a poll of set questions is initiated by a php page and is applied over a list of phone numbers. The asterisk server calls up the phone numbers in the list one by one.

The question in the poll have either a Yes(1) or No(2) response. For every phone call in a poll, i need to store the response variables in the database. Later on i should be able to connect to this database through php and combine the results.

My problem is with storing the variables in the database. How do i store variables of different calls and make it available for my php page?*


*Detailed explanation is solicited as i have average know how of asterisk

You are probably going to want to store your data in a MySQL database. Asterisk can use MySQL through ODBC connector as i recall.

You are going to want to make a database that has columns like

DATETIME NUMCALLED AGREETOPARTICIPATE (questions1-whatever) FINISHEDSURVEY (set to one if caller goes through the whole thing).

You can probably do this using the dialplan with Read() and odbc commands, or if you prefer you can write a PHP/Perl/whatever AGI (wiki it- application that will deal with it. AGI app gives you far more flexibility but takes a large performance hit, dialplan app uses far less system resources.

Then your PHP web page thing can tally up the current totals and with a few creative sql commands can spit out things like "of X total calls, Y answered this question, Z answered yes (A %) and B answered no (C %)…

I would use AGI as well, especially since you’ve already mentioned you’re going to be doing some other coding in PHP.

see here:

look at some of the examples - most likely, you will have the entire IVR set up in an hour or two - it’s THAT easy with AGI.