small fix for real-time screen inbound=only

git-svn-id: svn://192.168.202.10@1383 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2010-03-24 14:03:23 +00:00
parent f8148df95a
commit 79d9528613
5 changed files with 191 additions and 16 deletions
@@ -1166,10 +1166,8 @@ if (ereg('O',$with_inbound))
if (eregi('ALL-ACTIVE',$group_string))
{
$non_inboundSQL='';
if (ereg('N',$with_inbound))
{$non_inboundSQL = "where campaign_id NOT IN ($ALLcloser_campaignsSQL)";}
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $non_inboundSQL;";
$inboundSQL = "where campaign_id IN ($ALLcloser_campaignsSQL)";
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $inboundSQL;";
}
$stmtC="select agent_non_pause_sec from vicidial_campaign_stats $group_SQLwhere;";
@@ -1596,7 +1594,7 @@ if ($campaign_allow_inbound > 0)
$closer_campaigns = preg_replace("/ - /"," ",$closer_campaigns);
$closer_campaigns = preg_replace("/ /","','",$closer_campaigns);
$closer_campaignsSQL = "'$closer_campaigns'";
}
}
$stmtB="from vicidial_auto_calls where status NOT IN('XFER') and ( (call_type='IN' and campaign_id IN($closer_campaignsSQL)) or (call_type IN('OUT','OUTBALANCE') $group_SQLand) ) order by queue_priority desc,campaign_id,call_time;";
}
else
@@ -1722,15 +1720,15 @@ if ($agentonlycount > 0)
{$agentonlyheader = 'AGENTONLY';}
$Cecho = '';
$Cecho .= "VICIDIAL: Calls Waiting $NOW_TIME\n";
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE | PRIORITY | $agentonlyheader\n";
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "| STATUS | CAMPAIGN | PHONE NUMBER | SERVER_IP | DIALTIME| CALL TYPE | PRIORITY | $agentonlyheader\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
$p=0;
while($p<$k)
{
$Cstatus = sprintf("%-6s", $CDstatus[$p]);
$Ccampaign_id = sprintf("%-12s", $CDcampaign_id[$p]);
$Ccampaign_id = sprintf("%-20s", $CDcampaign_id[$p]);
$Cphone_number = sprintf("%-12s", $CDphone_number[$p]);
$Cserver_ip = sprintf("%-15s", $CDserver_ip[$p]);
$Ccall_type = sprintf("%-10s", $CDcall_type[$p]);
@@ -1755,7 +1753,7 @@ while($p<$k)
$p++;
}
$Cecho .= "+--------+--------------+--------------+-----------------+---------+------------+----------+\n";
$Cecho .= "+--------+----------------------+--------------+-----------------+---------+------------+----------+\n";
if ($p<1)
{$Cecho='';}
@@ -15,6 +15,7 @@ SIPtrunk=SIP/1234:PASSWORD@sip.provider.net ; SIP trunk
[trunkinbound]
; DID call routing process
; exten => _X.,1,Set(CALLERID(num)=${CALLERID(num):1}) ; removes first leading character from inbound callerid
exten => _X.,1,AGI(agi-DID_route.agi)
; FastAGI for VICIDIAL/astGUIclient call logging
@@ -128,8 +128,8 @@ else
##############################
######### AGENT STATS
######### LIVE AGENT STATS
$user_list='|';
echo "\n";
echo "---------- LIVE AGENTS IN IN-GROUP\n";
echo "+------+--------------------------------+----------------------+--------+---------------------+\n";
@@ -153,11 +153,55 @@ else
$campaign_id = sprintf("%-8s", $row[2]);
$status = sprintf("%-6s", $row[3]);
$time = sprintf("%-19s", $row[4]);
$user_list .= "$row[0]---$row[3]|";
echo "| $FMT_i | <a href=\"./user_status.php?user=$row[0]\">$user</a> | <a href=\"./admin.php?ADD=34&campaign_id=$row[2]\">$campaign_id</a> <a href=\"./AST_timeonVDADall.php?RR=4&DB=0&group=$row[2]\">Real-Time</a> | $status | $time |\n";
}
echo "+------+--------------------------------+----------------------+--------+---------------------+\n";
if ($DB) {echo "\n$user_list\n";}
##############################
######### ALL AGENT STATS
echo "\n";
echo "---------- DEFAULT AGENTS IN IN-GROUP\n";
echo "+------+--------------------------------+-----------+\n";
echo "| # | USER | LOGGED IN |\n";
echo "+------+--------------------------------+-----------+\n";
$stmt="select vu.user,vu.full_name from vicidial_users vu where vu.closer_campaigns LIKE\"% " . mysql_real_escape_string($group) . " %\" order by vu.user limit 2000;";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$Xusers_to_print = mysql_num_rows($rslt);
$i=0;
while ($i < $Xusers_to_print)
{
$row=mysql_fetch_row($rslt);
$i++;
$FMT_i = sprintf("%-4s", $i);
$user = sprintf("%-30s", "$row[0] - $row[1]");
while(strlen($user)>30) {$user = substr("$user", 0, -1);}
if (preg_match("/\|$row[0]---/",$user_list))
{
$userstatusARY = explode("|$row[0]---",$user_list);
$userstatus = explode('|',$userstatusARY[1]);
$status_line = sprintf("%-9s", $userstatus[0]);
if ($DB) {echo "\n$user_list |$row[0]--- $userstatusARY[1] $userstatus[0]\n";}
}
else
{$status_line = ' ';}
echo "| $FMT_i | <a href=\"./user_status.php?user=$row[0]\">$user</a> | $status_line |\n";
}
echo "+------+--------------------------------+-----------+\n";
}
@@ -1166,10 +1166,8 @@ if (ereg('O',$with_inbound))
if (eregi('ALL-ACTIVE',$group_string))
{
$non_inboundSQL='';
if (ereg('N',$with_inbound))
{$non_inboundSQL = "where campaign_id NOT IN ($ALLcloser_campaignsSQL)";}
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $non_inboundSQL;";
$inboundSQL = "where campaign_id IN ($ALLcloser_campaignsSQL)";
$stmtB="select sum(calls_today),sum(drops_today),sum(answers_today),max(status_category_1),sum(status_category_count_1),max(status_category_2),sum(status_category_count_2),max(status_category_3),sum(status_category_count_3),max(status_category_4),sum(status_category_count_4),sum(hold_sec_stat_one),sum(hold_sec_stat_two),sum(hold_sec_answer_calls),sum(hold_sec_drop_calls),sum(hold_sec_queue_calls) from vicidial_campaign_stats $inboundSQL;";
}
$stmtC="select agent_non_pause_sec from vicidial_campaign_stats $group_SQLwhere;";
@@ -35,6 +35,10 @@ if (isset($_GET["card_id"])) {$card_id=$_GET["card_id"];}
elseif (isset($_POST["card_id"])) {$card_id=$_POST["card_id"];}
if (isset($_GET["status"])) {$status=$_GET["status"];}
elseif (isset($_POST["status"])) {$status=$_POST["status"];}
if (isset($_GET["total"])) {$total=$_GET["total"];}
elseif (isset($_POST["total"])) {$total=$_POST["total"];}
if (isset($_GET["comment"])) {$comment=$_GET["comment"];}
elseif (isset($_POST["comment"])) {$comment=$_POST["comment"];}
if (isset($_GET["user"])) {$user=$_GET["user"];}
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
@@ -535,6 +539,135 @@ if ($action == "CALLCARD_BATCHES")
### BEGIN generate results
if ($action == "GENERATE_RESULTS")
{
if ( (strlen($sequence) < 1) or (strlen($batch) < 1) or (strlen($run) < 1) or (strlen($total) < 1) )
{
echo "you must enter in all fields<BR><BR>\n";
$action = 'GENERATE';
}
else
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br>CallCard GENERATE:\n";
echo "<center><TABLE width=$section_width cellspacing=0 cellpadding=1>\n";
echo "<TR BGCOLOR=BLACK>";
echo "<TD><B><FONT FACE=\"Arial,Helvetica\" size=1 color=white>CARD ID</B></TD>";
echo "<TD><B><FONT FACE=\"Arial,Helvetica\" size=1 color=white>PIN</B></TD>";
echo "</TR>\n";
$i=0;
$Gbatch=1;
$Gbatch_count=0;
$Gsequence=0;
while ($i < $total)
{
$Gbatch_count++;
$Gsequence++;
if ($Gbatch_count > $batch)
{
$Gbatch_count = 0;
$Gbatch++;
}
$Pbatch = sprintf("%05s", $Gbatch);
$Psequence = sprintf("%05s", $Gsequence);
$Pcard_id = "$run-$Pbatch-$Psequence";
$stmt = "SELECT count(*) FROM callcard_accounts_details where card_id='$Pcard_id';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$vt_ct = mysql_num_rows($rslt);
if ($vt_ct > 0)
{
$row=mysql_fetch_row($rslt);
$duplicate_count = $row[0];
if ($duplicate_count < 1)
{
$duplicate_pin=1;
$pin_give_up=0;
while ( ($duplicate_pin > 0) and ($pin_give_up < 100000) )
{
$Ppin = rand(10000000, 99999999);
$stmt = "SELECT count(*) FROM callcard_accounts where pin='$Ppin';";
$rslt=mysql_query($stmt, $link);
if ($DB) {echo "$stmt\n";}
$pin_ct = mysql_num_rows($rslt);
if ($pin_ct > 0)
{
$row=mysql_fetch_row($rslt);
$duplicate_pin = $row[0];
}
else
{
echo "ERROR - cannot query system<BR>\n";
}
$pin_give_up++;
}
### insert card_id and pin into tables
$stmt="INSERT INTO callcard_accounts SET card_id='$Pcard_id',pin='$Ppin',status='GENERATE';";
$rslt=mysql_query($stmt, $link);
$stmt="INSERT INTO callcard_accounts_details SET card_id='$Pcard_id',pin='$Ppin',status='GENERATE';";
$rslt=mysql_query($stmt, $link);
if (eregi("1$|3$|5$|7$|9$", $i))
{$bgcolor='bgcolor="#9BB9FB"';}
else
{$bgcolor='bgcolor="#B9CBFD"';}
echo "<tr $bgcolor>\n";
echo "<td><font size=1> <a href=\"$PHP_SELF?action=CALLCARD_DETAIL&card_id=$Pcard_id&DB=$DB\"><font color=black>$Pcard_id</font></a> </td>";
echo "<td><font size=1> $Ppin </td>";
echo "</tr>\n";
}
else
{
echo "ERROR - card_id already exists: $Pcard_id<BR>\n";
}
}
else
{
echo "ERROR - cannot query system<BR>\n";
}
$i++;
}
echo "</TABLE><BR><BR>\n";
echo "\n";
echo "</center>\n";
}
}
### END generate results
### GENERATE search
if ($action == "GENERATE")
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br>CallCard Generate IDs<form action=$PHP_SELF method=POST>\n";
echo "<input type=hidden name=action value=GENERATE_RESULTS>\n";
echo "<input type=hidden name=DB value=$DB>\n";
echo "<center><TABLE width=$section_width cellspacing=3>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Generate Comment: </td><td align=left><input type=text name=comment size=50 maxlength=255></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Run: </td><td align=left><input type=text name=run size=5 maxlength=4></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Batch: </td><td align=left><input type=text name=batch size=6 maxlength=5></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Sequence: </td><td align=left><input type=text name=sequence size=6 maxlength=5></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=right>Total: </td><td align=left><input type=text name=total size=8 maxlength=7></td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2><input type=submit name=SUBMIT value=SUBMIT></td></tr>\n";
echo "</TABLE></center>\n";
echo "\n";
echo "</center>\n";
}
### GENERATE search
### BEGIN search results
if ($action == "SEARCH_RESULTS")
{
@@ -629,6 +762,7 @@ if ($action == "SEARCH_RESULTS")
### END search results
### BEGIN search
if ($action == "SEARCH")
{