Moved a couple files. Also the auto_dial is "semantically" complete, to a coin a phrase. :)

git-svn-id: svn://192.168.202.10@309 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
jaywhy
2006-09-27 21:46:11 +00:00
parent f400d74679
commit 0458e99f6a
4 changed files with 31 additions and 7 deletions
@@ -3,9 +3,9 @@
use strict;
use lib '../lib';
use Astguiclient::Server;
use Astguiclient::Daemon::AGI;
Astguiclient::Server->run( port => '4573' );
Astguiclient::Daemon::AGI->run( port => '4573' );
__END__
+2 -2
View File
@@ -2,8 +2,8 @@ package Astguiclient;
use strict;
use DBI;
use Astguiclient::Config ();
use Astguiclient::DBI ();
use base 'Class::Accessor::Fast';
__PACKAGE__->mk_accessors(
@@ -33,7 +33,7 @@ sub new {
my $f = $self->config->file();
my $dsn = "DBI:mysql:datbase=$f->{'Database'}{'DB_name'};host=$f->{'Database'}{'Host'};port=$f->{'Database'}{'Port'}";
$self->dbi (
Astguiclient::DB->connect( $dsn, $f->{'Database'}{'User'}, $f->{'Database'}{'Password'} )
DBI->connect( $dsn, $f->{'Database'}{'User'}, $f->{'Database'}{'Password'} )
);
return $self;
@@ -57,7 +57,7 @@ sub find {
my $sql;
if( defined $args{id} ) {
$args{id} = Astguiclient->dbi->quote( $args{id} );
$args{id} = $self->dbi->quote( $args{id} );
$sql = "SELECT * FROM vicidial_campaigns WHERE id = $args{id}";
} elsif( $type eq 'active_agents' ) {
$sql =
@@ -68,7 +68,7 @@ sub find {
$sql = "SELECT * FROM vicidial_campaigns";
}
my $sth = Astguiclient->dbi->prepare( $sql );
my $sth = $self->dbi->prepare( $sql );
$sth->execute();
while( my $ref = $sth->fetchrow_hashref() ) {
push( @records, Astguiclient::Campaign::Record->new( $ref ) );
@@ -76,8 +76,32 @@ sub find {
return @records;
}
=head2 hopper $COUNT
Return a list of numbers to call. A count is required for this to
work properly.
=cut
sub hopper {
my($self, $count) = @_;
my $sth = $self->dbi->prepare("SELECT vicidial_list.lead_id, vicidial_list.phone_code, vicidial_list.phone_number FROM vicidial_list
INNER JOIN vicidial_lists ON vicidial_list.list_id = vicidial_lists.list_id
WHERE vicidial_lists.campaign_id = ? AND vicidial_list.called_since_last_reset = 'N'
ORDER by lead_id asc LIMIT $count")
$sth->execute( $self->{campaign_id} );
my(@hopper);
while( my $ref = $sth->fetchrow_array() ) {
# Make the dial string aka the phone number were calling.
$ref->{dial_string} = "Local/9" . $ref->{phone_code} . $ref->{phone_number};
push(@hopper, $ref);
}
return @hopper;
}
=head1 AUTHOR
Jason Yates <jaywhy@gmail.com>