In theory this snippet will do the trick
Save as updatech.pl
#!/usr/local/bin/perl -w
$ENV{PATH} = '/usr/sbin:/:/usr/bin:/usr/local/apache/bin'; # reasonable path
$ENV{ENV} = "/etc/bash.bachrc";
use strict;
use warnings;
use File::Find;
use DBI;
use Date::Calc qw(:all);
use Asterisk::AGI;
$|=1;
my $agi = Asterisk::AGI->new();
my %input = $agi->ReadParse();
my ($chanval) = @ARGV;
my $agi_channel = $input{'agi-channel'};
## db vars
my $data_source = "dbi:Pg:dbname=Asterisk";
my $username = "root";
my $auth = "xxx";
#
##---------- connect to the db --------------
##establish the DBI connection with transaction processing
my $dbh = DBI->connect($data_source, $username, $auth, {
AutoCommit => 0,
RaiseError => 1,
} ) or die "Can't connect to database: ", $DBI::errstr, "\n";
# read the password file to get account type
my $upd_sh = $dbh->prepare( "UPDATE call_log SET local='CHANNEL' WHERE
id='$chanval' AND channel='$agi_channel'");
$upd_sh->execute();
$dbh->commit();
$dbh->rollback();
exit;
and change line 2 of the macro to exten => s,2,AGI(updatech.pl,$ARG1)
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users