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:
@@ -233,75 +233,75 @@ 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();
|
||||
|
||||
### insert a record into the vicidial_list table
|
||||
$stmtA = "INSERT INTO vicidial_list (entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,called_since_last_reset,phone_code,phone_number,security_phrase,called_count,gmt_offset_now) values('$SQLdate','$tsSQLdate','INBND','$fronter','$channel_group','VDCL','$list_id','Y','$phone_code','$phone_number','$channel_group','1','-5.00');";
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
$cbc=0;
|
||||
$stmtA = "select LAST_INSERT_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;
|
||||
$insert_lead_id = "$aryA[0]";
|
||||
$cbc++;
|
||||
}
|
||||
$sthA->finish();
|
||||
$cbc=0;
|
||||
$stmtA = "select LAST_INSERT_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;
|
||||
$insert_lead_id = "$aryA[0]";
|
||||
$cbc++;
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$new_lead_id = $insert_lead_id;
|
||||
if($M){print STDERR "\n|$stmtA|$new_lead_id|\n";}
|
||||
|
||||
$PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);}
|
||||
# YmmddhhmmssLLLLLLLLL
|
||||
$YqueryCID = "Y$CIDdate$PADlead_id";
|
||||
$callerid = $YqueryCID;
|
||||
### set the callerid
|
||||
print "SET CALLERID $YqueryCID\n";
|
||||
checkresult($result);
|
||||
print STDERR "callerID changed: $YqueryCID\n";
|
||||
$PADlead_id = sprintf("%09s", $new_lead_id); while (length($PADlead_id) > 9) {chop($PADlead_id);}
|
||||
# YmmddhhmmssLLLLLLLLL
|
||||
$YqueryCID = "Y$CIDdate$PADlead_id";
|
||||
$callerid = $YqueryCID;
|
||||
### set the callerid
|
||||
print "SET CALLERID $YqueryCID\n";
|
||||
checkresult($result);
|
||||
print STDERR "callerID changed: $YqueryCID\n";
|
||||
|
||||
### 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();
|
||||
|
||||
|
||||
|
||||
@@ -310,10 +310,10 @@ $stmtA = "INSERT INTO vicidial_auto_calls values('','$server_ip','$channel_group
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if($M){print STDERR "\n|$stmtA|\n";}
|
||||
|
||||
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')";
|
||||
if($M){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($M) {print STDERR "-- VDAD : |$new_lead_id|$fronter|insert to vicidial_log: $uniqueid\n";}
|
||||
$stmtA = "INSERT INTO vicidial_log (uniqueid,lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$uniqueid','$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','XFER','$phone_code','$phone_number','$fronter','N')";
|
||||
if($M){print STDERR "\n|$stmtA|\n";}
|
||||
$affected_rows = $dbhA->do($stmtA);
|
||||
if ($M) {print STDERR "-- VDAD : |$new_lead_id|$fronter|insert to vicidial_log: $uniqueid\n";}
|
||||
|
||||
$stmtA = "INSERT INTO vicidial_closer_log (lead_id,campaign_id,call_date,start_epoch,status,phone_code,phone_number,user,processed) values('$new_lead_id','$channel_group','$SQLdate','$now_date_epoch','QUEUE','$phone_code','$phone_number','VDCL','N')";
|
||||
if($M){print STDERR "\n|$stmtA|\n";}
|
||||
@@ -416,11 +416,7 @@ if ($channel_status < 1)
|
||||
$cbc++;
|
||||
}
|
||||
$sthA->finish();
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "NNNNNNNNNN No agent record found!!!\n";
|
||||
}
|
||||
|
||||
$stmtA = "UPDATE vicidial_auto_calls set status='CLOSER' where callerid='$callerid';";
|
||||
my $affected_rows = $dbhA->do($stmtA);
|
||||
if ($M) {print STDERR "-- VDCL XFER : |$affected_rows|update of vac table: $callerid\n|$stmtA|\n";}
|
||||
@@ -470,6 +466,11 @@ if ($channel_status < 1)
|
||||
print STDERR "\nXXXXXXXXXX VDAD transferred: start|stop $start_time|$now_date\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
print STDERR "NNNNNNNNNN No agent record found!!!\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user