use Net::Server::PreFork;
use IO::Socket::INET;
use Data::Dumper; # For debugging
+require UNIVERSAL::require;
#use Sip qw(readline);
use Sip::Constants qw(:all);
my $self = shift;
my $expect;
my $service = $self->{service};
+ my $config = $self->{config};
my $input;
local $/ = "\r"; # SIP protocol message terminator
#
# initialize connection to ILS
#
- $self->{ils} = new ILS $self->{account}->{institution};
+ my $module = $config
+ ->{institutions}
+ ->{ $self->{account}->{institution} }
+ ->{implementation};
+ $module->use;
+
+ if ($@) {
+ syslog("LOG_ERR", "%s: Loading ILS implementation '%s' failed, exiting",
+ $self->{service}, $self->{account}->{institution});
+ die("ILS initialization failed");
+ }
+
+ $self->{ils} = $module->new( $self->{institution} );
if (!$self->{ils}) {
syslog("LOG_ERR", "%s: ILS connection to '%s' failed, exiting",
- $self->{service}, $self->{institution});
+ $self->{service}, $self->{account}->{institution});
die("ILS initialization failed");
}
# Now that the terminal has logged in, the first message
<!-- needs to be one institution stanza for each institution -->
<!-- named in the accounts above. -->
<institutions>
- <institution id="UWOLS" >
+ <institution id="UWOLS" implementation="ILS">
<policy checkin="true" renewal="false"
status_update="false" offline="false"
timeout="600"
retries="3" />
</institution>
- <institution id="LPL">
+ <institution id="LPL" implementation="ILS">
</institution>
</institutions>
-</acsconfig>
\ No newline at end of file
+</acsconfig>