fixed issues with remote agent pl script

added hangup for left 3way vicidial_conferences in conf_update script

git-svn-id: svn://192.168.202.10@958 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2008-10-09 14:11:56 +00:00
parent b61ea16361
commit c54a5b6873
2 changed files with 22 additions and 20 deletions
+7 -13
View File
@@ -35,6 +35,7 @@
# 70222-1606 - Changed queue_log PAUSE/UNPAUSE to PAUSEALL/UNPAUSEALL
# 70417-1346 - Fixed bug that would add unneeded simulated agent lines
# 80128-0105 - Fixed calls_today bug
# 81007-1746 - Added debugX output for count statements and changed to if from while
#
### begin parsing run-time options ###
@@ -394,18 +395,16 @@ while($one_day_interval > 0)
{
if (length($DBremote_user[$h])>1)
{
### check to see if the record exists and only needs random number update
$stmtA = "SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip' and campaign_id='$DBremote_campaign[$h]' and conf_exten='$DBremote_conf_exten[$h]' and closer_campaigns='$DBremote_closer[$h]';";
if ($DBX) {print STDERR "|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$loginexistsRANDOM[$h] = "$aryA[0]";
$rec_count++;
}
$sthA->finish();
@@ -419,15 +418,14 @@ while($one_day_interval > 0)
else
{
$stmtA = "SELECT count(*) FROM vicidial_live_agents where user='$DBremote_user[$h]' and server_ip='$server_ip'";
if ($DBX) {print STDERR "|$stmtA|\n";}
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$loginexistsALL[$h] = "$aryA[0]";
$rec_count++;
}
$sthA->finish();
@@ -480,12 +478,10 @@ while($one_day_interval > 0)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_countLSC=0;
while ($sthArows > $rec_countLSC)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$LSC_count = "$aryA[0]";
$rec_countLSC++;
}
$sthA->finish();
@@ -567,12 +563,10 @@ while($one_day_interval > 0)
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
$sthArows=$sthA->rows;
$rec_count=0;
while ($sthArows > $rec_count)
if ($sthArows > 0)
{
@aryA = $sthA->fetchrow_array;
$autocallexists[$z] = "$aryA[0]";
$rec_count++;
}
$sthA->finish();
+15 -7
View File
@@ -12,6 +12,7 @@
# 60717-1536 - changed to use /etc/astguiclient.conf for configs
# 80506-1055 - Added check for vicidial_conferences in 3WAY
# 80914-1533 - Added kickall for leave-3way calls after one hour
# 81008-0937 - Added kickall from vicidial_conferences if only one participant
#
# constants
@@ -256,15 +257,11 @@ foreach(@PTextensions)
foreach(@list_channels)
{
if($DB){print "|$list_channels[$j]|\n";}
### mark all empty conferences and conferences with only one channel as empty
if ($list_channels[$j] =~ /No active conferences|No such conference/i)
{$conf_empty[$i]++;}
# if ($list_channels[$j] =~ /^User /i)
# {
# $userx = '';
# $userx = $list_channels[$j];
# $userx =~ s/User \#: //gi;
# $conf_users[$i] .= "$userx|";
# }
if ($list_channels[$j] =~ /1 users in that conference/i)
{$conf_empty[$i]++;}
$j++;
}
@@ -289,6 +286,17 @@ foreach(@PTextensions)
if ($PTextensions[$i] =~ /Xtimeout1$/i) {$NEWexten[$i] = ''; $leave_3waySQL='0';}
if ( ($PTextensions[$i] !~ /Xtimeout\d$/i) and (length($PTextensions[$i])> 0) ) {$NEWexten[$i] .= 'Xtimeout3';}
if (length($NEWexten[$i]) < 1)
{
### Kick all participants if there are any left in the conference so it can be reused
$local_DEF = 'Local/5555';
$local_AMP = '@';
$kick_local_channel = "$local_DEF$PT_conf_extens[$i]$local_AMP$ext_context";
$queryCID = "ULGC36$TDnum";
$stmtA="INSERT INTO vicidial_manager values('','','$now_date','NEW','N','$server_ip','','Originate','$queryCID','Channel: $kick_local_channel','Context: $ext_context','Exten: 8300','Priority: 1','Callerid: $queryCID','','','','','');";
$affected_rows = $dbhA->do($stmtA); # or die "Couldn't execute query:|$stmtA|\n";
}
$stmtA = "UPDATE vicidial_conferences set extension='$NEWexten[$i]',leave_3way='$leave_3waySQL' where server_ip='$server_ip' and conf_exten='$PT_conf_extens[$i]';";
if($DB){print STDERR "\n|$stmtA|\n";}