This recipe will allow us to create an IVR that will store the code or digits entered by the user in a database. Then, the program will display these digits. For the purposes of this section, we will use SQLite3 as the database engine.
Create a database using the following commands in the Linux console:
cd /var/www/db sqlite3 ivr.db
Create a table while in the SQLite3 console with the following command:
CREATE TABLE ivr-data (callerid INT NOT NULL, data INT NOT NULL);
To quit the console, type
.quit
.Set the proper execution rights and ownership to the database with the following commands:
chown asterisk:asterisk ivr.db
.Create the
ivr.php
file in the/var/lib/asterisk/agi-bin/
folder with the following content:#!/usr/bin/php -q <?php set_time_limit(60); ob_implicit_flush(false); error_reporting(0); $stdin = fopen( 'php://stdin', 'r' ); $stdout = fopen(...