use Net::DNS;
use Asterisk::AGI;
+use YAML::Syck qw/LoadFile/;
my ( @resolvers, $A, %AGI, $num, $resources );
-# in order of preference
+# in order of preference - default. Can be over ridden using
+# /etc/asterisk/enum-agi.yml .
@resolvers = qw/ e164.org e164.arpa /;
+my $config_file = "/etc/asterisk/enum-agi.yml";
+if (-f $config_file) {
+ my $config = eval { LoadFile $config_file };
+ if ($@) {
+ die "Failed to load config file: $config_file, error: $@";
+ }
+
+ if (defined $config->{'resolvers'} && scalar(@{ $config->{'resolvers'} })) {
+ @resolvers = @{ $config->{'resolvers'} };
+ }
+}
+
# setup AGI environment
$A = Asterisk::AGI->new();
%AGI = $A->ReadParse;