The hurdle in doing something like this was how to dynamically execute a subroutine from the results of the database query which were dumped into a variable. The method I used with the subroutine reference doesn’t allow for arguments to be passed (if anyone finds / knows a way to do this, let me know), so I use global variables.
This is a simple example of dynamic subroutine execution (without the database query):
use strict;
use warnings;
our $called_number;
our $calling_number;
sub run_me {
$AGI->verbose(”Called Number = “.$called_number, 1);
$AGI->verbose(”Calling Number = “.$calling_number, 1);
}
sub set_variables {
$called_number = “8005551212″;
$calling_number = “3002221111″;
}
sub dynamic_execute {
my ($sub) = @_;
if (!$sub) {
$AGI->verbose(”No subroutine name passed!!”, 1);
return(-1);
}
my $exec = \&{$sub};
return($exec->());
}
set_variables();
dynamic_execute(”run_me”);
_____________________________
Darren Sessions
[EMAIL PROTECTED]
http://www.darrensessions.com
_____________________________
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2008 - September 22 - 25 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
