87 lines
1.7 KiB
Perl
87 lines
1.7 KiB
Perl
package Astguiclient::Daemon::Dialer;
|
|
|
|
use strict;
|
|
use Astguiclient::Dialer;
|
|
use base qw/Astguiclient::Daemon Class::Accessor::Fast/;
|
|
|
|
__PACKAGE__->mk_accessors( qw/ dialer / );
|
|
|
|
=head1 NAME
|
|
|
|
Astguiclient::Daemon::Dialer - Dialer module.
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
This modules creates a daemon for auto dialing.
|
|
|
|
=head2 loop
|
|
|
|
Called by daemon.
|
|
|
|
=cut
|
|
sub loop {
|
|
my $self = shift;
|
|
|
|
$self->dialer->run();
|
|
|
|
# Check dialer status.
|
|
if( $self->dialer->status() eq 'off') {
|
|
# No agents are signed in. Reset sleep timer.
|
|
$self->sleep(30);
|
|
} else {
|
|
$self->sleep(2);
|
|
}
|
|
}
|
|
|
|
=head2 init
|
|
|
|
Called by daemon in init process.
|
|
|
|
=cut
|
|
|
|
sub init {
|
|
my $self = shift;
|
|
$self->dialer( Astguiclient::Dialer->new() );
|
|
|
|
$self->SUPER::init();
|
|
}
|
|
|
|
=head2 cleanup {
|
|
|
|
Called when process is killed.
|
|
|
|
=cut
|
|
|
|
sub cleanup {
|
|
my $self = shift;
|
|
$self->dialer->cleanup();
|
|
|
|
$self->SUPER::cleanup();
|
|
}
|
|
|
|
=head1 AUTHOR
|
|
|
|
Jason Yates <jaywhy@gmail.com>
|
|
|
|
=head1 COPYRIGHT AND LICENSE
|
|
|
|
Copyright (C) 2006 Matt Florell <vicidial@gmail.com>
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU General Public License
|
|
as published by the Free Software Foundation; either version 2
|
|
of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
=cut
|
|
|
|
1;
|