[solved] AGI oddity, cannot update database

Hi guys, odd problem for you to mull over!

I’m writing an agi script to manager the booking of conference calls, the data is stored in an SQLite database and is being access via odbc (since im using it for realtime also), i’ve written te bulk of the script and it reads from the database perfectly however the script is unable to carry out any operations to change the database, i’ve made a basic test script and if i run the script from the command line it works without issue however if i run it as an agi i get an error updating the database

use DBI;

print “VERBOSE “”. %ENV->{‘USER’}.”"\n";
my $dbh = DBI->connect(“dbi:ODBC:bookings”, “”, “”,{ AutoCommit => 1});
my $sth = $dbh->prepare(“update bookings set userpin = ? where chan=?”);
print “VERBOSE “Le Error!: “.$dbh->errstr.”””;

When i run this through asterisk as an agi script i get

However when run directly with perl it does it’s job and exits cleanly, i’ve checked permissions, i’ve even set the permissions on the SQLite database file to 777 and no joy.


After more playing i’ve found this seems to be something inherant with SQLite as it happens when using DBD::SQLite, SQLite::DB and DBD::ODBC, unless i can fin a solution to it i may either move to a different file based database (less than ideal for us) or move the functionality to a set of external scripts.

Using external scripts fails also.

Does asterisk in any way mess with file operations ?

Just in case it’s of interest to anyone it seems to be a problem with sqlite through perl agi, I moved over to using an xml file and all is now working perfectly!