fixed errors in agi-VDAD scripts

git-svn-id: svn://192.168.202.10@155 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2006-08-11 15:12:29 +00:00
parent 660be18d49
commit 84c69ca0b8
4 changed files with 253 additions and 244 deletions
@@ -200,67 +200,67 @@ if (!$DB_port) {$DB_port='3306';}
### Grab Server values from the database
$cbc=0;
$stmtA = "SELECT voicemail_dump_exten,ext_context,answer_transfer_agent,local_gmt,asterisk_version,max_vicidial_trunks FROM servers where server_ip = '$server_ip';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$DBvoicemail_dump_exten = "$aryA[0]";
$DBext_context = "$aryA[1]";
$DBanswer_transfer_agent = "$aryA[2]";
$DBSERVER_GMT = "$aryA[3]";
$DBasterisk_version = "$aryA[4]";
$DBmax_vicidial_trunks = "$aryA[5]";
if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;}
if ($DBext_context) {$ext_context = $DBext_context;}
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;}
if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;}
$cbc++;
}
$sthA->finish();
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$DBvoicemail_dump_exten = "$aryA[0]";
$DBext_context = "$aryA[1]";
$DBanswer_transfer_agent = "$aryA[2]";
$DBSERVER_GMT = "$aryA[3]";
$DBasterisk_version = "$aryA[4]";
$DBmax_vicidial_trunks = "$aryA[5]";
if ($DBvoicemail_dump_exten) {$voicemail_dump_exten = $DBvoicemail_dump_exten;}
if ($DBext_context) {$ext_context = $DBext_context;}
if ($DBanswer_transfer_agent) {$answer_transfer_agent = $DBanswer_transfer_agent;}
if ($DBSERVER_GMT) {$SERVER_GMT = $DBSERVER_GMT;}
if ($DBasterisk_version) {$AST_ver = $DBasterisk_version;}
if ($DBmax_vicidial_trunks) {$max_vicidial_trunks = $DBmax_vicidial_trunks;}
$cbc++;
}
$sthA->finish();
### Grab call parameters from vicidial_list table
$cbc=0;
$stmtA = "SELECT phone_number,phone_code,user FROM vicidial_list where lead_id='$CIDlead_id' limit 1;";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$VDADcampaign = "$channel_group";
$VDADphone = "$aryA[0]";
$VDADphone_code = "$aryA[1]";
$VDADlead_id = "$CIDlead_id";
$VDADfronter = "$aryA[2]";
$cbc++;
}
$sthA->finish();
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$VDADcampaign = "$channel_group";
$VDADphone = "$aryA[0]";
$VDADphone_code = "$aryA[1]";
$VDADlead_id = "$CIDlead_id";
$VDADfronter = "$aryA[2]";
$cbc++;
}
$sthA->finish();
### Grab inbound_group values from the database
$cbc=0;
$stmtA = "SELECT drop_call_seconds,drop_message,drop_exten FROM vicidial_inbound_groups where group_id = '$channel_group';";
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$DBdrop_call_seconds = "$aryA[0]";
$DBdrop_message = "$aryA[1]";
$DBdrop_exten = "$aryA[2]";
if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;}
if ($DBdrop_message) {$drop_message = $DBdrop_message;}
if ($DBdrop_exten) {$drop_exten = $DBdrop_exten;}
$cbc++;
}
$sthA->finish();
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
while ($sthArows > $cbc)
{
@aryA = $sthA->fetchrow_array;
$DBdrop_call_seconds = "$aryA[0]";
$DBdrop_message = "$aryA[1]";
$DBdrop_exten = "$aryA[2]";
if ($DBdrop_call_seconds) {$DROP_TIME = $DBdrop_call_seconds;}
if ($DBdrop_message) {$drop_message = $DBdrop_message;}
if ($DBdrop_exten) {$drop_exten = $DBdrop_exten;}
$cbc++;
}
$sthA->finish();
### insert a LIVE record to the vicidial_auto_calls table
@@ -363,7 +363,7 @@ if ($channel_status < 1)
$VDADextension = "$aryA[2]";
$cbc++;
}
$sthA->finish();
$sthA->finish();
$stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';";
my $affected_rows = $dbhA->do($stmtA);
@@ -400,6 +400,10 @@ if ($channel_status < 1)
exit;
}
else
{
print STDERR "NNNNNNNNNN No agent record found!!!\n";
}
}
else
{
@@ -448,7 +452,7 @@ if ($channel_status < 1)
$VDADserver_ip = "$aryA[3]";
$cbc++;
}
$sthA->finish();
$sthA->finish();
$stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';";
my $affected_rows = $dbhA->do($stmtA);
@@ -497,6 +501,10 @@ if ($channel_status < 1)
exit;
}
else
{
print STDERR "NNNNNNNNNN No agent record found!!!\n";
}
}
else
{