Created stable release branch of 2.2.0
git-svn-id: svn://192.168.202.10@1297 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
################ INSTALL
|
||||
|
||||
For in-depth installation instructions read the docs/SCRATCH_INSTALL.txt file
|
||||
|
||||
For more brief install instructions read the docs/BASE_INSTALL.txt file
|
||||
|
||||
For Requirements of astGUIclient/VICIDIAL read the docs/REQUIREMENTS.txt file
|
||||
|
||||
For installtion on Ubuntu Linux read the docs/Ubuntu_install.txt
|
||||
|
||||
|
||||
To place the astGUIclient/VICIDIAL files where they belong on the server:
|
||||
run the install.pl script from this directory:
|
||||
perl install.pl
|
||||
|
||||
|
||||
If you are upgrading from a previous version, see the UPGRADE file
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
# active_list_refresh.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to serve updates of the live data to the display scripts
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ADD - ('1','2','3','4','5')
|
||||
# - $order - ('asc','desc')
|
||||
# - $format - ('text','table','menu','selectlist','textarea')
|
||||
# - $bgcolor - ('#123456','white','black','etc...')
|
||||
# - $txtcolor - ('#654321','black','white','etc...')
|
||||
# - $txtsize - ('1','2','3','etc...')
|
||||
# - $selectsize - ('2','3','4','etc...')
|
||||
# - $selectfontsize - ('8','10','12','etc...')
|
||||
# - $selectedext - ('cc100')
|
||||
# - $selectedtrunk - ('Zap/25-1')
|
||||
# - $selectedlocal - ('SIP/cc100')
|
||||
# - $textareaheight - ('8','10','12','etc...')
|
||||
# - $textareawidth - ('8','10','12','etc...')
|
||||
# - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1118 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$ADD=ereg_replace("[^0-9]","",$ADD);
|
||||
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
|
||||
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
|
||||
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
|
||||
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
|
||||
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
|
||||
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
|
||||
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
|
||||
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
|
||||
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
|
||||
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
|
||||
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
|
||||
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
|
||||
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1118';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Usuário/Senha: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSÃO: $version CONFIGURAÇÃO: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Mostrar Lista: ";
|
||||
if ($ADD==1) {echo "Extensões Ativas";}
|
||||
if ($ADD==2) {echo "Extensões Ocupadas";}
|
||||
if ($ADD==3) {echo "Linhas externas";}
|
||||
if ($ADD==4) {echo "Extensões Locais";}
|
||||
if ($ADD==5) {echo "Conferencias";}
|
||||
if ($ADD==99999) {echo "AJUDA";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- tempo de execução do script: $RUNtimesegundos -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
# call_log_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
# - $in_limit - ('10','20','50','100',...)
|
||||
# - $out_limit - ('10','20','50','100',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1202 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1202';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Usuário/Senha: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSÃO: $version CONFIGURAÇÃO: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Registro de Ligações";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten não é válido ou protocolo $protocol não é válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tempo de execução do script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1201 - Added variable filters to close security holes for login form
|
||||
# 61128-2255 - Added update for manual dial vicidial_live_agents
|
||||
# 70319-1542 - Added agent disabled display function
|
||||
# 71122-0205 - Added vicidial_live_agent status output
|
||||
# 80424-0442 - Added non_latin lookup from system_settings
|
||||
# 80519-1425 - Added calls-in-queue tally
|
||||
# 80703-1106 - Added API functionality for Hangup and Dispo
|
||||
# 81104-0229 - Added mysql error logging capability
|
||||
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
|
||||
# 90102-1402 - Added check for system and database time synchronization
|
||||
# 90120-1720 - Added compatibility for API pause/resume and dial a number
|
||||
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
|
||||
# 90408-0020 - Added API vtiger specific callback activity record ability
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
|
||||
# 90908-1037 - Added DEAD call logging
|
||||
# 91130-2022 - Added code for manager override of in-group selection
|
||||
# 91228-1341 - Added API fields update functions
|
||||
#
|
||||
|
||||
$version = '2.2.0-24';
|
||||
$build = '91228-1341';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=17;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Usuário/Senha: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSÃO: $version CONFIGURAÇÃO: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Verificação da Extensão de Conferência";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten não é válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
$Acount=0;
|
||||
$AexternalDEAD=0;
|
||||
$Aagent_log_id='';
|
||||
$Acallerid='';
|
||||
$DEADcustomer=0;
|
||||
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
$Acampaign_id = $row[3];
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
|
||||
##### BEGIN DEAD logging section #####
|
||||
### find whether the call the agent isligadois hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
|
||||
{
|
||||
$DEADcustomer++;
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
{
|
||||
$NEWdead_epoch = date("U");
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
##### END DEAD logging section #####
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Solicita, em fila: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Solicita, em fila: $RingCalls</font>";}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
$external_dial = $row[3];
|
||||
$external_update_fields = $row[4];
|
||||
$external_update_fields_data = $row[5];
|
||||
$timer_action = $row[6];
|
||||
$timer_action_message = $row[7];
|
||||
$timer_action_seconds = $row[8];
|
||||
|
||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
$web_diff = ($db_epoch - $web_epoch);
|
||||
|
||||
##### check for in-group change details
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
$outbound_autodial = $row[3];
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
$NEWoutbound_autodial='N';
|
||||
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
|
||||
{$NEWoutbound_autodial='Y';}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
|
||||
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
|
||||
|
||||
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
|
||||
$Ashift_logout=0;
|
||||
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|INICIAR",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
|
||||
{
|
||||
$shift_ok=0;
|
||||
if (strlen($LOGgroup_shiftsSQL) < 3)
|
||||
{$Ashift_logout++;}
|
||||
else
|
||||
{
|
||||
$HHMM = date("Hi");
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
$shift_weekdays = $rowx[3];
|
||||
|
||||
if (eregi("$wday",$shift_weekdays))
|
||||
{
|
||||
$HHshift_length = substr($shift_length,0,2);
|
||||
$MMshift_length = substr($shift_length,3,2);
|
||||
$HHshift_start_time = substr($shift_start_time,0,2);
|
||||
$MMshift_start_time = substr($shift_start_time,2,2);
|
||||
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
|
||||
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
|
||||
if ($MMshift_end_time > 59)
|
||||
{
|
||||
$MMshift_end_time = ($MMshift_end_time - 60);
|
||||
$HHshift_end_time++;
|
||||
}
|
||||
if ($HHshift_end_time > 23)
|
||||
{$HHshift_end_time = ($HHshift_end_time - 24);}
|
||||
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
|
||||
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
|
||||
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
|
||||
|
||||
if (
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
|
||||
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
|
||||
)
|
||||
{$shift_ok++;}
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($shift_ok < 1)
|
||||
{$Ashift_logout++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
|
||||
{$Alogin='TIME_SYNC';}
|
||||
if ($Acount < 1)
|
||||
{$Alogin='DEAD_VLA';}
|
||||
if ($AexternalDEAD > 0)
|
||||
{$Alogin='DEAD_EXTERNAL';}
|
||||
if ($Ashift_logout > 0)
|
||||
{$Alogin='SHIFT_SAIR';}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$CanalA[$counter] ~";
|
||||
# echo "$CanalA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten não é válido or Exten $exten não é válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
echo "Conferencia $conf_exten já foi registrado para $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tempo de execução do script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
##### MySQL Error Logging #####
|
||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||
{
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
}
|
||||
$one_mysql_log=0;
|
||||
return $errno;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect.php version 2.2.0
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (ereg("^PATHlogs", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (ereg("^PATHweb", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (ereg("^VARDB_server", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (ereg("^VARDB_database", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (ereg("^VARDB_user", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (ereg("^VARDB_pass", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (ereg("^VARDB_port", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
|
||||
if (!$link) {
|
||||
die('MySQL connect ERROR: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db("$VARDB_database",$link);
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to open up when a live_inbound call comes in giving the user
|
||||
# options of what to do with the call or options to lookup the callerID on various web sites
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $uniqueid - ('1234567890.123456',...)
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $voicemail_dump_exten - ('85026666666666')
|
||||
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.6';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Usuário/Senha: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSÃO: $version CONFIGURAÇÃO: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<?php echo $server_ip ?>';
|
||||
var epoch_sec = '<?php echo $StarTtime ?>';
|
||||
var user_abb = '<?php echo $user_abb ?>';
|
||||
var vmail_box = '<?php echo $vmail_box ?>';
|
||||
var ext_context = '<?php echo $ext_context ?>';
|
||||
var ext_priority = '<?php echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<?php echo $session_name ?>';
|
||||
var user = '<?php echo $user ?>';
|
||||
var pass = '<?php echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30segundos
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<title>CHAMADA ENTRANDO";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>CHAMADA ENTRANDO</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid não é válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Canal: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>CallerID: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Telefone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Telefone?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Telefone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Canal=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">CUSTOMIZADO</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Número Discado: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Notas:</td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">DESLIGAR</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">ENVIAR PARA MINHA CAIXA POSTAL</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tempo de execução do script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
# live_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1203 - Added variable filters to close security holes for login form
|
||||
# 60825-1029 - Fixed translation variable issue ChannelA
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '2.0.1';
|
||||
$build = '60825-1029';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Usuário/Senha: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSÃO: $version CONFIGURAÇÃO: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Verificação de extensões ativas";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten não é válido ou protocolo $protocol não é válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $ChanneLA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tempo de execução do script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the details on the parked calls on the server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Inválido Usuário/Senha: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSÃO: $version CONFIGURAÇÃO: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Mostra as ligações em espera";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten não é válido ou protocolo $protocol não é válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tempo de execução do script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
# timeclock.php - VICIDIAL system user timeclock
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 80523-0134 - First Build
|
||||
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
|
||||
# 80525-2351 - Added an audit log that is not to be editable
|
||||
# 80602-0641 - Fixed status update bug
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
$version = '2.2.0-5';
|
||||
$build = '90508-0727';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$last_action_date = $NOW_TIME;
|
||||
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
|
||||
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
|
||||
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
|
||||
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
|
||||
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
|
||||
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
|
||||
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
|
||||
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
|
||||
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
|
||||
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
|
||||
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
|
||||
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
|
||||
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
|
||||
if (!isset($phone_login))
|
||||
{
|
||||
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
|
||||
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
|
||||
}
|
||||
if (!isset($phone_pass))
|
||||
{
|
||||
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
|
||||
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=ereg_replace("[^0-9a-z]","",$DB);
|
||||
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
|
||||
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
|
||||
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
|
||||
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
|
||||
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
|
||||
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
|
||||
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
{
|
||||
### see if user/pass exist for this user in vicidial_users table
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$valid_user=$row[0];
|
||||
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
|
||||
|
||||
if ($valid_user < 1)
|
||||
{
|
||||
### NOT A VALID USER/PASS
|
||||
$VDdisplayMESSAGE = "O usuário ea senha que você digitou não são ativos no sistema<BR>Por favor, tente novamente:";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Login do Usuário: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Senha do Usuário: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSÃO: $version CONFIGURAÇÃO: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
### VALID USER/PASS, CONTINUE
|
||||
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
|
||||
if ($vts_count > 0)
|
||||
{
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
$last_action_sec = ($StarTtimE - $event_epoch);
|
||||
if ($last_action_sec > 0)
|
||||
{
|
||||
$totTIME_H = ($last_action_sec / 3600);
|
||||
$totTIME_H_int = round($totTIME_H, 2);
|
||||
$totTIME_H_int = intval("$totTIME_H");
|
||||
$totTIME_M = ($totTIME_H - $totTIME_H_int);
|
||||
$totTIME_M = ($totTIME_M * 60);
|
||||
$totTIME_M_int = round($totTIME_M, 2);
|
||||
$totTIME_M_int = intval("$totTIME_M");
|
||||
$totTIME_S = ($totTIME_M - $totTIME_M_int);
|
||||
$totTIME_S = ($totTIME_S * 60);
|
||||
$totTIME_S = round($totTIME_S, 0);
|
||||
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
|
||||
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
|
||||
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
|
||||
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
|
||||
}
|
||||
else
|
||||
{
|
||||
$totTIME_HMS='0:00:00';
|
||||
}
|
||||
|
||||
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='INICIAR', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$status='INICIAR';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NOVO vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'INICIAR') )
|
||||
{
|
||||
### You cannot log in or out within 30segundos of your last login/logout
|
||||
$VDdisplayMESSAGE = "Você não pode efetuar login ou para fora dentro de 30 segundos do seu último login ou logout";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Login do Usuário: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Senha do Usuário: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSÃO: $version CONFIGURAÇÃO: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($commit == 'YES')
|
||||
{
|
||||
if ( ( ($status=='AUTOSAIR') or ($status=='INICIAR') or ($status=='SAIR') ) and ($stage=='login') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "You have now logged-in";
|
||||
$LOGtimeMESSAGE = "You logged in at $NOW_TIME";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NOVO vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NOVO vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ($status=='LOGIN') and ($stage=='logout') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Você tem agora autenticado-out";
|
||||
$LOGtimeMESSAGE = "Você saiu em$NOW_TIME<BR>Quantidade de tempo que foram registradas em:$totTIME_HMS";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='SAIR', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NOVO vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='SAIR', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='SAIR', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NOVO vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ( ( ($status=='AUTOSAIR') or ($status=='INICIAR') or ($status=='SAIR') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
|
||||
{echo "ERRO: timeclock entrada do log já realizados:$status|$stage"; exit;}
|
||||
|
||||
if ($referrer=='agent')
|
||||
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">BACK TO Agent Login Screen</font></A>";}
|
||||
if ($referrer=='admin')
|
||||
{$BACKlink = "<A HREF=\"../vicidial/admin.php\"><font color=\"#003333\">Retornar para Administração</font></A>";}
|
||||
if ($referrer=='welcome')
|
||||
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">ANTERIOR a tela Bem-vindo</font></A>";}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSÃO: $version CONFIGURAÇÃO: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ($status=='AUTOSAIR') or ($status=='INICIAR') or ($status=='SAIR') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Vez desde que foi registrado em:$totTIME_HMS";
|
||||
$log_action = 'login';
|
||||
$button_name = 'LOGIN';
|
||||
$LOGtimeMESSAGE = "Você última autenticado-out em:$last_action_date<BR><BR>LOGIN Clique abaixo para log-in";
|
||||
}
|
||||
if ($status=='LOGIN')
|
||||
{
|
||||
$VDdisplayMESSAGE = "Quantidade de tempo que tem sido registrado em:$totTIME_HMS";
|
||||
$log_action = 'logout';
|
||||
$button_name = 'SAIR';
|
||||
$LOGtimeMESSAGE = "Você autenticado-nos em: $last_action_date<BR>Quantidade de tempo que tem sido registrado em:$totTIME_HMS<BR><BR>SAIR Clique abaixo para log-out";
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSÃO: $version CONFIGURAÇÃO: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Login do Usuário: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Senha do Usuário: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSÃO: $version CONFIGURAÇÃO: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
# vdc_script_display.php
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed display the contents of the SCRIPT tab in the agent interface
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90824-1435 - First build of script
|
||||
# 90827-1548 - Added list override script option
|
||||
# 91204-1913 - Added recording_filename and recording_id variables
|
||||
# 91211-1103 - Added user_custom_... variables
|
||||
#
|
||||
|
||||
$version = '2.2.0-4';
|
||||
$build = '91211-1103';
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
$vendor_lead_code = $vendor_id;
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
|
||||
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["title"])) {$title=$_GET["title"];}
|
||||
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
|
||||
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
|
||||
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
|
||||
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
|
||||
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
|
||||
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
|
||||
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
|
||||
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
|
||||
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
|
||||
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
|
||||
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
|
||||
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
|
||||
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
|
||||
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
|
||||
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
|
||||
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
|
||||
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
|
||||
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
|
||||
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
|
||||
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
|
||||
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
|
||||
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
|
||||
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
|
||||
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
|
||||
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
|
||||
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
|
||||
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
|
||||
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
|
||||
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
|
||||
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
|
||||
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
|
||||
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
|
||||
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
|
||||
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
|
||||
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
|
||||
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
|
||||
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
|
||||
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
|
||||
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
|
||||
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
|
||||
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
|
||||
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
|
||||
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
|
||||
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
|
||||
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
|
||||
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
|
||||
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
|
||||
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
|
||||
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
|
||||
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
|
||||
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
|
||||
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
|
||||
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
|
||||
|
||||
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
|
||||
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
|
||||
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
|
||||
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
$txt = '.txt';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$CIDdate = date("mdHis");
|
||||
$ENTRYdate = date("YmdHis");
|
||||
$MT[0]='';
|
||||
$agents='@agents';
|
||||
|
||||
$IFRAME=0;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
|
||||
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
|
||||
$phone_code = ereg_replace("[^0-9]","",$phone_code);
|
||||
$phone_number = ereg_replace("[^0-9]","",$phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = ereg_replace("'|\"|\\\\|;","",$user);
|
||||
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
|
||||
}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if ($format == 'debug') {$DB=1;}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalid Username/Password: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
|
||||
echo "<title>VICIDiaL Script Display Script";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if (strlen($in_script) < 1)
|
||||
{$call_script = $camp_script;}
|
||||
else
|
||||
{$call_script = $in_script;}
|
||||
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
if (eregi("iframe src",$script_text))
|
||||
{
|
||||
$IFRAME=1;
|
||||
$lead_id = eregi_replace(' ','+',$lead_id);
|
||||
$vendor_id = eregi_replace(' ','+',$vendor_id);
|
||||
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
|
||||
$list_id = eregi_replace(' ','+',$list_id);
|
||||
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
|
||||
$phone_code = eregi_replace(' ','+',$phone_code);
|
||||
$phone_number = eregi_replace(' ','+',$phone_number);
|
||||
$title = eregi_replace(' ','+',$title);
|
||||
$first_name = eregi_replace(' ','+',$first_name);
|
||||
$middle_initial = eregi_replace(' ','+',$middle_initial);
|
||||
$last_name = eregi_replace(' ','+',$last_name);
|
||||
$address1 = eregi_replace(' ','+',$address1);
|
||||
$address2 = eregi_replace(' ','+',$address2);
|
||||
$address3 = eregi_replace(' ','+',$address3);
|
||||
$city = eregi_replace(' ','+',$city);
|
||||
$state = eregi_replace(' ','+',$state);
|
||||
$province = eregi_replace(' ','+',$province);
|
||||
$postal_code = eregi_replace(' ','+',$postal_code);
|
||||
$country_code = eregi_replace(' ','+',$country_code);
|
||||
$gender = eregi_replace(' ','+',$gender);
|
||||
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
|
||||
$alt_phone = eregi_replace(' ','+',$alt_phone);
|
||||
$email = eregi_replace(' ','+',$email);
|
||||
$security_phrase = eregi_replace(' ','+',$security_phrase);
|
||||
$comments = eregi_replace(' ','+',$comments);
|
||||
$user = eregi_replace(' ','+',$user);
|
||||
$pass = eregi_replace(' ','+',$pass);
|
||||
$campaign = eregi_replace(' ','+',$campaign);
|
||||
$phone_login = eregi_replace(' ','+',$phone_login);
|
||||
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
|
||||
$phone_pass = eregi_replace(' ','+',$phone_pass);
|
||||
$fronter = eregi_replace(' ','+',$fronter);
|
||||
$closer = eregi_replace(' ','+',$closer);
|
||||
$group = eregi_replace(' ','+',$group);
|
||||
$channel_group = eregi_replace(' ','+',$channel_group);
|
||||
$SQLdate = eregi_replace(' ','+',$SQLdate);
|
||||
$epoch = eregi_replace(' ','+',$epoch);
|
||||
$uniqueid = eregi_replace(' ','+',$uniqueid);
|
||||
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
|
||||
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
|
||||
$server_ip = eregi_replace(' ','+',$server_ip);
|
||||
$SIPexten = eregi_replace(' ','+',$SIPexten);
|
||||
$session_id = eregi_replace(' ','+',$session_id);
|
||||
$phone = eregi_replace(' ','+',$phone);
|
||||
$parked_by = eregi_replace(' ','+',$parked_by);
|
||||
$dispo = eregi_replace(' ','+',$dispo);
|
||||
$dialed_number = eregi_replace(' ','+',$dialed_number);
|
||||
$dialed_label = eregi_replace(' ','+',$dialed_label);
|
||||
$source_id = eregi_replace(' ','+',$source_id);
|
||||
$rank = eregi_replace(' ','+',$rank);
|
||||
$owner = eregi_replace(' ','+',$owner);
|
||||
$camp_script = eregi_replace(' ','+',$camp_script);
|
||||
$in_script = eregi_replace(' ','+',$in_script);
|
||||
$script_width = eregi_replace(' ','+',$script_width);
|
||||
$script_height = eregi_replace(' ','+',$script_height);
|
||||
$fullname = eregi_replace(' ','+',$fullname);
|
||||
$recording_filename = eregi_replace(' ','+',$recording_filename);
|
||||
$recording_id = eregi_replace(' ','+',$recording_id);
|
||||
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
|
||||
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
|
||||
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
|
||||
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
|
||||
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
|
||||
}
|
||||
|
||||
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
|
||||
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
|
||||
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
|
||||
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
|
||||
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
|
||||
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
|
||||
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
|
||||
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
|
||||
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
|
||||
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
|
||||
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
|
||||
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
|
||||
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
|
||||
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
|
||||
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
|
||||
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
|
||||
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
|
||||
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
|
||||
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
|
||||
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
|
||||
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
|
||||
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
|
||||
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
|
||||
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
|
||||
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
|
||||
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
|
||||
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
|
||||
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
|
||||
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
|
||||
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
|
||||
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
|
||||
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
|
||||
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
|
||||
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
|
||||
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
|
||||
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
|
||||
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
|
||||
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
|
||||
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
|
||||
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
|
||||
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
|
||||
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
|
||||
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
|
||||
$script_text = eregi_replace("\n","<BR>",$script_text);
|
||||
$script_text = stripslashes($script_text);
|
||||
|
||||
|
||||
echo "<!-- IFRAME$IFRAME -->\n";
|
||||
echo "<!-- $script_id -->\n";
|
||||
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
|
||||
echo "<center><B>$script_name</B><BR></center>\n";
|
||||
echo "$script_text\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "</div>";}
|
||||
echo "</TD></TR></TABLE>\n";
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
# voicemail_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1204 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60619-1204';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Usuário/Senha: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSÃO: $version CONFIGURAÇÃO: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Verificar caixa postal";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Caixa Postal $vmail_box não é válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tempo de execução do script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
# active_list_refresh.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to serve updates of the live data to the display scripts
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ADD - ('1','2','3','4','5')
|
||||
# - $order - ('asc','desc')
|
||||
# - $format - ('text','table','menu','selectlist','textarea')
|
||||
# - $bgcolor - ('#123456','white','black','etc...')
|
||||
# - $txtcolor - ('#654321','black','white','etc...')
|
||||
# - $txtsize - ('1','2','3','etc...')
|
||||
# - $selectsize - ('2','3','4','etc...')
|
||||
# - $selectfontsize - ('8','10','12','etc...')
|
||||
# - $selectedext - ('cc100')
|
||||
# - $selectedtrunk - ('Zap/25-1')
|
||||
# - $selectedlocal - ('SIP/cc100')
|
||||
# - $textareaheight - ('8','10','12','etc...')
|
||||
# - $textareawidth - ('8','10','12','etc...')
|
||||
# - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1118 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$ADD=ereg_replace("[^0-9]","",$ADD);
|
||||
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
|
||||
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
|
||||
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
|
||||
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
|
||||
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
|
||||
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
|
||||
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
|
||||
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
|
||||
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
|
||||
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
|
||||
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
|
||||
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
|
||||
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1118';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Unzulässig Benutzername/Passwort: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Unzulässig session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Liste Display: ";
|
||||
if ($ADD==1) {echo "Live Nebenstellen";}
|
||||
if ($ADD==2) {echo "Besetzte Nebenstellen";}
|
||||
if ($ADD==3) {echo "Amtsleitungen";}
|
||||
if ($ADD==4) {echo "Lokale Nebenstellen";}
|
||||
if ($ADD==5) {echo "Konferenzen";}
|
||||
if ($ADD==99999) {echo "HILFE";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- Scriptlaufzeit: $RUNtimeSekunden -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
# call_log_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
# - $in_limit - ('10','20','50','100',...)
|
||||
# - $out_limit - ('10','20','50','100',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1202 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1202';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Unzulässig Benutzername/Passwort: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Unzulässig session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Anruf Log Anzeige";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten ist unzulässig oder Protokoll $protocol ist unzulässig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- Scriptlaufzeit: $RUNtimeSekunden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1201 - Added variable filters to close security holes for login form
|
||||
# 61128-2255 - Added update for manual dial vicidial_live_agents
|
||||
# 70319-1542 - Added agent disabled display function
|
||||
# 71122-0205 - Added vicidial_live_agent status output
|
||||
# 80424-0442 - Added non_latin lookup from system_settings
|
||||
# 80519-1425 - Added calls-in-queue tally
|
||||
# 80703-1106 - Added API functionality for Hangup and Dispo
|
||||
# 81104-0229 - Added mysql error logging capability
|
||||
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
|
||||
# 90102-1402 - Added check for system and database time synchronization
|
||||
# 90120-1720 - Added compatibility for API pause/resume and dial a number
|
||||
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
|
||||
# 90408-0020 - Added API vtiger specific callback activity record ability
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
|
||||
# 90908-1037 - Added DEAD call logging
|
||||
# 91130-2022 - Added code for manager override of in-group selection
|
||||
# 91228-1341 - Added API fields update functions
|
||||
#
|
||||
|
||||
$version = '2.2.0-24';
|
||||
$build = '91228-1341';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=17;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Unzulässig Benutzername/Passwort: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Unzulässig session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Conf Extension Check";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten ist unzulässig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
$Acount=0;
|
||||
$AexternalDEAD=0;
|
||||
$Aagent_log_id='';
|
||||
$Acallerid='';
|
||||
$DEADcustomer=0;
|
||||
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
$Acampaign_id = $row[3];
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
|
||||
##### BEGIN DEAD logging section #####
|
||||
### find whether the call the agent is an is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
|
||||
{
|
||||
$DEADcustomer++;
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
{
|
||||
$NEWdead_epoch = date("U");
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
##### END DEAD logging section #####
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Wartende Anrufe: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Wartende Anrufe: $RingCalls</font>";}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
$external_dial = $row[3];
|
||||
$external_update_fields = $row[4];
|
||||
$external_update_fields_data = $row[5];
|
||||
$timer_action = $row[6];
|
||||
$timer_action_message = $row[7];
|
||||
$timer_action_seconds = $row[8];
|
||||
|
||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
$web_diff = ($db_epoch - $web_epoch);
|
||||
|
||||
##### check for in-group change details
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
$outbound_autodial = $row[3];
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
$NEWoutbound_autodial='N';
|
||||
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
|
||||
{$NEWoutbound_autodial='Y';}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
|
||||
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
|
||||
|
||||
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
|
||||
$Ashift_logout=0;
|
||||
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|START",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
|
||||
{
|
||||
$shift_ok=0;
|
||||
if (strlen($LOGgroup_shiftsSQL) < 3)
|
||||
{$Ashift_logout++;}
|
||||
else
|
||||
{
|
||||
$HHMM = date("Hi");
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
$shift_weekdays = $rowx[3];
|
||||
|
||||
if (eregi("$wday",$shift_weekdays))
|
||||
{
|
||||
$HHshift_length = substr($shift_length,0,2);
|
||||
$MMshift_length = substr($shift_length,3,2);
|
||||
$HHshift_start_time = substr($shift_start_time,0,2);
|
||||
$MMshift_start_time = substr($shift_start_time,2,2);
|
||||
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
|
||||
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
|
||||
if ($MMshift_end_time > 59)
|
||||
{
|
||||
$MMshift_end_time = ($MMshift_end_time - 60);
|
||||
$HHshift_end_time++;
|
||||
}
|
||||
if ($HHshift_end_time > 23)
|
||||
{$HHshift_end_time = ($HHshift_end_time - 24);}
|
||||
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
|
||||
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
|
||||
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
|
||||
|
||||
if (
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
|
||||
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
|
||||
)
|
||||
{$shift_ok++;}
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($shift_ok < 1)
|
||||
{$Ashift_logout++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
|
||||
{$Alogin='TIME_SYNC';}
|
||||
if ($Acount < 1)
|
||||
{$Alogin='DEAD_VLA';}
|
||||
if ($AexternalDEAD > 0)
|
||||
{$Alogin='DEAD_EXTERNAL';}
|
||||
if ($Ashift_logout > 0)
|
||||
{$Alogin='SHIFT_LOGOUT';}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$KanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$KanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$KanalA[$counter] ~";
|
||||
# echo "$KanalA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten ist unzulässig or Exten $exten ist unzulässig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
echo "Konferenz $conf_exten wurde registriert bei $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- Scriptlaufzeit: $RUNtimeSekunden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
##### MySQL Error Logging #####
|
||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||
{
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
}
|
||||
$one_mysql_log=0;
|
||||
return $errno;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect.php version 2.2.0
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (ereg("^PATHlogs", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (ereg("^PATHweb", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (ereg("^VARDB_server", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (ereg("^VARDB_database", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (ereg("^VARDB_user", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (ereg("^VARDB_pass", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (ereg("^VARDB_port", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
|
||||
if (!$link) {
|
||||
die('MySQL connect ERROR: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db("$VARDB_database",$link);
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to open up when a live_inbound call comes in giving the user
|
||||
# options of what to do with the call or options to lookup the callerID on various web sites
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $uniqueid - ('1234567890.123456',...)
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $voicemail_dump_exten - ('85026666666666')
|
||||
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.6';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Unzulässig Benutzername/Passwort: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Unzulässig session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<?php echo $server_ip ?>';
|
||||
var epoch_sec = '<?php echo $StarTtime ?>';
|
||||
var user_abb = '<?php echo $user_abb ?>';
|
||||
var vmail_box = '<?php echo $vmail_box ?>';
|
||||
var ext_context = '<?php echo $ext_context ?>';
|
||||
var ext_priority = '<?php echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<?php echo $session_name ?>';
|
||||
var user = '<?php echo $user ?>';
|
||||
var pass = '<?php echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30Sekunden
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<title>LIVE INBOUND ANRUF";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>LIVE INBOUND ANRUF</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid ist unzulässig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Kanal: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>AnruferID: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Telefon?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Telefon?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Telefon?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Kanal=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">ANGEPASST</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Gewählte Nummer: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Notizen: </td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">AUFLEGEN</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">AN MEINE VOICEMAILBOX SENDEN</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- Scriptlaufzeit: $RUNtimeSekunden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
# live_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1203 - Added variable filters to close security holes for login form
|
||||
# 60825-1029 - Fixed translation variable issue ChannelA
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '2.0.1';
|
||||
$build = '60825-1029';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Unzulässig Benutzername/Passwort: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Unzulässig session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Aktive Nebenstelle überprüfen";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten ist unzulässig oder Protokoll $protocol ist unzulässig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanalA: $ChanneLA[$counter] ~";
|
||||
echo "KanalB: $ChanneLB[$counter] ~";
|
||||
echo "KanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanalA: $ChanneLA[$counter] ~";
|
||||
echo "KanalB: $ChanneLB[$counter] ~";
|
||||
echo "KanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanalA: $ChanneLA[$counter] ~";
|
||||
echo "KanalB: $ChanneLB[$counter] ~";
|
||||
echo "KanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanalA: $ChanneLA[$counter] ~";
|
||||
echo "KanalB: $ChanneLB[$counter] ~";
|
||||
echo "KanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanalA: $ChanneLA[$counter] ~";
|
||||
echo "KanalB: $ChanneLB[$counter] ~";
|
||||
echo "KanalBtrunk: $ChanneLA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- Scriptlaufzeit: $RUNtimeSekunden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the details on the parked calls on the server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Unzulässig Benutzername/Passwort: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Unzulässig session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Geparkte Anruf anzeigen";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten ist unzulässig oder Protokoll $protocol ist unzulässig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- Scriptlaufzeit: $RUNtimeSekunden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
# timeclock.php - VICIDIAL system user timeclock
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 80523-0134 - First Build
|
||||
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
|
||||
# 80525-2351 - Added an audit log that is not to be editable
|
||||
# 80602-0641 - Fixed status update bug
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
$version = '2.2.0-5';
|
||||
$build = '90508-0727';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$last_action_date = $NOW_TIME;
|
||||
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
|
||||
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
|
||||
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
|
||||
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
|
||||
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
|
||||
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
|
||||
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
|
||||
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
|
||||
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
|
||||
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
|
||||
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
|
||||
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
|
||||
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
|
||||
if (!isset($phone_login))
|
||||
{
|
||||
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
|
||||
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
|
||||
}
|
||||
if (!isset($phone_pass))
|
||||
{
|
||||
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
|
||||
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=ereg_replace("[^0-9a-z]","",$DB);
|
||||
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
|
||||
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
|
||||
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
|
||||
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
|
||||
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
|
||||
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
|
||||
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
{
|
||||
### see if user/pass exist for this user in vicidial_users table
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$valid_user=$row[0];
|
||||
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
|
||||
|
||||
if ($valid_user < 1)
|
||||
{
|
||||
### NOT A VALID USER/PASS
|
||||
$VDdisplayMESSAGE = "Diese Benutzer und Passwort Kombination ist nicht gültig<BR>Bitte noch einmal:";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Stechuhr</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Stechuhr </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Benutzer Login: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Benutzer Passwort: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ÜBERNEHMEN VALUE=ÜBERNEHMEN> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
### VALID USER/PASS, CONTINUE
|
||||
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
|
||||
if ($vts_count > 0)
|
||||
{
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
$last_action_sec = ($StarTtimE - $event_epoch);
|
||||
if ($last_action_sec > 0)
|
||||
{
|
||||
$totTIME_H = ($last_action_sec / 3600);
|
||||
$totTIME_H_int = round($totTIME_H, 2);
|
||||
$totTIME_H_int = intval("$totTIME_H");
|
||||
$totTIME_M = ($totTIME_H - $totTIME_H_int);
|
||||
$totTIME_M = ($totTIME_M * 60);
|
||||
$totTIME_M_int = round($totTIME_M, 2);
|
||||
$totTIME_M_int = intval("$totTIME_M");
|
||||
$totTIME_S = ($totTIME_M - $totTIME_M_int);
|
||||
$totTIME_S = ($totTIME_S * 60);
|
||||
$totTIME_S = round($totTIME_S, 0);
|
||||
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
|
||||
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
|
||||
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
|
||||
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
|
||||
}
|
||||
else
|
||||
{
|
||||
$totTIME_HMS='0:00:00';
|
||||
}
|
||||
|
||||
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='START', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$status='START';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NEU vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'START') )
|
||||
{
|
||||
### You cannot log in or out within 30Sekunden of your last login/logout
|
||||
$VDdisplayMESSAGE = "Bitte warten Sie wenigstens 30 Sekunden zwischen dem an- und abmelden und umgekehrt";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Stechuhr</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Stechuhr </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Benutzer Login: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Benutzer Passwort: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ÜBERNEHMEN VALUE=ÜBERNEHMEN> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($commit == 'YES')
|
||||
{
|
||||
if ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='login') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "You have now logged-in";
|
||||
$LOGtimeMESSAGE = "You logged in at $NOW_TIME";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NEU vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NEU vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ($status=='LOGIN') and ($stage=='logout') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Sie sind jetzt abgemeldet";
|
||||
$LOGtimeMESSAGE = "Abgemeldet um $NOW_TIME<BR>Zeit die sie angemeldet waren: $totTIME_HMS";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NEU vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGOUT', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NEU vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ( ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
|
||||
{echo "FEHLER: Stechuhreintrag wurde bereits gemacht: $status|$stage"; exit;}
|
||||
|
||||
if ($referrer=='agent')
|
||||
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">ZURÜCK zur Benutzeranmeldung</font></A>";}
|
||||
if ($referrer=='admin')
|
||||
{$BACKlink = "<A HREF=\"../vicidial/admin.php\"><font color=\"#003333\">ZURÜCK zur Administration</font></A>";}
|
||||
if ($referrer=='welcome')
|
||||
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">ZURÜCK zur Einstiegsseite</font></A>";}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Stechuhr</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Stechuhr </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ($status=='AUTOLOGOUT') or ($status=='START') or ($status=='LOGOUT') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Zeit seit Sie das letzte mal angemeldet waren: $totTIME_HMS";
|
||||
$log_action = 'login';
|
||||
$button_name = 'LOGIN';
|
||||
$LOGtimeMESSAGE = "Zuletzt ausgelogged um: $last_action_date<BR><BR>Klicken Sie unten auf LOGIN um sich anzumelden";
|
||||
}
|
||||
if ($status=='LOGIN')
|
||||
{
|
||||
$VDdisplayMESSAGE = "Zeit die Sie bereits angemeldet sind: $totTIME_HMS";
|
||||
$log_action = 'logout';
|
||||
$button_name = 'LOGOUT';
|
||||
$LOGtimeMESSAGE = "Angemeldet seit: $last_action_date<BR>Zeit die Sie bereits angemeldet sind: $totTIME_HMS<BR><BR>Klicken Sie unten auf LOGOUT um sich abzumelden";
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Stechuhr</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Stechuhr </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Stechuhr</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Stechuhr </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Benutzer Login: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Benutzer Passwort: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ÜBERNEHMEN VALUE=ÜBERNEHMEN> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
# vdc_script_display.php
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed display the contents of the SCRIPT tab in the agent interface
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90824-1435 - First build of script
|
||||
# 90827-1548 - Added list override script option
|
||||
# 91204-1913 - Added recording_filename and recording_id variables
|
||||
# 91211-1103 - Added user_custom_... variables
|
||||
#
|
||||
|
||||
$version = '2.2.0-4';
|
||||
$build = '91211-1103';
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
$vendor_lead_code = $vendor_id;
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
|
||||
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["title"])) {$title=$_GET["title"];}
|
||||
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
|
||||
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
|
||||
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
|
||||
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
|
||||
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
|
||||
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
|
||||
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
|
||||
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
|
||||
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
|
||||
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
|
||||
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
|
||||
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
|
||||
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
|
||||
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
|
||||
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
|
||||
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
|
||||
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
|
||||
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
|
||||
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
|
||||
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
|
||||
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
|
||||
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
|
||||
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
|
||||
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
|
||||
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
|
||||
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
|
||||
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
|
||||
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
|
||||
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
|
||||
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
|
||||
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
|
||||
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
|
||||
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
|
||||
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
|
||||
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
|
||||
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
|
||||
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
|
||||
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
|
||||
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
|
||||
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
|
||||
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
|
||||
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
|
||||
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
|
||||
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
|
||||
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
|
||||
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
|
||||
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
|
||||
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
|
||||
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
|
||||
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
|
||||
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
|
||||
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
|
||||
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
|
||||
|
||||
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
|
||||
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
|
||||
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
|
||||
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
$txt = '.txt';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$CIDdate = date("mdHis");
|
||||
$ENTRYdate = date("YmdHis");
|
||||
$MT[0]='';
|
||||
$agents='@agents';
|
||||
|
||||
$IFRAME=0;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
|
||||
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
|
||||
$phone_code = ereg_replace("[^0-9]","",$phone_code);
|
||||
$phone_number = ereg_replace("[^0-9]","",$phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = ereg_replace("'|\"|\\\\|;","",$user);
|
||||
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
|
||||
}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if ($format == 'debug') {$DB=1;}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalid Username/Password: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
|
||||
echo "<title>VICIDiaL Script Display Script";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if (strlen($in_script) < 1)
|
||||
{$call_script = $camp_script;}
|
||||
else
|
||||
{$call_script = $in_script;}
|
||||
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
if (eregi("iframe src",$script_text))
|
||||
{
|
||||
$IFRAME=1;
|
||||
$lead_id = eregi_replace(' ','+',$lead_id);
|
||||
$vendor_id = eregi_replace(' ','+',$vendor_id);
|
||||
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
|
||||
$list_id = eregi_replace(' ','+',$list_id);
|
||||
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
|
||||
$phone_code = eregi_replace(' ','+',$phone_code);
|
||||
$phone_number = eregi_replace(' ','+',$phone_number);
|
||||
$title = eregi_replace(' ','+',$title);
|
||||
$first_name = eregi_replace(' ','+',$first_name);
|
||||
$middle_initial = eregi_replace(' ','+',$middle_initial);
|
||||
$last_name = eregi_replace(' ','+',$last_name);
|
||||
$address1 = eregi_replace(' ','+',$address1);
|
||||
$address2 = eregi_replace(' ','+',$address2);
|
||||
$address3 = eregi_replace(' ','+',$address3);
|
||||
$city = eregi_replace(' ','+',$city);
|
||||
$state = eregi_replace(' ','+',$state);
|
||||
$province = eregi_replace(' ','+',$province);
|
||||
$postal_code = eregi_replace(' ','+',$postal_code);
|
||||
$country_code = eregi_replace(' ','+',$country_code);
|
||||
$gender = eregi_replace(' ','+',$gender);
|
||||
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
|
||||
$alt_phone = eregi_replace(' ','+',$alt_phone);
|
||||
$email = eregi_replace(' ','+',$email);
|
||||
$security_phrase = eregi_replace(' ','+',$security_phrase);
|
||||
$comments = eregi_replace(' ','+',$comments);
|
||||
$user = eregi_replace(' ','+',$user);
|
||||
$pass = eregi_replace(' ','+',$pass);
|
||||
$campaign = eregi_replace(' ','+',$campaign);
|
||||
$phone_login = eregi_replace(' ','+',$phone_login);
|
||||
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
|
||||
$phone_pass = eregi_replace(' ','+',$phone_pass);
|
||||
$fronter = eregi_replace(' ','+',$fronter);
|
||||
$closer = eregi_replace(' ','+',$closer);
|
||||
$group = eregi_replace(' ','+',$group);
|
||||
$channel_group = eregi_replace(' ','+',$channel_group);
|
||||
$SQLdate = eregi_replace(' ','+',$SQLdate);
|
||||
$epoch = eregi_replace(' ','+',$epoch);
|
||||
$uniqueid = eregi_replace(' ','+',$uniqueid);
|
||||
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
|
||||
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
|
||||
$server_ip = eregi_replace(' ','+',$server_ip);
|
||||
$SIPexten = eregi_replace(' ','+',$SIPexten);
|
||||
$session_id = eregi_replace(' ','+',$session_id);
|
||||
$phone = eregi_replace(' ','+',$phone);
|
||||
$parked_by = eregi_replace(' ','+',$parked_by);
|
||||
$dispo = eregi_replace(' ','+',$dispo);
|
||||
$dialed_number = eregi_replace(' ','+',$dialed_number);
|
||||
$dialed_label = eregi_replace(' ','+',$dialed_label);
|
||||
$source_id = eregi_replace(' ','+',$source_id);
|
||||
$rank = eregi_replace(' ','+',$rank);
|
||||
$owner = eregi_replace(' ','+',$owner);
|
||||
$camp_script = eregi_replace(' ','+',$camp_script);
|
||||
$in_script = eregi_replace(' ','+',$in_script);
|
||||
$script_width = eregi_replace(' ','+',$script_width);
|
||||
$script_height = eregi_replace(' ','+',$script_height);
|
||||
$fullname = eregi_replace(' ','+',$fullname);
|
||||
$recording_filename = eregi_replace(' ','+',$recording_filename);
|
||||
$recording_id = eregi_replace(' ','+',$recording_id);
|
||||
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
|
||||
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
|
||||
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
|
||||
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
|
||||
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
|
||||
}
|
||||
|
||||
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
|
||||
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
|
||||
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
|
||||
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
|
||||
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
|
||||
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
|
||||
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
|
||||
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
|
||||
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
|
||||
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
|
||||
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
|
||||
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
|
||||
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
|
||||
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
|
||||
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
|
||||
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
|
||||
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
|
||||
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
|
||||
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
|
||||
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
|
||||
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
|
||||
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
|
||||
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
|
||||
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
|
||||
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
|
||||
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
|
||||
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
|
||||
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
|
||||
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
|
||||
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
|
||||
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
|
||||
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
|
||||
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
|
||||
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
|
||||
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
|
||||
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
|
||||
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
|
||||
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
|
||||
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
|
||||
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
|
||||
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
|
||||
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
|
||||
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
|
||||
$script_text = eregi_replace("\n","<BR>",$script_text);
|
||||
$script_text = stripslashes($script_text);
|
||||
|
||||
|
||||
echo "<!-- IFRAME$IFRAME -->\n";
|
||||
echo "<!-- $script_id -->\n";
|
||||
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
|
||||
echo "<center><B>$script_name</B><BR></center>\n";
|
||||
echo "$script_text\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "</div>";}
|
||||
echo "</TD></TR></TABLE>\n";
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
# voicemail_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1204 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60619-1204';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Unzulässig Benutzername/Passwort: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Unzulässig server_ip: |$server_ip| or Unzulässig session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Unzulässig session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Voicemail Check";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Voicemailbox $vmail_box ist unzulässig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- Scriptlaufzeit: $RUNtimeSekunden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
# active_list_refresh.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to serve updates of the live data to the display scripts
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ADD - ('1','2','3','4','5')
|
||||
# - $order - ('asc','desc')
|
||||
# - $format - ('text','table','menu','selectlist','textarea')
|
||||
# - $bgcolor - ('#123456','white','black','etc...')
|
||||
# - $txtcolor - ('#654321','black','white','etc...')
|
||||
# - $txtsize - ('1','2','3','etc...')
|
||||
# - $selectsize - ('2','3','4','etc...')
|
||||
# - $selectfontsize - ('8','10','12','etc...')
|
||||
# - $selectedext - ('cc100')
|
||||
# - $selectedtrunk - ('Zap/25-1')
|
||||
# - $selectedlocal - ('SIP/cc100')
|
||||
# - $textareaheight - ('8','10','12','etc...')
|
||||
# - $textareawidth - ('8','10','12','etc...')
|
||||
# - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1118 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$ADD=ereg_replace("[^0-9]","",$ADD);
|
||||
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
|
||||
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
|
||||
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
|
||||
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
|
||||
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
|
||||
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
|
||||
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
|
||||
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
|
||||
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
|
||||
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
|
||||
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
|
||||
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
|
||||
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1118';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Ακυρο session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Κατάλογος Οθόνης: ";
|
||||
if ($ADD==1) {echo "Ενεργές τηλ. συνδέσεις";}
|
||||
if ($ADD==2) {echo "Απασχολημένες τηλ. συνδέσεις";}
|
||||
if ($ADD==3) {echo "Εξωτερικές γραμμές";}
|
||||
if ($ADD==4) {echo "Τοπικές τηλ. συνδέσεις";}
|
||||
if ($ADD==5) {echo "Διασκέψεις";}
|
||||
if ($ADD==99999) {echo "ΒΟΗΘΕΙΑ";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- χρόνος εκτέλεσης: $RUNtimeδευτερόλεπτα -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
# call_log_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
# - $in_limit - ('10','20','50','100',...)
|
||||
# - $out_limit - ('10','20','50','100',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1202 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1202';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Ακυρο session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Έμφάνιση Καταγραμμένων Κλήσεων";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten δεν ισχύει ή πρωτόκολλο $protocol δεν ισχύει\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- χρόνος εκτέλεσης: $RUNtimeδευτερόλεπτα -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1201 - Added variable filters to close security holes for login form
|
||||
# 61128-2255 - Added update for manual dial vicidial_live_agents
|
||||
# 70319-1542 - Added agent disabled display function
|
||||
# 71122-0205 - Added vicidial_live_agent status output
|
||||
# 80424-0442 - Added non_latin lookup from system_settings
|
||||
# 80519-1425 - Added calls-in-queue tally
|
||||
# 80703-1106 - Added API functionality for Hangup and Dispo
|
||||
# 81104-0229 - Added mysql error logging capability
|
||||
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
|
||||
# 90102-1402 - Added check for system and database time synchronization
|
||||
# 90120-1720 - Added compatibility for API pause/resume and dial a number
|
||||
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
|
||||
# 90408-0020 - Added API vtiger specific callback activity record ability
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
|
||||
# 90908-1037 - Added DEAD call logging
|
||||
# 91130-2022 - Added code for manager override of in-group selection
|
||||
# 91228-1341 - Added API fields update functions
|
||||
#
|
||||
|
||||
$version = '2.2.0-24';
|
||||
$build = '91228-1341';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=17;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Ακυρο session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Ελεγχος τηλ.σύνδεσης διάσκεψης";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten δεν ισχύει\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
$Acount=0;
|
||||
$AexternalDEAD=0;
|
||||
$Aagent_log_id='';
|
||||
$Acallerid='';
|
||||
$DEADcustomer=0;
|
||||
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
$Acampaign_id = $row[3];
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
|
||||
##### BEGIN DEAD logging section #####
|
||||
### find whether the call the agent is στο is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
|
||||
{
|
||||
$DEADcustomer++;
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
{
|
||||
$NEWdead_epoch = date("U");
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
##### END DEAD logging section #####
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Ζητεί, στο Queue: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Ζητεί, στο Queue: $RingCalls</font>";}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
$external_dial = $row[3];
|
||||
$external_update_fields = $row[4];
|
||||
$external_update_fields_data = $row[5];
|
||||
$timer_action = $row[6];
|
||||
$timer_action_message = $row[7];
|
||||
$timer_action_seconds = $row[8];
|
||||
|
||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
$web_diff = ($db_epoch - $web_epoch);
|
||||
|
||||
##### check for in-group change details
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
$outbound_autodial = $row[3];
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
$NEWoutbound_autodial='N';
|
||||
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
|
||||
{$NEWoutbound_autodial='Y';}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
|
||||
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
|
||||
|
||||
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
|
||||
$Ashift_logout=0;
|
||||
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|ΕΝΑΡΞΗ",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
|
||||
{
|
||||
$shift_ok=0;
|
||||
if (strlen($LOGgroup_shiftsSQL) < 3)
|
||||
{$Ashift_logout++;}
|
||||
else
|
||||
{
|
||||
$HHMM = date("Hi");
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
$shift_weekdays = $rowx[3];
|
||||
|
||||
if (eregi("$wday",$shift_weekdays))
|
||||
{
|
||||
$HHshift_length = substr($shift_length,0,2);
|
||||
$MMshift_length = substr($shift_length,3,2);
|
||||
$HHshift_start_time = substr($shift_start_time,0,2);
|
||||
$MMshift_start_time = substr($shift_start_time,2,2);
|
||||
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
|
||||
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
|
||||
if ($MMshift_end_time > 59)
|
||||
{
|
||||
$MMshift_end_time = ($MMshift_end_time - 60);
|
||||
$HHshift_end_time++;
|
||||
}
|
||||
if ($HHshift_end_time > 23)
|
||||
{$HHshift_end_time = ($HHshift_end_time - 24);}
|
||||
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
|
||||
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
|
||||
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
|
||||
|
||||
if (
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
|
||||
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
|
||||
)
|
||||
{$shift_ok++;}
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($shift_ok < 1)
|
||||
{$Ashift_logout++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
|
||||
{$Alogin='TIME_SYNC';}
|
||||
if ($Acount < 1)
|
||||
{$Alogin='DEAD_VLA';}
|
||||
if ($AexternalDEAD > 0)
|
||||
{$Alogin='DEAD_EXTERNAL';}
|
||||
if ($Ashift_logout > 0)
|
||||
{$Alogin='SHIFT_ΑΠΟΣΥΝΔΕΣΗ';}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Κατάσταση: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ΚανάλιA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ΚανάλιA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$ΚανάλιA[$counter] ~";
|
||||
# echo "$ΚανάλιA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten δεν ισχύει or Exten $exten δεν ισχύει\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
echo "Διάσκεψη $conf_exten έχει καταχωρηθεί $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- χρόνος εκτέλεσης: $RUNtimeδευτερόλεπτα -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
##### MySQL Error Logging #####
|
||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||
{
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
}
|
||||
$one_mysql_log=0;
|
||||
return $errno;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect.php version 2.2.0
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (ereg("^PATHlogs", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (ereg("^PATHweb", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (ereg("^VARDB_server", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (ereg("^VARDB_database", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (ereg("^VARDB_user", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (ereg("^VARDB_pass", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (ereg("^VARDB_port", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
|
||||
if (!$link) {
|
||||
die('MySQL connect ERROR: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db("$VARDB_database",$link);
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to open up when a live_inbound call comes in giving the user
|
||||
# options of what to do with the call or options to lookup the callerID on various web sites
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $uniqueid - ('1234567890.123456',...)
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $voicemail_dump_exten - ('85026666666666')
|
||||
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.6';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Ακυρο session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<?php echo $server_ip ?>';
|
||||
var epoch_sec = '<?php echo $StarTtime ?>';
|
||||
var user_abb = '<?php echo $user_abb ?>';
|
||||
var vmail_box = '<?php echo $vmail_box ?>';
|
||||
var ext_context = '<?php echo $ext_context ?>';
|
||||
var ext_priority = '<?php echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<?php echo $session_name ?>';
|
||||
var user = '<?php echo $user ?>';
|
||||
var pass = '<?php echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30δευτερόλεπτα
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<title>ΕΝΕΡΓΗ ΕΙΣΕΡΧΟΜΕΝΗ ΚΛΗΣΗ";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>ΕΝΕΡΓΗ ΕΙΣΕΡΧΟΜΕΝΗ ΚΛΗΣΗ</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid δεν ισχύει\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Κανάλι: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>CallerID: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Τηλ?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Τηλ?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Τηλ?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Κανάλι=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">ΣΥΝΗΘΕΙΑ</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Αριθμός που καλέσατε: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Σημειώσεις:</td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">ΚΛΕΙΣΙΜΟ</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">ΣΤΕΙΛΕ ΣΤΟ ΦΩΝΗΤΙΚΟ ΤΑΧΥΔΡΟΜΕΙΟ ΜΟΥ</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- χρόνος εκτέλεσης: $RUNtimeδευτερόλεπτα -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
# live_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1203 - Added variable filters to close security holes for login form
|
||||
# 60825-1029 - Fixed translation variable issue ChannelA
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '2.0.1';
|
||||
$build = '60825-1029';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Ακυρο session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Ελεγχος ενεργής τηλ.σύνδεσης";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten δεν ισχύει ή πρωτόκολλο $protocol δεν ισχύει\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ΚανάλιA: $ChanneLA[$counter] ~";
|
||||
echo "ΚανάλιB: $ChanneLB[$counter] ~";
|
||||
echo "ΚανάλιBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ΚανάλιA: $ChanneLA[$counter] ~";
|
||||
echo "ΚανάλιB: $ChanneLB[$counter] ~";
|
||||
echo "ΚανάλιBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ΚανάλιA: $ChanneLA[$counter] ~";
|
||||
echo "ΚανάλιB: $ChanneLB[$counter] ~";
|
||||
echo "ΚανάλιBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ΚανάλιA: $ChanneLA[$counter] ~";
|
||||
echo "ΚανάλιB: $ChanneLB[$counter] ~";
|
||||
echo "ΚανάλιBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "ΚανάλιA: $ChanneLA[$counter] ~";
|
||||
echo "ΚανάλιB: $ChanneLB[$counter] ~";
|
||||
echo "ΚανάλιBtrunk: $ChanneLA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- χρόνος εκτέλεσης: $RUNtimeδευτερόλεπτα -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the details on the parked calls on the server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Ακυρο session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Εμφάνιση Σταθμευμένων Κλήσεων";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten δεν ισχύει ή πρωτόκολλο $protocol δεν ισχύει\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- χρόνος εκτέλεσης: $RUNtimeδευτερόλεπτα -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
# timeclock.php - VICIDIAL system user timeclock
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 80523-0134 - First Build
|
||||
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
|
||||
# 80525-2351 - Added an audit log that is not to be editable
|
||||
# 80602-0641 - Fixed status update bug
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
$version = '2.2.0-5';
|
||||
$build = '90508-0727';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$last_action_date = $NOW_TIME;
|
||||
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
|
||||
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
|
||||
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
|
||||
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
|
||||
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
|
||||
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
|
||||
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
|
||||
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
|
||||
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
|
||||
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
|
||||
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
|
||||
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
|
||||
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
|
||||
if (!isset($phone_login))
|
||||
{
|
||||
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
|
||||
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
|
||||
}
|
||||
if (!isset($phone_pass))
|
||||
{
|
||||
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
|
||||
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=ereg_replace("[^0-9a-z]","",$DB);
|
||||
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
|
||||
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
|
||||
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
|
||||
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
|
||||
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
|
||||
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
|
||||
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
{
|
||||
### see if user/pass exist for this user in vicidial_users table
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$valid_user=$row[0];
|
||||
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
|
||||
|
||||
if ($valid_user < 1)
|
||||
{
|
||||
### NOT A VALID USER/PASS
|
||||
$VDdisplayMESSAGE = "Ο χρήστη και τον κωδικό πρόσβασης που πληκτρολογήσατε δεν είναι ενεργό στο σύστημα<BR>Παρακαλώ δοκιμάστε ξανά:";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Σύνδεση χρήστη: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Κωδικός πρόσβασης χρήστη: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ΥΠΟΒΑΛΕΤΕ VALUE=ΥΠΟΒΑΛΕΤΕ> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
### VALID USER/PASS, CONTINUE
|
||||
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
|
||||
if ($vts_count > 0)
|
||||
{
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
$last_action_sec = ($StarTtimE - $event_epoch);
|
||||
if ($last_action_sec > 0)
|
||||
{
|
||||
$totTIME_H = ($last_action_sec / 3600);
|
||||
$totTIME_H_int = round($totTIME_H, 2);
|
||||
$totTIME_H_int = intval("$totTIME_H");
|
||||
$totTIME_M = ($totTIME_H - $totTIME_H_int);
|
||||
$totTIME_M = ($totTIME_M * 60);
|
||||
$totTIME_M_int = round($totTIME_M, 2);
|
||||
$totTIME_M_int = intval("$totTIME_M");
|
||||
$totTIME_S = ($totTIME_M - $totTIME_M_int);
|
||||
$totTIME_S = ($totTIME_S * 60);
|
||||
$totTIME_S = round($totTIME_S, 0);
|
||||
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
|
||||
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
|
||||
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
|
||||
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
|
||||
}
|
||||
else
|
||||
{
|
||||
$totTIME_HMS='0:00:00';
|
||||
}
|
||||
|
||||
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='ΕΝΑΡΞΗ', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$status='ΕΝΑΡΞΗ';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- ΝΕΟ vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'ΕΝΑΡΞΗ') )
|
||||
{
|
||||
### You cannot log in or out within 30δευτερόλεπτα of your last login/logout
|
||||
$VDdisplayMESSAGE = "Δεν μπορείτε να συνδεθείτε ή να αναφέρονται μέσα σε 30 δευτερόλεπτα από την τελευταία σας login ή logout";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Σύνδεση χρήστη: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Κωδικός πρόσβασης χρήστη: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ΥΠΟΒΑΛΕΤΕ VALUE=ΥΠΟΒΑΛΕΤΕ> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($commit == 'YES')
|
||||
{
|
||||
if ( ( ($status=='AUTOΑΠΟΣΥΝΔΕΣΗ') or ($status=='ΕΝΑΡΞΗ') or ($status=='ΑΠΟΣΥΝΔΕΣΗ') ) and ($stage=='login') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "You have now logged-in";
|
||||
$LOGtimeMESSAGE = "You logged in at $NOW_TIME";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- ΝΕΟ vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- ΝΕΟ vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ($status=='LOGIN') and ($stage=='logout') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Έχετε πλέον συνδεθεί-out";
|
||||
$LOGtimeMESSAGE = "Έχετε αποσυνδεθεί από την$NOW_TIME<BR>Ποσό φορά που ήταν συνδεδεμένος στο:$totTIME_HMS";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='ΑΠΟΣΥΝΔΕΣΗ', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- ΝΕΟ vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='ΑΠΟΣΥΝΔΕΣΗ', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='ΑΠΟΣΥΝΔΕΣΗ', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- ΝΕΟ vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ( ( ($status=='AUTOΑΠΟΣΥΝΔΕΣΗ') or ($status=='ΕΝΑΡΞΗ') or ($status=='ΑΠΟΣΥΝΔΕΣΗ') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
|
||||
{echo "ERROR: timeclock καταχώρηση αρχείου καταγραφής που έχουν ήδη πραγματοποιηθεί:$status|$stage"; exit;}
|
||||
|
||||
if ($referrer=='agent')
|
||||
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">ΕΠΙΣΤΡΟΦΗ στο γραφείο Σύνδεση οθόνης</font></A>";}
|
||||
if ($referrer=='admin')
|
||||
{$BACKlink = "<A HREF=\"../vicidial/admin.php\"><font color=\"#003333\">ΕΠΙΣΤΡΟΦΗ στην Διοίκηση</font></A>";}
|
||||
if ($referrer=='welcome')
|
||||
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">ΕΠΙΣΤΡΟΦΗ στην οθόνη υποδοχής</font></A>";}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ($status=='AUTOΑΠΟΣΥΝΔΕΣΗ') or ($status=='ΕΝΑΡΞΗ') or ($status=='ΑΠΟΣΥΝΔΕΣΗ') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Ο χρόνος από την τελευταία φορά που είναι συνδεδεμένος στο:$totTIME_HMS";
|
||||
$log_action = 'login';
|
||||
$button_name = 'LOGIN';
|
||||
$LOGtimeMESSAGE = "Μπορείτε τελευταίου συνδεδεμένου αναφέρονται σε:$last_action_date<BR><BR>Κάντε κλικ παρακάτω για να ΕΙΣΟΔΟΣ log-in";
|
||||
}
|
||||
if ($status=='LOGIN')
|
||||
{
|
||||
$VDdisplayMESSAGE = "Χρονικό διάστημα σας έχει συνδεθεί σε:$totTIME_HMS";
|
||||
$log_action = 'logout';
|
||||
$button_name = 'ΑΠΟΣΥΝΔΕΣΗ';
|
||||
$LOGtimeMESSAGE = "Μπορείτε συνδεδεμένος στην διεύθυνση: $last_action_date<BR>Χρονικό διάστημα σας έχει συνδεθεί σε:$totTIME_HMS<BR><BR>Κάντε κλικ παρακάτω για να ΑΠΟΣΥΝΔΕΣΗ log-out";
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Σύνδεση χρήστη: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Κωδικός πρόσβασης χρήστη: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ΥΠΟΒΑΛΕΤΕ VALUE=ΥΠΟΒΑΛΕΤΕ> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
# vdc_script_display.php
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed display the contents of the SCRIPT tab in the agent interface
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90824-1435 - First build of script
|
||||
# 90827-1548 - Added list override script option
|
||||
# 91204-1913 - Added recording_filename and recording_id variables
|
||||
# 91211-1103 - Added user_custom_... variables
|
||||
#
|
||||
|
||||
$version = '2.2.0-4';
|
||||
$build = '91211-1103';
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
$vendor_lead_code = $vendor_id;
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
|
||||
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["title"])) {$title=$_GET["title"];}
|
||||
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
|
||||
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
|
||||
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
|
||||
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
|
||||
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
|
||||
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
|
||||
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
|
||||
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
|
||||
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
|
||||
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
|
||||
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
|
||||
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
|
||||
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
|
||||
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
|
||||
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
|
||||
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
|
||||
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
|
||||
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
|
||||
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
|
||||
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
|
||||
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
|
||||
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
|
||||
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
|
||||
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
|
||||
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
|
||||
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
|
||||
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
|
||||
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
|
||||
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
|
||||
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
|
||||
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
|
||||
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
|
||||
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
|
||||
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
|
||||
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
|
||||
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
|
||||
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
|
||||
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
|
||||
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
|
||||
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
|
||||
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
|
||||
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
|
||||
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
|
||||
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
|
||||
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
|
||||
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
|
||||
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
|
||||
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
|
||||
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
|
||||
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
|
||||
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
|
||||
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
|
||||
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
|
||||
|
||||
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
|
||||
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
|
||||
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
|
||||
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
$txt = '.txt';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$CIDdate = date("mdHis");
|
||||
$ENTRYdate = date("YmdHis");
|
||||
$MT[0]='';
|
||||
$agents='@agents';
|
||||
|
||||
$IFRAME=0;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
|
||||
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
|
||||
$phone_code = ereg_replace("[^0-9]","",$phone_code);
|
||||
$phone_number = ereg_replace("[^0-9]","",$phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = ereg_replace("'|\"|\\\\|;","",$user);
|
||||
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
|
||||
}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if ($format == 'debug') {$DB=1;}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalid Username/Password: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
|
||||
echo "<title>VICIDiaL Script Display Script";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if (strlen($in_script) < 1)
|
||||
{$call_script = $camp_script;}
|
||||
else
|
||||
{$call_script = $in_script;}
|
||||
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
if (eregi("iframe src",$script_text))
|
||||
{
|
||||
$IFRAME=1;
|
||||
$lead_id = eregi_replace(' ','+',$lead_id);
|
||||
$vendor_id = eregi_replace(' ','+',$vendor_id);
|
||||
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
|
||||
$list_id = eregi_replace(' ','+',$list_id);
|
||||
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
|
||||
$phone_code = eregi_replace(' ','+',$phone_code);
|
||||
$phone_number = eregi_replace(' ','+',$phone_number);
|
||||
$title = eregi_replace(' ','+',$title);
|
||||
$first_name = eregi_replace(' ','+',$first_name);
|
||||
$middle_initial = eregi_replace(' ','+',$middle_initial);
|
||||
$last_name = eregi_replace(' ','+',$last_name);
|
||||
$address1 = eregi_replace(' ','+',$address1);
|
||||
$address2 = eregi_replace(' ','+',$address2);
|
||||
$address3 = eregi_replace(' ','+',$address3);
|
||||
$city = eregi_replace(' ','+',$city);
|
||||
$state = eregi_replace(' ','+',$state);
|
||||
$province = eregi_replace(' ','+',$province);
|
||||
$postal_code = eregi_replace(' ','+',$postal_code);
|
||||
$country_code = eregi_replace(' ','+',$country_code);
|
||||
$gender = eregi_replace(' ','+',$gender);
|
||||
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
|
||||
$alt_phone = eregi_replace(' ','+',$alt_phone);
|
||||
$email = eregi_replace(' ','+',$email);
|
||||
$security_phrase = eregi_replace(' ','+',$security_phrase);
|
||||
$comments = eregi_replace(' ','+',$comments);
|
||||
$user = eregi_replace(' ','+',$user);
|
||||
$pass = eregi_replace(' ','+',$pass);
|
||||
$campaign = eregi_replace(' ','+',$campaign);
|
||||
$phone_login = eregi_replace(' ','+',$phone_login);
|
||||
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
|
||||
$phone_pass = eregi_replace(' ','+',$phone_pass);
|
||||
$fronter = eregi_replace(' ','+',$fronter);
|
||||
$closer = eregi_replace(' ','+',$closer);
|
||||
$group = eregi_replace(' ','+',$group);
|
||||
$channel_group = eregi_replace(' ','+',$channel_group);
|
||||
$SQLdate = eregi_replace(' ','+',$SQLdate);
|
||||
$epoch = eregi_replace(' ','+',$epoch);
|
||||
$uniqueid = eregi_replace(' ','+',$uniqueid);
|
||||
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
|
||||
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
|
||||
$server_ip = eregi_replace(' ','+',$server_ip);
|
||||
$SIPexten = eregi_replace(' ','+',$SIPexten);
|
||||
$session_id = eregi_replace(' ','+',$session_id);
|
||||
$phone = eregi_replace(' ','+',$phone);
|
||||
$parked_by = eregi_replace(' ','+',$parked_by);
|
||||
$dispo = eregi_replace(' ','+',$dispo);
|
||||
$dialed_number = eregi_replace(' ','+',$dialed_number);
|
||||
$dialed_label = eregi_replace(' ','+',$dialed_label);
|
||||
$source_id = eregi_replace(' ','+',$source_id);
|
||||
$rank = eregi_replace(' ','+',$rank);
|
||||
$owner = eregi_replace(' ','+',$owner);
|
||||
$camp_script = eregi_replace(' ','+',$camp_script);
|
||||
$in_script = eregi_replace(' ','+',$in_script);
|
||||
$script_width = eregi_replace(' ','+',$script_width);
|
||||
$script_height = eregi_replace(' ','+',$script_height);
|
||||
$fullname = eregi_replace(' ','+',$fullname);
|
||||
$recording_filename = eregi_replace(' ','+',$recording_filename);
|
||||
$recording_id = eregi_replace(' ','+',$recording_id);
|
||||
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
|
||||
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
|
||||
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
|
||||
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
|
||||
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
|
||||
}
|
||||
|
||||
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
|
||||
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
|
||||
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
|
||||
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
|
||||
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
|
||||
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
|
||||
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
|
||||
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
|
||||
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
|
||||
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
|
||||
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
|
||||
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
|
||||
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
|
||||
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
|
||||
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
|
||||
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
|
||||
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
|
||||
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
|
||||
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
|
||||
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
|
||||
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
|
||||
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
|
||||
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
|
||||
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
|
||||
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
|
||||
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
|
||||
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
|
||||
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
|
||||
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
|
||||
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
|
||||
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
|
||||
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
|
||||
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
|
||||
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
|
||||
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
|
||||
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
|
||||
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
|
||||
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
|
||||
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
|
||||
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
|
||||
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
|
||||
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
|
||||
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
|
||||
$script_text = eregi_replace("\n","<BR>",$script_text);
|
||||
$script_text = stripslashes($script_text);
|
||||
|
||||
|
||||
echo "<!-- IFRAME$IFRAME -->\n";
|
||||
echo "<!-- $script_id -->\n";
|
||||
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
|
||||
echo "<center><B>$script_name</B><BR></center>\n";
|
||||
echo "$script_text\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "</div>";}
|
||||
echo "</TD></TR></TABLE>\n";
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
# voicemail_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1204 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60619-1204';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Ακυρο Όνομα χρήστη/Κωδικός πρόσβασης: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Ακυρο server_ip: |$server_ip| or Ακυρο session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Ακυρο session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- ΕΚΔΟΣΗ: $version ΔΗΜΙΟΥΡΓΙΑ: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Έλεγχος φωνητικού ταχυδρομείου";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Κουτί φωνητικού ταχυδρομείου $vmail_box δεν ισχύει\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- χρόνος εκτέλεσης: $RUNtimeδευτερόλεπτα -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('agc_en/vicidial.php','agc',$agcPAGE);
|
||||
|
||||
header("Location: $agcDIR/vicidial.php");
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n";
|
||||
echo"<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=$agcDIR/vicidial.php\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo"<BODY BGCOLOR=#FFFFFF marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
echo"<a href=\"$agcDIR/vicidial.php\">click here to continue. . .</a>\n";
|
||||
echo"</BODY></HTML>\n";
|
||||
|
||||
exit;
|
||||
?>
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
# active_list_refresh.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to serve updates of the live data to the display scripts
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ADD - ('1','2','3','4','5')
|
||||
# - $order - ('asc','desc')
|
||||
# - $format - ('text','table','menu','selectlist','textarea')
|
||||
# - $bgcolor - ('#123456','white','black','etc...')
|
||||
# - $txtcolor - ('#654321','black','white','etc...')
|
||||
# - $txtsize - ('1','2','3','etc...')
|
||||
# - $selectsize - ('2','3','4','etc...')
|
||||
# - $selectfontsize - ('8','10','12','etc...')
|
||||
# - $selectedext - ('cc100')
|
||||
# - $selectedtrunk - ('Zap/25-1')
|
||||
# - $selectedlocal - ('SIP/cc100')
|
||||
# - $textareaheight - ('8','10','12','etc...')
|
||||
# - $textareawidth - ('8','10','12','etc...')
|
||||
# - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1118 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$ADD=ereg_replace("[^0-9]","",$ADD);
|
||||
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
|
||||
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
|
||||
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
|
||||
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
|
||||
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
|
||||
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
|
||||
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
|
||||
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
|
||||
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
|
||||
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
|
||||
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
|
||||
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
|
||||
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1118';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Nombre del usuario/Contraseña: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIÓN: $version CONSTRUCCION: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Mostrar Listas: ";
|
||||
if ($ADD==1) {echo "Extensiones Activas";}
|
||||
if ($ADD==2) {echo "Extensiones Ocupadas";}
|
||||
if ($ADD==3) {echo "Líneas de salida";}
|
||||
if ($ADD==4) {echo "Extensiones Locales";}
|
||||
if ($ADD==5) {echo "Conferencias";}
|
||||
if ($ADD==99999) {echo "AYUDA";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- tiempo de ejecución del Script: $RUNtimesegundos -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
# call_log_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
# - $in_limit - ('10','20','50','100',...)
|
||||
# - $out_limit - ('10','20','50','100',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1202 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1202';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Nombre del usuario/Contraseña: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIÓN: $version CONSTRUCCION: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Motrar el registro de llamadas";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten No es válido o protocolo $protocol No es válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tiempo de ejecución del Script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1201 - Added variable filters to close security holes for login form
|
||||
# 61128-2255 - Added update for manual dial vicidial_live_agents
|
||||
# 70319-1542 - Added agent disabled display function
|
||||
# 71122-0205 - Added vicidial_live_agent status output
|
||||
# 80424-0442 - Added non_latin lookup from system_settings
|
||||
# 80519-1425 - Added calls-in-queue tally
|
||||
# 80703-1106 - Added API functionality for Hangup and Dispo
|
||||
# 81104-0229 - Added mysql error logging capability
|
||||
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
|
||||
# 90102-1402 - Added check for system and database time synchronization
|
||||
# 90120-1720 - Added compatibility for API pause/resume and dial a number
|
||||
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
|
||||
# 90408-0020 - Added API vtiger specific callback activity record ability
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
|
||||
# 90908-1037 - Added DEAD call logging
|
||||
# 91130-2022 - Added code for manager override of in-group selection
|
||||
# 91228-1341 - Added API fields update functions
|
||||
#
|
||||
|
||||
$version = '2.2.0-24';
|
||||
$build = '91228-1341';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=17;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Nombre del usuario/Contraseña: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIÓN: $version CONSTRUCCION: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Comprobar la Extensión de Conf";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten No es válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
$Acount=0;
|
||||
$AexternalDEAD=0;
|
||||
$Aagent_log_id='';
|
||||
$Acallerid='';
|
||||
$DEADcustomer=0;
|
||||
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
$Acampaign_id = $row[3];
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
|
||||
##### BEGIN DEAD logging section #####
|
||||
### find whether the call the agent is en is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
|
||||
{
|
||||
$DEADcustomer++;
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
{
|
||||
$NEWdead_epoch = date("U");
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
##### END DEAD logging section #####
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Pide, en la cola: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Pide, en la cola: $RingCalls</font>";}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
$external_dial = $row[3];
|
||||
$external_update_fields = $row[4];
|
||||
$external_update_fields_data = $row[5];
|
||||
$timer_action = $row[6];
|
||||
$timer_action_message = $row[7];
|
||||
$timer_action_seconds = $row[8];
|
||||
|
||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
$web_diff = ($db_epoch - $web_epoch);
|
||||
|
||||
##### check for in-group change details
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
$outbound_autodial = $row[3];
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
$NEWoutbound_autodial='N';
|
||||
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
|
||||
{$NEWoutbound_autodial='Y';}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
|
||||
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
|
||||
|
||||
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
|
||||
$Ashift_logout=0;
|
||||
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|COMIENZO",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
|
||||
{
|
||||
$shift_ok=0;
|
||||
if (strlen($LOGgroup_shiftsSQL) < 3)
|
||||
{$Ashift_logout++;}
|
||||
else
|
||||
{
|
||||
$HHMM = date("Hi");
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
$shift_weekdays = $rowx[3];
|
||||
|
||||
if (eregi("$wday",$shift_weekdays))
|
||||
{
|
||||
$HHshift_length = substr($shift_length,0,2);
|
||||
$MMshift_length = substr($shift_length,3,2);
|
||||
$HHshift_start_time = substr($shift_start_time,0,2);
|
||||
$MMshift_start_time = substr($shift_start_time,2,2);
|
||||
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
|
||||
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
|
||||
if ($MMshift_end_time > 59)
|
||||
{
|
||||
$MMshift_end_time = ($MMshift_end_time - 60);
|
||||
$HHshift_end_time++;
|
||||
}
|
||||
if ($HHshift_end_time > 23)
|
||||
{$HHshift_end_time = ($HHshift_end_time - 24);}
|
||||
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
|
||||
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
|
||||
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
|
||||
|
||||
if (
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
|
||||
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
|
||||
)
|
||||
{$shift_ok++;}
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($shift_ok < 1)
|
||||
{$Ashift_logout++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
|
||||
{$Alogin='TIME_SYNC';}
|
||||
if ($Acount < 1)
|
||||
{$Alogin='DEAD_VLA';}
|
||||
if ($AexternalDEAD > 0)
|
||||
{$Alogin='DEAD_EXTERNAL';}
|
||||
if ($Ashift_logout > 0)
|
||||
{$Alogin='SHIFT_SALIR';}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Estado: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$CanalA[$counter] ~";
|
||||
# echo "$CanalA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten No es válido or Exten $exten No es válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
echo "Conferencia $conf_exten Ha sido registrado para $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tiempo de ejecución del Script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
##### MySQL Error Logging #####
|
||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||
{
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
}
|
||||
$one_mysql_log=0;
|
||||
return $errno;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect.php version 2.2.0
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (ereg("^PATHlogs", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (ereg("^PATHweb", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (ereg("^VARDB_server", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (ereg("^VARDB_database", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (ereg("^VARDB_user", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (ereg("^VARDB_pass", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (ereg("^VARDB_port", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
|
||||
if (!$link) {
|
||||
die('MySQL connect ERROR: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db("$VARDB_database",$link);
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to open up when a live_inbound call comes in giving the user
|
||||
# options of what to do with the call or options to lookup the callerID on various web sites
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $uniqueid - ('1234567890.123456',...)
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $voicemail_dump_exten - ('85026666666666')
|
||||
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.6';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Nombre del usuario/Contraseña: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIÓN: $version CONSTRUCCION: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<?php echo $server_ip ?>';
|
||||
var epoch_sec = '<?php echo $StarTtime ?>';
|
||||
var user_abb = '<?php echo $user_abb ?>';
|
||||
var vmail_box = '<?php echo $vmail_box ?>';
|
||||
var ext_context = '<?php echo $ext_context ?>';
|
||||
var ext_priority = '<?php echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<?php echo $session_name ?>';
|
||||
var user = '<?php echo $user ?>';
|
||||
var pass = '<?php echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30segundos
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<title>LLAMADA DE ENTRADA ACTIVA";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>LLAMADA DE ENTRADA ACTIVA</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid No es válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Canal: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>LlamadorID: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Teléfono?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Teléfono?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Teléfono?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Canal=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">A MEDIDA</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Número Marcado: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Notas:</td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">COLGAR</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">ENVIAR A MI BUZÓN DE VOZ</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tiempo de ejecución del Script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
# live_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1203 - Added variable filters to close security holes for login form
|
||||
# 60825-1029 - Fixed translation variable issue ChannelA
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '2.0.1';
|
||||
$build = '60825-1029';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Nombre del usuario/Contraseña: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIÓN: $version CONSTRUCCION: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Comprobar Extensión Activa";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten No es válido o protocolo $protocol No es válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $ChanneLA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tiempo de ejecución del Script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the details on the parked calls on the server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Inválido Nombre del usuario/Contraseña: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIÓN: $version CONSTRUCCION: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Mostrar Llamadas Aparcadas";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten No es válido o protocolo $protocol No es válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tiempo de ejecución del Script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
# timeclock.php - VICIDIAL system user timeclock
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 80523-0134 - First Build
|
||||
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
|
||||
# 80525-2351 - Added an audit log that is not to be editable
|
||||
# 80602-0641 - Fixed status update bug
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
$version = '2.2.0-5';
|
||||
$build = '90508-0727';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$last_action_date = $NOW_TIME;
|
||||
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
|
||||
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
|
||||
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
|
||||
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
|
||||
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
|
||||
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
|
||||
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
|
||||
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
|
||||
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
|
||||
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
|
||||
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
|
||||
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
|
||||
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
|
||||
if (!isset($phone_login))
|
||||
{
|
||||
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
|
||||
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
|
||||
}
|
||||
if (!isset($phone_pass))
|
||||
{
|
||||
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
|
||||
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=ereg_replace("[^0-9a-z]","",$DB);
|
||||
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
|
||||
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
|
||||
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
|
||||
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
|
||||
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
|
||||
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
|
||||
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
{
|
||||
### see if user/pass exist for this user in vicidial_users table
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$valid_user=$row[0];
|
||||
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
|
||||
|
||||
if ($valid_user < 1)
|
||||
{
|
||||
### NOT A VALID USER/PASS
|
||||
$VDdisplayMESSAGE = "El usuario y la contraseña que ha introducido no son activos en el sistema<BR>Por favor, inténtelo de nuevo:";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
### VALID USER/PASS, CONTINUE
|
||||
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
|
||||
if ($vts_count > 0)
|
||||
{
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
$last_action_sec = ($StarTtimE - $event_epoch);
|
||||
if ($last_action_sec > 0)
|
||||
{
|
||||
$totTIME_H = ($last_action_sec / 3600);
|
||||
$totTIME_H_int = round($totTIME_H, 2);
|
||||
$totTIME_H_int = intval("$totTIME_H");
|
||||
$totTIME_M = ($totTIME_H - $totTIME_H_int);
|
||||
$totTIME_M = ($totTIME_M * 60);
|
||||
$totTIME_M_int = round($totTIME_M, 2);
|
||||
$totTIME_M_int = intval("$totTIME_M");
|
||||
$totTIME_S = ($totTIME_M - $totTIME_M_int);
|
||||
$totTIME_S = ($totTIME_S * 60);
|
||||
$totTIME_S = round($totTIME_S, 0);
|
||||
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
|
||||
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
|
||||
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
|
||||
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
|
||||
}
|
||||
else
|
||||
{
|
||||
$totTIME_HMS='0:00:00';
|
||||
}
|
||||
|
||||
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='COMIENZO', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$status='COMIENZO';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NUEVO vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'COMIENZO') )
|
||||
{
|
||||
### You cannot log in or out within 30segundos of your last login/logout
|
||||
$VDdisplayMESSAGE = "No puede iniciar sesión o en un plazo de 30 segundos de su última conexión o desconexión";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($commit == 'YES')
|
||||
{
|
||||
if ( ( ($status=='AUTOSALIR') or ($status=='COMIENZO') or ($status=='SALIR') ) and ($stage=='login') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "You have now logged-in";
|
||||
$LOGtimeMESSAGE = "You logged in at $NOW_TIME";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NUEVO vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NUEVO vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ($status=='LOGIN') and ($stage=='logout') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Ya ha iniciado la sesión en";
|
||||
$LOGtimeMESSAGE = "Que en la sesión$NOW_TIME<BR>Cantidad de tiempo que se han registrado en:$totTIME_HMS";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='SALIR', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NUEVO vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='SALIR', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='SALIR', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NUEVO vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ( ( ($status=='AUTOSALIR') or ($status=='COMIENZO') or ($status=='SALIR') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
|
||||
{echo "ERROR: timeclock entrada de registro ya realizados:$status|$stage"; exit;}
|
||||
|
||||
if ($referrer=='agent')
|
||||
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">VOLVER a la pantalla de Inicio</font></A>";}
|
||||
if ($referrer=='admin')
|
||||
{$BACKlink = "<A HREF=\"../vicidial/admin.php\"><font color=\"#003333\">VOLVER a la Administración</font></A>";}
|
||||
if ($referrer=='welcome')
|
||||
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">VOLVER a la pantalla de bienvenida</font></A>";}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ($status=='AUTOSALIR') or ($status=='COMIENZO') or ($status=='SALIR') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Vez desde que se conectó por última vez en:$totTIME_HMS";
|
||||
$log_action = 'login';
|
||||
$button_name = 'LOGIN';
|
||||
$LOGtimeMESSAGE = "-Usted se conectó por última vez en:$last_action_date<BR><BR>Haga clic en Conectarse a continuación para acceder al sistema";
|
||||
}
|
||||
if ($status=='LOGIN')
|
||||
{
|
||||
$VDdisplayMESSAGE = "Cantidad de tiempo que se han registrado en:$totTIME_HMS";
|
||||
$log_action = 'logout';
|
||||
$button_name = 'SALIR';
|
||||
$LOGtimeMESSAGE = "Iniciado la sesión en que usted en: $last_action_date<BR>Cantidad de tiempo que se han registrado en:$totTIME_HMS<BR><BR>Haga clic a continuación para acceder SALIR-out";
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Conexión Del Usuario: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Contraseña Del Usuario: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=ENVIAR VALUE=ENVIAR> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIÓN: $version CONSTRUCCION: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
# vdc_script_display.php
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed display the contents of the SCRIPT tab in the agent interface
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90824-1435 - First build of script
|
||||
# 90827-1548 - Added list override script option
|
||||
# 91204-1913 - Added recording_filename and recording_id variables
|
||||
# 91211-1103 - Added user_custom_... variables
|
||||
#
|
||||
|
||||
$version = '2.2.0-4';
|
||||
$build = '91211-1103';
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
$vendor_lead_code = $vendor_id;
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
|
||||
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["title"])) {$title=$_GET["title"];}
|
||||
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
|
||||
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
|
||||
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
|
||||
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
|
||||
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
|
||||
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
|
||||
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
|
||||
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
|
||||
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
|
||||
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
|
||||
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
|
||||
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
|
||||
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
|
||||
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
|
||||
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
|
||||
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
|
||||
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
|
||||
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
|
||||
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
|
||||
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
|
||||
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
|
||||
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
|
||||
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
|
||||
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
|
||||
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
|
||||
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
|
||||
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
|
||||
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
|
||||
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
|
||||
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
|
||||
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
|
||||
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
|
||||
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
|
||||
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
|
||||
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
|
||||
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
|
||||
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
|
||||
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
|
||||
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
|
||||
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
|
||||
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
|
||||
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
|
||||
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
|
||||
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
|
||||
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
|
||||
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
|
||||
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
|
||||
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
|
||||
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
|
||||
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
|
||||
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
|
||||
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
|
||||
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
|
||||
|
||||
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
|
||||
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
|
||||
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
|
||||
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
$txt = '.txt';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$CIDdate = date("mdHis");
|
||||
$ENTRYdate = date("YmdHis");
|
||||
$MT[0]='';
|
||||
$agents='@agents';
|
||||
|
||||
$IFRAME=0;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
|
||||
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
|
||||
$phone_code = ereg_replace("[^0-9]","",$phone_code);
|
||||
$phone_number = ereg_replace("[^0-9]","",$phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = ereg_replace("'|\"|\\\\|;","",$user);
|
||||
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
|
||||
}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if ($format == 'debug') {$DB=1;}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalid Username/Password: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
|
||||
echo "<title>VICIDiaL Script Display Script";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if (strlen($in_script) < 1)
|
||||
{$call_script = $camp_script;}
|
||||
else
|
||||
{$call_script = $in_script;}
|
||||
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
if (eregi("iframe src",$script_text))
|
||||
{
|
||||
$IFRAME=1;
|
||||
$lead_id = eregi_replace(' ','+',$lead_id);
|
||||
$vendor_id = eregi_replace(' ','+',$vendor_id);
|
||||
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
|
||||
$list_id = eregi_replace(' ','+',$list_id);
|
||||
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
|
||||
$phone_code = eregi_replace(' ','+',$phone_code);
|
||||
$phone_number = eregi_replace(' ','+',$phone_number);
|
||||
$title = eregi_replace(' ','+',$title);
|
||||
$first_name = eregi_replace(' ','+',$first_name);
|
||||
$middle_initial = eregi_replace(' ','+',$middle_initial);
|
||||
$last_name = eregi_replace(' ','+',$last_name);
|
||||
$address1 = eregi_replace(' ','+',$address1);
|
||||
$address2 = eregi_replace(' ','+',$address2);
|
||||
$address3 = eregi_replace(' ','+',$address3);
|
||||
$city = eregi_replace(' ','+',$city);
|
||||
$state = eregi_replace(' ','+',$state);
|
||||
$province = eregi_replace(' ','+',$province);
|
||||
$postal_code = eregi_replace(' ','+',$postal_code);
|
||||
$country_code = eregi_replace(' ','+',$country_code);
|
||||
$gender = eregi_replace(' ','+',$gender);
|
||||
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
|
||||
$alt_phone = eregi_replace(' ','+',$alt_phone);
|
||||
$email = eregi_replace(' ','+',$email);
|
||||
$security_phrase = eregi_replace(' ','+',$security_phrase);
|
||||
$comments = eregi_replace(' ','+',$comments);
|
||||
$user = eregi_replace(' ','+',$user);
|
||||
$pass = eregi_replace(' ','+',$pass);
|
||||
$campaign = eregi_replace(' ','+',$campaign);
|
||||
$phone_login = eregi_replace(' ','+',$phone_login);
|
||||
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
|
||||
$phone_pass = eregi_replace(' ','+',$phone_pass);
|
||||
$fronter = eregi_replace(' ','+',$fronter);
|
||||
$closer = eregi_replace(' ','+',$closer);
|
||||
$group = eregi_replace(' ','+',$group);
|
||||
$channel_group = eregi_replace(' ','+',$channel_group);
|
||||
$SQLdate = eregi_replace(' ','+',$SQLdate);
|
||||
$epoch = eregi_replace(' ','+',$epoch);
|
||||
$uniqueid = eregi_replace(' ','+',$uniqueid);
|
||||
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
|
||||
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
|
||||
$server_ip = eregi_replace(' ','+',$server_ip);
|
||||
$SIPexten = eregi_replace(' ','+',$SIPexten);
|
||||
$session_id = eregi_replace(' ','+',$session_id);
|
||||
$phone = eregi_replace(' ','+',$phone);
|
||||
$parked_by = eregi_replace(' ','+',$parked_by);
|
||||
$dispo = eregi_replace(' ','+',$dispo);
|
||||
$dialed_number = eregi_replace(' ','+',$dialed_number);
|
||||
$dialed_label = eregi_replace(' ','+',$dialed_label);
|
||||
$source_id = eregi_replace(' ','+',$source_id);
|
||||
$rank = eregi_replace(' ','+',$rank);
|
||||
$owner = eregi_replace(' ','+',$owner);
|
||||
$camp_script = eregi_replace(' ','+',$camp_script);
|
||||
$in_script = eregi_replace(' ','+',$in_script);
|
||||
$script_width = eregi_replace(' ','+',$script_width);
|
||||
$script_height = eregi_replace(' ','+',$script_height);
|
||||
$fullname = eregi_replace(' ','+',$fullname);
|
||||
$recording_filename = eregi_replace(' ','+',$recording_filename);
|
||||
$recording_id = eregi_replace(' ','+',$recording_id);
|
||||
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
|
||||
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
|
||||
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
|
||||
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
|
||||
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
|
||||
}
|
||||
|
||||
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
|
||||
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
|
||||
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
|
||||
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
|
||||
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
|
||||
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
|
||||
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
|
||||
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
|
||||
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
|
||||
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
|
||||
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
|
||||
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
|
||||
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
|
||||
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
|
||||
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
|
||||
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
|
||||
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
|
||||
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
|
||||
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
|
||||
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
|
||||
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
|
||||
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
|
||||
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
|
||||
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
|
||||
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
|
||||
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
|
||||
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
|
||||
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
|
||||
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
|
||||
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
|
||||
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
|
||||
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
|
||||
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
|
||||
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
|
||||
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
|
||||
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
|
||||
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
|
||||
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
|
||||
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
|
||||
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
|
||||
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
|
||||
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
|
||||
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
|
||||
$script_text = eregi_replace("\n","<BR>",$script_text);
|
||||
$script_text = stripslashes($script_text);
|
||||
|
||||
|
||||
echo "<!-- IFRAME$IFRAME -->\n";
|
||||
echo "<!-- $script_id -->\n";
|
||||
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
|
||||
echo "<center><B>$script_name</B><BR></center>\n";
|
||||
echo "$script_text\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "</div>";}
|
||||
echo "</TD></TR></TABLE>\n";
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
# voicemail_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1204 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60619-1204';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Inválido Nombre del usuario/Contraseña: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Inválido server_ip: |$server_ip| or Inválido session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Inválido session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIÓN: $version CONSTRUCCION: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Comprobar el buzón de voz";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "caja del buzón de voz $vmail_box No es válido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- tiempo de ejecución del Script: $RUNtimesegundos -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
# active_list_refresh.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to serve updates of the live data to the display scripts
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ADD - ('1','2','3','4','5')
|
||||
# - $order - ('asc','desc')
|
||||
# - $format - ('text','table','menu','selectlist','textarea')
|
||||
# - $bgcolor - ('#123456','white','black','etc...')
|
||||
# - $txtcolor - ('#654321','black','white','etc...')
|
||||
# - $txtsize - ('1','2','3','etc...')
|
||||
# - $selectsize - ('2','3','4','etc...')
|
||||
# - $selectfontsize - ('8','10','12','etc...')
|
||||
# - $selectedext - ('cc100')
|
||||
# - $selectedtrunk - ('Zap/25-1')
|
||||
# - $selectedlocal - ('SIP/cc100')
|
||||
# - $textareaheight - ('8','10','12','etc...')
|
||||
# - $textareawidth - ('8','10','12','etc...')
|
||||
# - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1118 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$ADD=ereg_replace("[^0-9]","",$ADD);
|
||||
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
|
||||
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
|
||||
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
|
||||
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
|
||||
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
|
||||
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
|
||||
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
|
||||
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
|
||||
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
|
||||
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
|
||||
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
|
||||
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
|
||||
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1118';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Invalide session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Mode Liste: ";
|
||||
if ($ADD==1) {echo "Extensions en cours d'appel";}
|
||||
if ($ADD==2) {echo "Extensions Occupées";}
|
||||
if ($ADD==3) {echo "Lignes Extérieures";}
|
||||
if ($ADD==4) {echo "Extensions Locales";}
|
||||
if ($ADD==5) {echo "Conférences";}
|
||||
if ($ADD==99999) {echo "AIDE";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- durée d'exécution du script: $RUNtimesecondes -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
# call_log_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
# - $in_limit - ('10','20','50','100',...)
|
||||
# - $out_limit - ('10','20','50','100',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1202 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1202';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Invalide session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Affichage de l'historique d'Appel";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten est invalide ou protocole $protocol est invalide\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- durée d'exécution du script: $RUNtimesecondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1201 - Added variable filters to close security holes for login form
|
||||
# 61128-2255 - Added update for manual dial vicidial_live_agents
|
||||
# 70319-1542 - Added agent disabled display function
|
||||
# 71122-0205 - Added vicidial_live_agent status output
|
||||
# 80424-0442 - Added non_latin lookup from system_settings
|
||||
# 80519-1425 - Added calls-in-queue tally
|
||||
# 80703-1106 - Added API functionality for Hangup and Dispo
|
||||
# 81104-0229 - Added mysql error logging capability
|
||||
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
|
||||
# 90102-1402 - Added check for system and database time synchronization
|
||||
# 90120-1720 - Added compatibility for API pause/resume and dial a number
|
||||
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
|
||||
# 90408-0020 - Added API vtiger specific callback activity record ability
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
|
||||
# 90908-1037 - Added DEAD call logging
|
||||
# 91130-2022 - Added code for manager override of in-group selection
|
||||
# 91228-1341 - Added API fields update functions
|
||||
#
|
||||
|
||||
$version = '2.2.0-24';
|
||||
$build = '91228-1341';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=17;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Invalide session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Vérification de l'extension de la Conférence";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten est invalide\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
$Acount=0;
|
||||
$AexternalDEAD=0;
|
||||
$Aagent_log_id='';
|
||||
$Acallerid='';
|
||||
$DEADcustomer=0;
|
||||
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
$Acampaign_id = $row[3];
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
|
||||
##### BEGIN DEAD logging section #####
|
||||
### find whether the call the agent is sur is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
|
||||
{
|
||||
$DEADcustomer++;
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
{
|
||||
$NEWdead_epoch = date("U");
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
##### END DEAD logging section #####
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Appels dans la file d'attente: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Appels dans la file d'attente: $RingCalls</font>";}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
$external_dial = $row[3];
|
||||
$external_update_fields = $row[4];
|
||||
$external_update_fields_data = $row[5];
|
||||
$timer_action = $row[6];
|
||||
$timer_action_message = $row[7];
|
||||
$timer_action_seconds = $row[8];
|
||||
|
||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
$web_diff = ($db_epoch - $web_epoch);
|
||||
|
||||
##### check for in-group change details
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
$outbound_autodial = $row[3];
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
$NEWoutbound_autodial='N';
|
||||
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
|
||||
{$NEWoutbound_autodial='Y';}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
|
||||
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
|
||||
|
||||
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
|
||||
$Ashift_logout=0;
|
||||
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|DEBUT",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
|
||||
{
|
||||
$shift_ok=0;
|
||||
if (strlen($LOGgroup_shiftsSQL) < 3)
|
||||
{$Ashift_logout++;}
|
||||
else
|
||||
{
|
||||
$HHMM = date("Hi");
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
$shift_weekdays = $rowx[3];
|
||||
|
||||
if (eregi("$wday",$shift_weekdays))
|
||||
{
|
||||
$HHshift_length = substr($shift_length,0,2);
|
||||
$MMshift_length = substr($shift_length,3,2);
|
||||
$HHshift_start_time = substr($shift_start_time,0,2);
|
||||
$MMshift_start_time = substr($shift_start_time,2,2);
|
||||
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
|
||||
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
|
||||
if ($MMshift_end_time > 59)
|
||||
{
|
||||
$MMshift_end_time = ($MMshift_end_time - 60);
|
||||
$HHshift_end_time++;
|
||||
}
|
||||
if ($HHshift_end_time > 23)
|
||||
{$HHshift_end_time = ($HHshift_end_time - 24);}
|
||||
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
|
||||
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
|
||||
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
|
||||
|
||||
if (
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
|
||||
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
|
||||
)
|
||||
{$shift_ok++;}
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($shift_ok < 1)
|
||||
{$Ashift_logout++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
|
||||
{$Alogin='TIME_SYNC';}
|
||||
if ($Acount < 1)
|
||||
{$Alogin='DEAD_VLA';}
|
||||
if ($AexternalDEAD > 0)
|
||||
{$Alogin='DEAD_EXTERNAL';}
|
||||
if ($Ashift_logout > 0)
|
||||
{$Alogin='SHIFT_DÉCONNEXION';}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Statut: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$CanalA[$counter] ~";
|
||||
# echo "$CanalA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten est invalide or Exten $exten est invalide\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
echo "Conférence $conf_exten a été attribué à $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- durée d'exécution du script: $RUNtimesecondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
##### MySQL Error Logging #####
|
||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||
{
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
}
|
||||
$one_mysql_log=0;
|
||||
return $errno;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect.php version 2.2.0
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (ereg("^PATHlogs", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (ereg("^PATHweb", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (ereg("^VARDB_server", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (ereg("^VARDB_database", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (ereg("^VARDB_user", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (ereg("^VARDB_pass", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (ereg("^VARDB_port", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
|
||||
if (!$link) {
|
||||
die('MySQL connect ERROR: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db("$VARDB_database",$link);
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to open up when a live_inbound call comes in giving the user
|
||||
# options of what to do with the call or options to lookup the callerID on various web sites
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $uniqueid - ('1234567890.123456',...)
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $voicemail_dump_exten - ('85026666666666')
|
||||
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.6';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Invalide session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<?php echo $server_ip ?>';
|
||||
var epoch_sec = '<?php echo $StarTtime ?>';
|
||||
var user_abb = '<?php echo $user_abb ?>';
|
||||
var vmail_box = '<?php echo $vmail_box ?>';
|
||||
var ext_context = '<?php echo $ext_context ?>';
|
||||
var ext_priority = '<?php echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<?php echo $session_name ?>';
|
||||
var user = '<?php echo $user ?>';
|
||||
var pass = '<?php echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30secondes
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<title>APPEL ENTRANT EN COURS";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>APPEL ENTRANT EN COURS</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid est invalide\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Canal: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Appelant: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Téléphone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Téléphone?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Téléphone?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Canal=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">COUTUME</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Numéro Composé: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Notes:</td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">RACCROCHER</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">ENVOYEZ VERS MA BOITE VOCALE</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- durée d'exécution du script: $RUNtimesecondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
# live_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1203 - Added variable filters to close security holes for login form
|
||||
# 60825-1029 - Fixed translation variable issue ChannelA
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '2.0.1';
|
||||
$build = '60825-1029';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Invalide session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Vérification De l'extension";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten est invalide ou protocole $protocol est invalide\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanalA: $ChanneLA[$counter] ~";
|
||||
echo "CanalB: $ChanneLB[$counter] ~";
|
||||
echo "CanalBtrunk: $ChanneLA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- durée d'exécution du script: $RUNtimesecondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the details on the parked calls on the server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Invalide session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Affichage des appels en Attente";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten est invalide ou protocole $protocol est invalide\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- durée d'exécution du script: $RUNtimesecondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
# timeclock.php - VICIDIAL system user timeclock
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 80523-0134 - First Build
|
||||
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
|
||||
# 80525-2351 - Added an audit log that is not to be editable
|
||||
# 80602-0641 - Fixed status update bug
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
$version = '2.2.0-5';
|
||||
$build = '90508-0727';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$last_action_date = $NOW_TIME;
|
||||
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
|
||||
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
|
||||
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
|
||||
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
|
||||
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
|
||||
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
|
||||
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
|
||||
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
|
||||
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
|
||||
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
|
||||
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
|
||||
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
|
||||
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
|
||||
if (!isset($phone_login))
|
||||
{
|
||||
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
|
||||
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
|
||||
}
|
||||
if (!isset($phone_pass))
|
||||
{
|
||||
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
|
||||
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=ereg_replace("[^0-9a-z]","",$DB);
|
||||
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
|
||||
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
|
||||
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
|
||||
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
|
||||
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
|
||||
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
|
||||
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
{
|
||||
### see if user/pass exist for this user in vicidial_users table
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$valid_user=$row[0];
|
||||
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
|
||||
|
||||
if ($valid_user < 1)
|
||||
{
|
||||
### NOT A VALID USER/PASS
|
||||
$VDdisplayMESSAGE = "L'utilisateur et le mot de passe que vous avez entrés ne sont pas actifs dans le système<BR>S'il vous plaît essayez de nouveau:";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Ouverture de Session: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Mot de passe Utilisateur: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=VALIDER VALUE=VALIDER> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
### VALID USER/PASS, CONTINUE
|
||||
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
|
||||
if ($vts_count > 0)
|
||||
{
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
$last_action_sec = ($StarTtimE - $event_epoch);
|
||||
if ($last_action_sec > 0)
|
||||
{
|
||||
$totTIME_H = ($last_action_sec / 3600);
|
||||
$totTIME_H_int = round($totTIME_H, 2);
|
||||
$totTIME_H_int = intval("$totTIME_H");
|
||||
$totTIME_M = ($totTIME_H - $totTIME_H_int);
|
||||
$totTIME_M = ($totTIME_M * 60);
|
||||
$totTIME_M_int = round($totTIME_M, 2);
|
||||
$totTIME_M_int = intval("$totTIME_M");
|
||||
$totTIME_S = ($totTIME_M - $totTIME_M_int);
|
||||
$totTIME_S = ($totTIME_S * 60);
|
||||
$totTIME_S = round($totTIME_S, 0);
|
||||
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
|
||||
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
|
||||
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
|
||||
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
|
||||
}
|
||||
else
|
||||
{
|
||||
$totTIME_HMS='0:00:00';
|
||||
}
|
||||
|
||||
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='DEBUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$status='DEBUT';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NOUVEAU vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'DEBUT') )
|
||||
{
|
||||
### You cannot log in or out within 30secondes of your last login/logout
|
||||
$VDdisplayMESSAGE = "Vous ne pouvez pas vous connecter ou dans un délai de 30 secondes de votre dernière connexion ou déconnexion";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Ouverture de Session: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Mot de passe Utilisateur: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=VALIDER VALUE=VALIDER> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($commit == 'YES')
|
||||
{
|
||||
if ( ( ($status=='AUTODÉCONNEXION') or ($status=='DEBUT') or ($status=='DÉCONNEXION') ) and ($stage=='login') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "You have now logged-in";
|
||||
$LOGtimeMESSAGE = "You logged in at $NOW_TIME";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NOUVEAU vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NOUVEAU vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ($status=='LOGIN') and ($stage=='logout') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Vous avez maintenant connecté à";
|
||||
$LOGtimeMESSAGE = "Vous vous êtes connecté à$NOW_TIME<BR>Montant de temps vous avez été enregistrés dans:$totTIME_HMS";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='DÉCONNEXION', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NOUVEAU vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='DÉCONNEXION', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='DÉCONNEXION', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NOUVEAU vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ( ( ($status=='AUTODÉCONNEXION') or ($status=='DEBUT') or ($status=='DÉCONNEXION') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
|
||||
{echo "ERREUR: timeclock entrée de journal déjà fait:$status|$stage"; exit;}
|
||||
|
||||
if ($referrer=='agent')
|
||||
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">RETOUR à l'Agent Ouverture de Session Screen</font></A>";}
|
||||
if ($referrer=='admin')
|
||||
{$BACKlink = "<A HREF=\"../vicidial/admin.php\"><font color=\"#003333\">RETOUR à l'administration</font></A>";}
|
||||
if ($referrer=='welcome')
|
||||
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">RETOUR à l'écran de bienvenue</font></A>";}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ($status=='AUTODÉCONNEXION') or ($status=='DEBUT') or ($status=='DÉCONNEXION') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Temps écoulé depuis la dernière session ont été vous-en:$totTIME_HMS";
|
||||
$log_action = 'login';
|
||||
$button_name = 'LOGIN';
|
||||
$LOGtimeMESSAGE = "Vous dernière connecté à:$last_action_date<BR><BR>Cliquez ci-dessous pour LOGIN log-in";
|
||||
}
|
||||
if ($status=='LOGIN')
|
||||
{
|
||||
$VDdisplayMESSAGE = "Montant de temps vous avez été enregistrés dans:$totTIME_HMS";
|
||||
$log_action = 'logout';
|
||||
$button_name = 'DÉCONNEXION';
|
||||
$LOGtimeMESSAGE = "Vous vous êtes inscrit en ligne à: $last_action_date<BR>Montant de temps vous avez été enregistrés dans:$totTIME_HMS<BR><BR>Cliquez ci-dessous pour vous connecter DÉCONNEXION-out";
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentTimeclock</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Timeclock </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Ouverture de Session: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Mot de passe Utilisateur: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=VALIDER VALUE=VALIDER> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSION: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
# vdc_script_display.php
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed display the contents of the SCRIPT tab in the agent interface
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90824-1435 - First build of script
|
||||
# 90827-1548 - Added list override script option
|
||||
# 91204-1913 - Added recording_filename and recording_id variables
|
||||
# 91211-1103 - Added user_custom_... variables
|
||||
#
|
||||
|
||||
$version = '2.2.0-4';
|
||||
$build = '91211-1103';
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
$vendor_lead_code = $vendor_id;
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
|
||||
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["title"])) {$title=$_GET["title"];}
|
||||
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
|
||||
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
|
||||
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
|
||||
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
|
||||
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
|
||||
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
|
||||
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
|
||||
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
|
||||
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
|
||||
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
|
||||
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
|
||||
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
|
||||
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
|
||||
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
|
||||
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
|
||||
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
|
||||
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
|
||||
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
|
||||
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
|
||||
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
|
||||
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
|
||||
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
|
||||
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
|
||||
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
|
||||
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
|
||||
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
|
||||
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
|
||||
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
|
||||
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
|
||||
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
|
||||
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
|
||||
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
|
||||
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
|
||||
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
|
||||
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
|
||||
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
|
||||
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
|
||||
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
|
||||
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
|
||||
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
|
||||
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
|
||||
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
|
||||
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
|
||||
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
|
||||
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
|
||||
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
|
||||
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
|
||||
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
|
||||
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
|
||||
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
|
||||
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
|
||||
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
|
||||
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
|
||||
|
||||
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
|
||||
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
|
||||
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
|
||||
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
$txt = '.txt';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$CIDdate = date("mdHis");
|
||||
$ENTRYdate = date("YmdHis");
|
||||
$MT[0]='';
|
||||
$agents='@agents';
|
||||
|
||||
$IFRAME=0;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
|
||||
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
|
||||
$phone_code = ereg_replace("[^0-9]","",$phone_code);
|
||||
$phone_number = ereg_replace("[^0-9]","",$phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = ereg_replace("'|\"|\\\\|;","",$user);
|
||||
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
|
||||
}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if ($format == 'debug') {$DB=1;}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalid Username/Password: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
|
||||
echo "<title>VICIDiaL Script Display Script";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if (strlen($in_script) < 1)
|
||||
{$call_script = $camp_script;}
|
||||
else
|
||||
{$call_script = $in_script;}
|
||||
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
if (eregi("iframe src",$script_text))
|
||||
{
|
||||
$IFRAME=1;
|
||||
$lead_id = eregi_replace(' ','+',$lead_id);
|
||||
$vendor_id = eregi_replace(' ','+',$vendor_id);
|
||||
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
|
||||
$list_id = eregi_replace(' ','+',$list_id);
|
||||
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
|
||||
$phone_code = eregi_replace(' ','+',$phone_code);
|
||||
$phone_number = eregi_replace(' ','+',$phone_number);
|
||||
$title = eregi_replace(' ','+',$title);
|
||||
$first_name = eregi_replace(' ','+',$first_name);
|
||||
$middle_initial = eregi_replace(' ','+',$middle_initial);
|
||||
$last_name = eregi_replace(' ','+',$last_name);
|
||||
$address1 = eregi_replace(' ','+',$address1);
|
||||
$address2 = eregi_replace(' ','+',$address2);
|
||||
$address3 = eregi_replace(' ','+',$address3);
|
||||
$city = eregi_replace(' ','+',$city);
|
||||
$state = eregi_replace(' ','+',$state);
|
||||
$province = eregi_replace(' ','+',$province);
|
||||
$postal_code = eregi_replace(' ','+',$postal_code);
|
||||
$country_code = eregi_replace(' ','+',$country_code);
|
||||
$gender = eregi_replace(' ','+',$gender);
|
||||
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
|
||||
$alt_phone = eregi_replace(' ','+',$alt_phone);
|
||||
$email = eregi_replace(' ','+',$email);
|
||||
$security_phrase = eregi_replace(' ','+',$security_phrase);
|
||||
$comments = eregi_replace(' ','+',$comments);
|
||||
$user = eregi_replace(' ','+',$user);
|
||||
$pass = eregi_replace(' ','+',$pass);
|
||||
$campaign = eregi_replace(' ','+',$campaign);
|
||||
$phone_login = eregi_replace(' ','+',$phone_login);
|
||||
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
|
||||
$phone_pass = eregi_replace(' ','+',$phone_pass);
|
||||
$fronter = eregi_replace(' ','+',$fronter);
|
||||
$closer = eregi_replace(' ','+',$closer);
|
||||
$group = eregi_replace(' ','+',$group);
|
||||
$channel_group = eregi_replace(' ','+',$channel_group);
|
||||
$SQLdate = eregi_replace(' ','+',$SQLdate);
|
||||
$epoch = eregi_replace(' ','+',$epoch);
|
||||
$uniqueid = eregi_replace(' ','+',$uniqueid);
|
||||
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
|
||||
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
|
||||
$server_ip = eregi_replace(' ','+',$server_ip);
|
||||
$SIPexten = eregi_replace(' ','+',$SIPexten);
|
||||
$session_id = eregi_replace(' ','+',$session_id);
|
||||
$phone = eregi_replace(' ','+',$phone);
|
||||
$parked_by = eregi_replace(' ','+',$parked_by);
|
||||
$dispo = eregi_replace(' ','+',$dispo);
|
||||
$dialed_number = eregi_replace(' ','+',$dialed_number);
|
||||
$dialed_label = eregi_replace(' ','+',$dialed_label);
|
||||
$source_id = eregi_replace(' ','+',$source_id);
|
||||
$rank = eregi_replace(' ','+',$rank);
|
||||
$owner = eregi_replace(' ','+',$owner);
|
||||
$camp_script = eregi_replace(' ','+',$camp_script);
|
||||
$in_script = eregi_replace(' ','+',$in_script);
|
||||
$script_width = eregi_replace(' ','+',$script_width);
|
||||
$script_height = eregi_replace(' ','+',$script_height);
|
||||
$fullname = eregi_replace(' ','+',$fullname);
|
||||
$recording_filename = eregi_replace(' ','+',$recording_filename);
|
||||
$recording_id = eregi_replace(' ','+',$recording_id);
|
||||
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
|
||||
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
|
||||
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
|
||||
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
|
||||
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
|
||||
}
|
||||
|
||||
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
|
||||
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
|
||||
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
|
||||
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
|
||||
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
|
||||
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
|
||||
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
|
||||
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
|
||||
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
|
||||
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
|
||||
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
|
||||
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
|
||||
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
|
||||
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
|
||||
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
|
||||
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
|
||||
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
|
||||
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
|
||||
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
|
||||
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
|
||||
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
|
||||
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
|
||||
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
|
||||
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
|
||||
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
|
||||
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
|
||||
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
|
||||
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
|
||||
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
|
||||
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
|
||||
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
|
||||
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
|
||||
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
|
||||
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
|
||||
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
|
||||
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
|
||||
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
|
||||
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
|
||||
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
|
||||
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
|
||||
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
|
||||
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
|
||||
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
|
||||
$script_text = eregi_replace("\n","<BR>",$script_text);
|
||||
$script_text = stripslashes($script_text);
|
||||
|
||||
|
||||
echo "<!-- IFRAME$IFRAME -->\n";
|
||||
echo "<!-- $script_id -->\n";
|
||||
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
|
||||
echo "<center><B>$script_name</B><BR></center>\n";
|
||||
echo "$script_text\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "</div>";}
|
||||
echo "</TD></TR></TABLE>\n";
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
# voicemail_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1204 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60619-1204';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalide Utilisateurname/Mot de passe: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Invalide server_ip: |$server_ip| or Invalide session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Invalide session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Consultation de la Boite Vocale";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "boîte vocale $vmail_box est invalide\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- durée d'exécution du script: $RUNtimesecondes -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
# active_list_refresh.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to serve updates of the live data to the display scripts
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ADD - ('1','2','3','4','5')
|
||||
# - $order - ('asc','desc')
|
||||
# - $format - ('text','table','menu','selectlist','textarea')
|
||||
# - $bgcolor - ('#123456','white','black','etc...')
|
||||
# - $txtcolor - ('#654321','black','white','etc...')
|
||||
# - $txtsize - ('1','2','3','etc...')
|
||||
# - $selectsize - ('2','3','4','etc...')
|
||||
# - $selectfontsize - ('8','10','12','etc...')
|
||||
# - $selectedext - ('cc100')
|
||||
# - $selectedtrunk - ('Zap/25-1')
|
||||
# - $selectedlocal - ('SIP/cc100')
|
||||
# - $textareaheight - ('8','10','12','etc...')
|
||||
# - $textareawidth - ('8','10','12','etc...')
|
||||
# - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1118 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$ADD=ereg_replace("[^0-9]","",$ADD);
|
||||
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
|
||||
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
|
||||
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
|
||||
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
|
||||
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
|
||||
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
|
||||
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
|
||||
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
|
||||
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
|
||||
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
|
||||
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
|
||||
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
|
||||
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1118';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Utentename/Password non validi: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Nome sessione non valido: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIONE: $version BUILD: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Visualizza Lista: ";
|
||||
if ($ADD==1) {echo "Estensioni Attive";}
|
||||
if ($ADD==2) {echo "Estensioni Occupate";}
|
||||
if ($ADD==3) {echo "Linee Esterne";}
|
||||
if ($ADD==4) {echo "Interni Locali";}
|
||||
if ($ADD==5) {echo "Conferenze";}
|
||||
if ($ADD==99999) {echo "AIUTO";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELEZIONATO ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELEZIONATO ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELEZIONATO ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELEZIONATO ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELEZIONATO ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- script runtime: $RUNtimesecondi -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
# call_log_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
# - $in_limit - ('10','20','50','100',...)
|
||||
# - $out_limit - ('10','20','50','100',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1202 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1202';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Utentename/Password non validi: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Nome sessione non valido: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIONE: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Visualizza il Log della chiamata";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten non e` valido o protocollo $protocol non e` valido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimesecondi -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,647 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1201 - Added variable filters to close security holes for login form
|
||||
# 61128-2255 - Added update for manual dial vicidial_live_agents
|
||||
# 70319-1542 - Added agent disabled display function
|
||||
# 71122-0205 - Added vicidial_live_agent status output
|
||||
# 80424-0442 - Added non_latin lookup from system_settings
|
||||
# 80519-1425 - Added calls-in-queue tally
|
||||
# 80703-1106 - Added API functionality for Hangup and Dispo
|
||||
# 81104-0229 - Added mysql error logging capability
|
||||
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
|
||||
# 90102-1402 - Added check for system and database time synchronization
|
||||
# 90120-1720 - Added compatibility for API pause/resume and dial a number
|
||||
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
|
||||
# 90408-0020 - Added API vtiger specific callback activity record ability
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
|
||||
# 90908-1037 - Added DEAD call logging
|
||||
# 91130-2022 - Added code for manager override of in-group selection
|
||||
# 91228-1341 - Added API fields update functions
|
||||
#
|
||||
|
||||
$version = '2.2.0-24';
|
||||
$build = '91228-1341';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=17;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Utentename/Password non validi: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Nome sessione non valido: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIONE: $version BUILD: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Conf Extension Check";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten non e` valido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
$Acount=0;
|
||||
$AexternalDEAD=0;
|
||||
$Aagent_log_id='';
|
||||
$Acallerid='';
|
||||
$DEADcustomer=0;
|
||||
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
$Acampaign_id = $row[3];
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
|
||||
##### BEGIN DEAD logging section #####
|
||||
### find whether the call the agent is su is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
|
||||
{
|
||||
$DEADcustomer++;
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
{
|
||||
$NEWdead_epoch = date("U");
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
##### END DEAD logging section #####
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Chiamate in coda: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Chiamate in coda: $RingCalls</font>";}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
$external_dial = $row[3];
|
||||
$external_update_fields = $row[4];
|
||||
$external_update_fields_data = $row[5];
|
||||
$timer_action = $row[6];
|
||||
$timer_action_message = $row[7];
|
||||
$timer_action_seconds = $row[8];
|
||||
|
||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
$web_diff = ($db_epoch - $web_epoch);
|
||||
|
||||
##### check for in-group change details
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
$outbound_autodial = $row[3];
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
$NEWoutbound_autodial='N';
|
||||
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
|
||||
{$NEWoutbound_autodial='Y';}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
|
||||
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
|
||||
|
||||
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
|
||||
$Ashift_logout=0;
|
||||
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|INIZIO",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
|
||||
{
|
||||
$shift_ok=0;
|
||||
if (strlen($LOGgroup_shiftsSQL) < 3)
|
||||
{$Ashift_logout++;}
|
||||
else
|
||||
{
|
||||
$HHMM = date("Hi");
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
$shift_weekdays = $rowx[3];
|
||||
|
||||
if (eregi("$wday",$shift_weekdays))
|
||||
{
|
||||
$HHshift_length = substr($shift_length,0,2);
|
||||
$MMshift_length = substr($shift_length,3,2);
|
||||
$HHshift_start_time = substr($shift_start_time,0,2);
|
||||
$MMshift_start_time = substr($shift_start_time,2,2);
|
||||
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
|
||||
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
|
||||
if ($MMshift_end_time > 59)
|
||||
{
|
||||
$MMshift_end_time = ($MMshift_end_time - 60);
|
||||
$HHshift_end_time++;
|
||||
}
|
||||
if ($HHshift_end_time > 23)
|
||||
{$HHshift_end_time = ($HHshift_end_time - 24);}
|
||||
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
|
||||
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
|
||||
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
|
||||
|
||||
if (
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
|
||||
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
|
||||
)
|
||||
{$shift_ok++;}
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($shift_ok < 1)
|
||||
{$Ashift_logout++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
|
||||
{$Alogin='TIME_SYNC';}
|
||||
if ($Acount < 1)
|
||||
{$Alogin='DEAD_VLA';}
|
||||
if ($AexternalDEAD > 0)
|
||||
{$Alogin='DEAD_EXTERNAL';}
|
||||
if ($Ashift_logout > 0)
|
||||
{$Alogin='SHIFT_LOGOUT';}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Stato: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanaleA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$CanaleA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$CanaleA[$counter] ~";
|
||||
# echo "$CanaleA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten non e` valido or Exten $exten non e` valido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
echo "Conferenza $conf_exten e` stato registrato su $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimesecondi -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
##### MySQL Error Logging #####
|
||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||
{
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
}
|
||||
$one_mysql_log=0;
|
||||
return $errno;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect.php version 2.2.0
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (ereg("^PATHlogs", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (ereg("^PATHweb", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (ereg("^VARDB_server", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (ereg("^VARDB_database", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (ereg("^VARDB_user", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (ereg("^VARDB_pass", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (ereg("^VARDB_port", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
|
||||
if (!$link) {
|
||||
die('MySQL connect ERROR: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db("$VARDB_database",$link);
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to open up when a live_inbound call comes in giving the user
|
||||
# options of what to do with the call or options to lookup the callerID on various web sites
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $uniqueid - ('1234567890.123456',...)
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $voicemail_dump_exten - ('85026666666666')
|
||||
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.6';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Utentename/Password non validi: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Nome sessione non valido: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIONE: $version BUILD: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<?php echo $server_ip ?>';
|
||||
var epoch_sec = '<?php echo $StarTtime ?>';
|
||||
var user_abb = '<?php echo $user_abb ?>';
|
||||
var vmail_box = '<?php echo $vmail_box ?>';
|
||||
var ext_context = '<?php echo $ext_context ?>';
|
||||
var ext_priority = '<?php echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<?php echo $session_name ?>';
|
||||
var user = '<?php echo $user ?>';
|
||||
var pass = '<?php echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30secondi
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<title>CHIAMATA INBOUND IN CORSO";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>CHIAMATA INBOUND IN CORSO</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid non e` valido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Canale: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>CallerID: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Telefono?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Telefono?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Telefono?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Canale=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">CLIENTE</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Numero chiamato: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Note:</td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">RIAGGANCIA</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">INVIA ALLA MIA VOICEMAIL</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimesecondi -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
# live_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1203 - Added variable filters to close security holes for login form
|
||||
# 60825-1029 - Fixed translation variable issue ChannelA
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '2.0.1';
|
||||
$build = '60825-1029';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Utentename/Password non validi: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Nome sessione non valido: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIONE: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Controllo Interni Attivi";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten non e` valido o protocollo $protocol non e` valido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanaleA: $ChanneLA[$counter] ~";
|
||||
echo "CanaleB: $ChanneLB[$counter] ~";
|
||||
echo "CanaleBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanaleA: $ChanneLA[$counter] ~";
|
||||
echo "CanaleB: $ChanneLB[$counter] ~";
|
||||
echo "CanaleBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanaleA: $ChanneLA[$counter] ~";
|
||||
echo "CanaleB: $ChanneLB[$counter] ~";
|
||||
echo "CanaleBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanaleA: $ChanneLA[$counter] ~";
|
||||
echo "CanaleB: $ChanneLB[$counter] ~";
|
||||
echo "CanaleBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "CanaleA: $ChanneLA[$counter] ~";
|
||||
echo "CanaleB: $ChanneLB[$counter] ~";
|
||||
echo "CanaleBtrunk: $ChanneLA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimesecondi -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the details on the parked calls on the server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Utentename/Password non validi: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Nome sessione non valido: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIONE: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Display Chiamate in Attesa";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten non e` valido o protocollo $protocol non e` valido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimesecondi -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
# timeclock.php - VICIDIAL system user timeclock
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 80523-0134 - First Build
|
||||
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
|
||||
# 80525-2351 - Added an audit log that is not to be editable
|
||||
# 80602-0641 - Fixed status update bug
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
$version = '2.2.0-5';
|
||||
$build = '90508-0727';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$last_action_date = $NOW_TIME;
|
||||
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
|
||||
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
|
||||
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
|
||||
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
|
||||
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
|
||||
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
|
||||
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
|
||||
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
|
||||
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
|
||||
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
|
||||
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
|
||||
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
|
||||
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
|
||||
if (!isset($phone_login))
|
||||
{
|
||||
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
|
||||
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
|
||||
}
|
||||
if (!isset($phone_pass))
|
||||
{
|
||||
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
|
||||
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=ereg_replace("[^0-9a-z]","",$DB);
|
||||
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
|
||||
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
|
||||
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
|
||||
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
|
||||
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
|
||||
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
|
||||
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
{
|
||||
### see if user/pass exist for this user in vicidial_users table
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$valid_user=$row[0];
|
||||
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
|
||||
|
||||
if ($valid_user < 1)
|
||||
{
|
||||
### NOT A VALID USER/PASS
|
||||
$VDdisplayMESSAGE = "Lutente e la password che hai inserito non sono attivi nel sistema<BR>Si prega di riprovare:";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentOrologio</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Orologio </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Login Utente: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Password Utente: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=INVIA VALUE=INVIA> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIONE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
### VALID USER/PASS, CONTINUE
|
||||
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
|
||||
if ($vts_count > 0)
|
||||
{
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
$last_action_sec = ($StarTtimE - $event_epoch);
|
||||
if ($last_action_sec > 0)
|
||||
{
|
||||
$totTIME_H = ($last_action_sec / 3600);
|
||||
$totTIME_H_int = round($totTIME_H, 2);
|
||||
$totTIME_H_int = intval("$totTIME_H");
|
||||
$totTIME_M = ($totTIME_H - $totTIME_H_int);
|
||||
$totTIME_M = ($totTIME_M * 60);
|
||||
$totTIME_M_int = round($totTIME_M, 2);
|
||||
$totTIME_M_int = intval("$totTIME_M");
|
||||
$totTIME_S = ($totTIME_M - $totTIME_M_int);
|
||||
$totTIME_S = ($totTIME_S * 60);
|
||||
$totTIME_S = round($totTIME_S, 0);
|
||||
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
|
||||
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
|
||||
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
|
||||
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
|
||||
}
|
||||
else
|
||||
{
|
||||
$totTIME_HMS='0:00:00';
|
||||
}
|
||||
|
||||
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='INIZIO', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$status='INIZIO';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NUOVO vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'INIZIO') )
|
||||
{
|
||||
### You cannot log in or out within 30secondi of your last login/logout
|
||||
$VDdisplayMESSAGE = "Non è possibile accedere o entro 30 secondi del tuo ultimo accesso o il logout";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentOrologio</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Orologio </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Login Utente: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Password Utente: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=INVIA VALUE=INVIA> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIONE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($commit == 'YES')
|
||||
{
|
||||
if ( ( ($status=='AUTOLOGOUT') or ($status=='INIZIO') or ($status=='LOGOUT') ) and ($stage=='login') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "You have now logged-in";
|
||||
$LOGtimeMESSAGE = "You logged in at $NOW_TIME";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NUOVO vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NUOVO vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ($status=='LOGIN') and ($stage=='logout') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Lei ha appena effettuato laccesso-out";
|
||||
$LOGtimeMESSAGE = "Hai effettuato laccesso a$NOW_TIME<BR>Importo di tempo sono state registrate in:$totTIME_HMS";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NUOVO vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGOUT', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGOUT', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NUOVO vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ( ( ($status=='AUTOLOGOUT') or ($status=='INIZIO') or ($status=='LOGOUT') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
|
||||
{echo "ERRORE: orologio registro entrata già fatto:$status|$stage"; exit;}
|
||||
|
||||
if ($referrer=='agent')
|
||||
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">Torna alla schermata di login di agente</font></A>";}
|
||||
if ($referrer=='admin')
|
||||
{$BACKlink = "<A HREF=\"../vicidial/admin.php\"><font color=\"#003333\">BACK per Amministrazione</font></A>";}
|
||||
if ($referrer=='welcome')
|
||||
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">Torna alla schermata iniziale</font></A>";}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentOrologio</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Orologio </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIONE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ($status=='AUTOLOGOUT') or ($status=='INIZIO') or ($status=='LOGOUT') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Tempo dallultimo registrato in:$totTIME_HMS";
|
||||
$log_action = 'login';
|
||||
$button_name = 'LOGIN';
|
||||
$LOGtimeMESSAGE = "È lultima connesso a:$last_action_date<BR><BR>Clicca qui sotto per LOGIN log-in";
|
||||
}
|
||||
if ($status=='LOGIN')
|
||||
{
|
||||
$VDdisplayMESSAGE = "Quantità di tempo è stato registrato in:$totTIME_HMS";
|
||||
$log_action = 'logout';
|
||||
$button_name = 'LOGOUT';
|
||||
$LOGtimeMESSAGE = "Hai effettuato laccesso al-in: $last_action_date<BR>Quantità di tempo è stato registrato in:$totTIME_HMS<BR><BR>Clicca qui sotto per LOGOUT log-out";
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentOrologio</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Orologio </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIONE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>AgentOrologio</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B>Orologio </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Login Utente: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Password Utente: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=INVIA VALUE=INVIA> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIONE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
# vdc_script_display.php
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed display the contents of the SCRIPT tab in the agent interface
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90824-1435 - First build of script
|
||||
# 90827-1548 - Added list override script option
|
||||
# 91204-1913 - Added recording_filename and recording_id variables
|
||||
# 91211-1103 - Added user_custom_... variables
|
||||
#
|
||||
|
||||
$version = '2.2.0-4';
|
||||
$build = '91211-1103';
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
$vendor_lead_code = $vendor_id;
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
|
||||
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["title"])) {$title=$_GET["title"];}
|
||||
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
|
||||
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
|
||||
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
|
||||
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
|
||||
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
|
||||
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
|
||||
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
|
||||
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
|
||||
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
|
||||
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
|
||||
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
|
||||
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
|
||||
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
|
||||
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
|
||||
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
|
||||
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
|
||||
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
|
||||
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
|
||||
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
|
||||
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
|
||||
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
|
||||
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
|
||||
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
|
||||
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
|
||||
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
|
||||
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
|
||||
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
|
||||
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
|
||||
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
|
||||
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
|
||||
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
|
||||
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
|
||||
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
|
||||
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
|
||||
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
|
||||
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
|
||||
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
|
||||
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
|
||||
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
|
||||
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
|
||||
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
|
||||
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
|
||||
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
|
||||
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
|
||||
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
|
||||
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
|
||||
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
|
||||
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
|
||||
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
|
||||
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
|
||||
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
|
||||
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
|
||||
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
|
||||
|
||||
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
|
||||
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
|
||||
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
|
||||
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
$txt = '.txt';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$CIDdate = date("mdHis");
|
||||
$ENTRYdate = date("YmdHis");
|
||||
$MT[0]='';
|
||||
$agents='@agents';
|
||||
|
||||
$IFRAME=0;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
|
||||
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
|
||||
$phone_code = ereg_replace("[^0-9]","",$phone_code);
|
||||
$phone_number = ereg_replace("[^0-9]","",$phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = ereg_replace("'|\"|\\\\|;","",$user);
|
||||
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
|
||||
}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if ($format == 'debug') {$DB=1;}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalid Username/Password: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
|
||||
echo "<title>VICIDiaL Script Display Script";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if (strlen($in_script) < 1)
|
||||
{$call_script = $camp_script;}
|
||||
else
|
||||
{$call_script = $in_script;}
|
||||
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
if (eregi("iframe src",$script_text))
|
||||
{
|
||||
$IFRAME=1;
|
||||
$lead_id = eregi_replace(' ','+',$lead_id);
|
||||
$vendor_id = eregi_replace(' ','+',$vendor_id);
|
||||
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
|
||||
$list_id = eregi_replace(' ','+',$list_id);
|
||||
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
|
||||
$phone_code = eregi_replace(' ','+',$phone_code);
|
||||
$phone_number = eregi_replace(' ','+',$phone_number);
|
||||
$title = eregi_replace(' ','+',$title);
|
||||
$first_name = eregi_replace(' ','+',$first_name);
|
||||
$middle_initial = eregi_replace(' ','+',$middle_initial);
|
||||
$last_name = eregi_replace(' ','+',$last_name);
|
||||
$address1 = eregi_replace(' ','+',$address1);
|
||||
$address2 = eregi_replace(' ','+',$address2);
|
||||
$address3 = eregi_replace(' ','+',$address3);
|
||||
$city = eregi_replace(' ','+',$city);
|
||||
$state = eregi_replace(' ','+',$state);
|
||||
$province = eregi_replace(' ','+',$province);
|
||||
$postal_code = eregi_replace(' ','+',$postal_code);
|
||||
$country_code = eregi_replace(' ','+',$country_code);
|
||||
$gender = eregi_replace(' ','+',$gender);
|
||||
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
|
||||
$alt_phone = eregi_replace(' ','+',$alt_phone);
|
||||
$email = eregi_replace(' ','+',$email);
|
||||
$security_phrase = eregi_replace(' ','+',$security_phrase);
|
||||
$comments = eregi_replace(' ','+',$comments);
|
||||
$user = eregi_replace(' ','+',$user);
|
||||
$pass = eregi_replace(' ','+',$pass);
|
||||
$campaign = eregi_replace(' ','+',$campaign);
|
||||
$phone_login = eregi_replace(' ','+',$phone_login);
|
||||
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
|
||||
$phone_pass = eregi_replace(' ','+',$phone_pass);
|
||||
$fronter = eregi_replace(' ','+',$fronter);
|
||||
$closer = eregi_replace(' ','+',$closer);
|
||||
$group = eregi_replace(' ','+',$group);
|
||||
$channel_group = eregi_replace(' ','+',$channel_group);
|
||||
$SQLdate = eregi_replace(' ','+',$SQLdate);
|
||||
$epoch = eregi_replace(' ','+',$epoch);
|
||||
$uniqueid = eregi_replace(' ','+',$uniqueid);
|
||||
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
|
||||
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
|
||||
$server_ip = eregi_replace(' ','+',$server_ip);
|
||||
$SIPexten = eregi_replace(' ','+',$SIPexten);
|
||||
$session_id = eregi_replace(' ','+',$session_id);
|
||||
$phone = eregi_replace(' ','+',$phone);
|
||||
$parked_by = eregi_replace(' ','+',$parked_by);
|
||||
$dispo = eregi_replace(' ','+',$dispo);
|
||||
$dialed_number = eregi_replace(' ','+',$dialed_number);
|
||||
$dialed_label = eregi_replace(' ','+',$dialed_label);
|
||||
$source_id = eregi_replace(' ','+',$source_id);
|
||||
$rank = eregi_replace(' ','+',$rank);
|
||||
$owner = eregi_replace(' ','+',$owner);
|
||||
$camp_script = eregi_replace(' ','+',$camp_script);
|
||||
$in_script = eregi_replace(' ','+',$in_script);
|
||||
$script_width = eregi_replace(' ','+',$script_width);
|
||||
$script_height = eregi_replace(' ','+',$script_height);
|
||||
$fullname = eregi_replace(' ','+',$fullname);
|
||||
$recording_filename = eregi_replace(' ','+',$recording_filename);
|
||||
$recording_id = eregi_replace(' ','+',$recording_id);
|
||||
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
|
||||
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
|
||||
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
|
||||
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
|
||||
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
|
||||
}
|
||||
|
||||
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
|
||||
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
|
||||
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
|
||||
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
|
||||
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
|
||||
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
|
||||
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
|
||||
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
|
||||
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
|
||||
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
|
||||
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
|
||||
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
|
||||
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
|
||||
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
|
||||
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
|
||||
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
|
||||
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
|
||||
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
|
||||
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
|
||||
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
|
||||
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
|
||||
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
|
||||
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
|
||||
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
|
||||
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
|
||||
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
|
||||
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
|
||||
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
|
||||
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
|
||||
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
|
||||
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
|
||||
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
|
||||
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
|
||||
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
|
||||
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
|
||||
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
|
||||
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
|
||||
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
|
||||
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
|
||||
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
|
||||
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
|
||||
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
|
||||
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
|
||||
$script_text = eregi_replace("\n","<BR>",$script_text);
|
||||
$script_text = stripslashes($script_text);
|
||||
|
||||
|
||||
echo "<!-- IFRAME$IFRAME -->\n";
|
||||
echo "<!-- $script_id -->\n";
|
||||
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
|
||||
echo "<center><B>$script_name</B><BR></center>\n";
|
||||
echo "$script_text\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "</div>";}
|
||||
echo "</TD></TR></TABLE>\n";
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
# voicemail_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1204 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60619-1204';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Utentename/Password non validi: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "ip del server non valido: |$server_ip| or Nome sessione non valido: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Nome sessione non valido: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIONE: $version BUILD: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Controllo Voicemail";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Casella Voicemail $vmail_box non e` valido\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimesecondi -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,483 @@
|
||||
<?php
|
||||
# active_list_refresh.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to serve updates of the live data to the display scripts
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $ADD - ('1','2','3','4','5')
|
||||
# - $order - ('asc','desc')
|
||||
# - $format - ('text','table','menu','selectlist','textarea')
|
||||
# - $bgcolor - ('#123456','white','black','etc...')
|
||||
# - $txtcolor - ('#654321','black','white','etc...')
|
||||
# - $txtsize - ('1','2','3','etc...')
|
||||
# - $selectsize - ('2','3','4','etc...')
|
||||
# - $selectfontsize - ('8','10','12','etc...')
|
||||
# - $selectedext - ('cc100')
|
||||
# - $selectedtrunk - ('Zap/25-1')
|
||||
# - $selectedlocal - ('SIP/cc100')
|
||||
# - $textareaheight - ('8','10','12','etc...')
|
||||
# - $textareawidth - ('8','10','12','etc...')
|
||||
# - $field_name - ('extension','busyext','extension_xfer','etc...')
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50323-1147 - First build of script
|
||||
# 50401-1132 - small formatting changes
|
||||
# 50502-1402 - added field_name as modifiable variable
|
||||
# 50503-1213 - added session_name checking for extra security
|
||||
# 50503-1311 - added conferences list
|
||||
# 50610-1155 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1209 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1155 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1118 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ADD"])) {$ADD=$_GET["ADD"];}
|
||||
elseif (isset($_POST["ADD"])) {$ADD=$_POST["ADD"];}
|
||||
if (isset($_GET["order"])) {$order=$_GET["order"];}
|
||||
elseif (isset($_POST["order"])) {$order=$_POST["order"];}
|
||||
if (isset($_GET["bgcolor"])) {$bgcolor=$_GET["bgcolor"];}
|
||||
elseif (isset($_POST["bgcolor"])) {$bgcolor=$_POST["bgcolor"];}
|
||||
if (isset($_GET["txtcolor"])) {$txtcolor=$_GET["txtcolor"];}
|
||||
elseif (isset($_POST["txtcolor"])) {$txtcolor=$_POST["txtcolor"];}
|
||||
if (isset($_GET["txtsize"])) {$txtsize=$_GET["txtsize"];}
|
||||
elseif (isset($_POST["txtsize"])) {$txtsize=$_POST["txtsize"];}
|
||||
if (isset($_GET["selectsize"])) {$selectsize=$_GET["selectsize"];}
|
||||
elseif (isset($_POST["selectsize"])) {$selectsize=$_POST["selectsize"];}
|
||||
if (isset($_GET["selectfontsize"])) {$selectfontsize=$_GET["selectfontsize"];}
|
||||
elseif (isset($_POST["selectfontsize"])) {$selectfontsize=$_POST["selectfontsize"];}
|
||||
if (isset($_GET["selectedext"])) {$selectedext=$_GET["selectedext"];}
|
||||
elseif (isset($_POST["selectedext"])) {$selectedext=$_POST["selectedext"];}
|
||||
if (isset($_GET["selectedtrunk"])) {$selectedtrunk=$_GET["selectedtrunk"];}
|
||||
elseif (isset($_POST["selectedtrunk"])) {$selectedtrunk=$_POST["selectedtrunk"];}
|
||||
if (isset($_GET["selectedlocal"])) {$selectedlocal=$_GET["selectedlocal"];}
|
||||
elseif (isset($_POST["selectedlocal"])) {$selectedlocal=$_POST["selectedlocal"];}
|
||||
if (isset($_GET["textareaheight"])) {$textareaheight=$_GET["textareaheight"];}
|
||||
elseif (isset($_POST["textareaheight"])) {$textareaheight=$_POST["textareaheight"];}
|
||||
if (isset($_GET["textareawidth"])) {$textareawidth=$_GET["textareawidth"];}
|
||||
elseif (isset($_POST["textareawidth"])) {$textareawidth=$_POST["textareawidth"];}
|
||||
if (isset($_GET["field_name"])) {$field_name=$_GET["field_name"];}
|
||||
elseif (isset($_POST["field_name"])) {$field_name=$_POST["field_name"];}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$ADD=ereg_replace("[^0-9]","",$ADD);
|
||||
$order=ereg_replace("[^0-9a-zA-Z]","",$order);
|
||||
$format=ereg_replace("[^0-9a-zA-Z]","",$format);
|
||||
$bgcolor=ereg_replace("[^\#0-9a-zA-Z]","",$bgcolor);
|
||||
$txtcolor=ereg_replace("[^\#0-9a-zA-Z]","",$txtcolor);
|
||||
$txtsize=ereg_replace("[^0-9a-zA-Z]","",$txtsize);
|
||||
$selectsize=ereg_replace("[^0-9a-zA-Z]","",$selectsize);
|
||||
$selectfontsize=ereg_replace("[^0-9a-zA-Z]","",$selectfontsize);
|
||||
$selectedext=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedext);
|
||||
$selectedtrunk=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedtrunk);
|
||||
$selectedlocal=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$selectedlocal);
|
||||
$textareaheight=ereg_replace("[^0-9a-zA-Z]","",$textareaheight);
|
||||
$textareawidth=ereg_replace("[^0-9a-zA-Z]","",$textareawidth);
|
||||
$field_name=ereg_replace("[^ \#\*\:\/\@\.\-\_0-9a-zA-Z]","",$field_name);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($ADD)) {$ADD="1";}
|
||||
if (!isset($order)) {$order='desc';}
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($bgcolor)) {$bgcolor='white';}
|
||||
if (!isset($txtcolor)) {$txtcolor='black';}
|
||||
if (!isset($txtsize)) {$txtsize='2';}
|
||||
if (!isset($selectsize)) {$selectsize='4';}
|
||||
if (!isset($selectfontsize)) {$selectfontsize='10';}
|
||||
if (!isset($textareaheight)) {$textareaheight='10';}
|
||||
if (!isset($textareawidth)) {$textareawidth='20';}
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1118';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Foutief Gebruikersnaam/Wachtwoord: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Foutief server_ip: |$server_ip| or Foutief session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Foutief session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIE: $version BUILD: $build ADD: $ADD server_ip: $server_ip-->\n";
|
||||
echo "<title>Toon Lijst: ";
|
||||
if ($ADD==1) {echo "Live Extenties";}
|
||||
if ($ADD==2) {echo "Bezette Extenties";}
|
||||
if ($ADD==3) {echo "Buiten Lijnen";}
|
||||
if ($ADD==4) {echo "Lokale Extenties";}
|
||||
if ($ADD==5) {echo "Conferenties";}
|
||||
if ($ADD==99999) {echo "HELP";}
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=1 display all live extensions on a server
|
||||
######################
|
||||
if ($ADD==1)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'extension';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension,fullname FROM phones where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=2 display all busy extensions on a server
|
||||
######################
|
||||
if ($ADD==2)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'busyext';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT extension FROM live_channels where server_ip = '$server_ip' order by extension $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=3 display all busy outside lines(trunks) on a server
|
||||
######################
|
||||
if ($ADD==3)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'trunk';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedtrunk") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=4 display all busy Local lines on a server
|
||||
######################
|
||||
if ($ADD==4)
|
||||
{
|
||||
if (!$field_name) {$field_name = 'local';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT channel, extension FROM live_sip_channels where server_ip = '$server_ip' order by channel $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$busys_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($busys_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedlocal") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# ADD=5 display all agc-usable conferences on a server
|
||||
######################
|
||||
if ($ADD==5)
|
||||
{
|
||||
$pt='pt';
|
||||
if (!$field_name) {$field_name = 'conferences';}
|
||||
if ($format=='table') {echo "<TABLE WIDTH=120 BGCOLOR=$bgcolor cellpadding=0 cellspacing=0>\n";}
|
||||
if ($format=='menu') {echo "<SELECT SIZE=1 name=\"$field_name\">\n";}
|
||||
if ($format=='selectlist')
|
||||
{
|
||||
echo "<SELECT SIZE=$selectsize name=\"$field_name\" STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">\n";
|
||||
}
|
||||
if ($format=='textarea')
|
||||
{
|
||||
echo "<TEXTAREA ROWS=$textareaheight COLS=$textareawidth NAME=extension WRAP=off STYLE=\"font-family : sans-serif; font-size : $selectfontsize$pt\">";
|
||||
}
|
||||
|
||||
$stmt="SELECT conf_exten,extension FROM conferences where server_ip = '$server_ip' order by conf_exten $order";
|
||||
if ($format=='table') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$phones_to_print = mysql_num_rows($rslt);}
|
||||
$o=0;
|
||||
while ($phones_to_print > $o) {
|
||||
$row=mysql_fetch_row($rslt);
|
||||
if ($format=='table')
|
||||
{
|
||||
echo "<TR><TD ALIGN=LEFT NOWRAP><FONT FACE=\"ARIAL,HELVETICA\" COLOR=$txtcolor SIZE=$txtsize>";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</TD></TR>\n";
|
||||
}
|
||||
if ( ($format=='text') or ($format=='textarea') )
|
||||
{
|
||||
echo "$row[0] - $row[1]\n";
|
||||
}
|
||||
if ( ($format=='menu') or ($format=='selectlist') )
|
||||
{
|
||||
echo "<OPTION ";
|
||||
if ($row[0]=="$selectedext") {echo "SELECTED ";}
|
||||
echo "VALUE=\"$row[0]\">";
|
||||
echo "$row[0] - $row[1]";
|
||||
echo "</OPTION>\n";
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($format=='table') {echo "</TABLE>\n";}
|
||||
if ($format=='menu') {echo "</SELECT>\n";}
|
||||
if ($format=='selectlist') {echo "</SELECT>\n";}
|
||||
if ($format=='textarea') {echo "</TEXTAREA>\n";}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
if ($format=='table') {echo "\n<!-- script runtime: $RUNtimeseconden -->";}
|
||||
if ($format=='table') {echo "\n</body>\n</html>\n";}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
# call_log_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the inbound and outbound calls for a specific phone
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
# - $in_limit - ('10','20','50','100',...)
|
||||
# - $out_limit - ('10','20','50','100',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50406-1013 - First build of script
|
||||
# 50407-1452 - Added definable limits
|
||||
# 50503-1236 - added session_name checking for extra security
|
||||
# 50610-1158 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1202 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60323-1550 - added option for showing different number dialed in log
|
||||
# 60421-1401 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1202 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($in_limit)) {$in_limit="100";}
|
||||
if (!isset($out_limit)) {$out_limit="100";}
|
||||
$number_dialed = 'number_dialed';
|
||||
#$number_dialed = 'extension';
|
||||
|
||||
$version = '0.0.8';
|
||||
$build = '60619-1202';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Foutief Gebruikersnaam/Wachtwoord: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Foutief server_ip: |$server_ip| or Foutief session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Foutief session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIE: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Gesprekken Log Display";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten is niet geldig of protocol $protocol is niet geldig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print outbound calls from the call_log table
|
||||
$stmt="SELECT uniqueid,start_time,$number_dialed,length_in_sec FROM call_log where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\" order by start_time desc limit $out_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$out_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$out_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($out_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[3] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
|
||||
if ($number_dialed == 'extension') {$row[2] = substr($row[2],-10);}
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
##### print inbound calls from the live_inbound_log table
|
||||
$stmt="SELECT call_log.uniqueid,live_inbound_log.start_time,live_inbound_log.extension,caller_id,length_in_sec from live_inbound_log,call_log where phone_ext='$exten' and live_inbound_log.server_ip = '$server_ip' and call_log.uniqueid=live_inbound_log.uniqueid order by start_time desc limit $in_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$in_calls_count = mysql_num_rows($rslt);}
|
||||
echo "$in_calls_count|";
|
||||
$loop_count=0;
|
||||
while ($in_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
|
||||
$call_time_M = ($row[4] / 60);
|
||||
$call_time_M = round($call_time_M, 2);
|
||||
$call_time_M_int = intval("$call_time_M");
|
||||
$call_time_SEC = ($call_time_M - $call_time_M_int);
|
||||
$call_time_SEC = ($call_time_SEC * 60);
|
||||
$call_time_SEC = round($call_time_SEC, 0);
|
||||
if ($call_time_SEC < 10) {$call_time_SEC = "0$call_time_SEC";}
|
||||
$call_time_MS = "$call_time_M_int:$call_time_SEC";
|
||||
$callerIDnum = $row[3]; $callerIDname = $row[3];
|
||||
$callerIDnum = preg_replace("/.*<|>.*/","",$callerIDnum);
|
||||
$callerIDname = preg_replace("/\"| <\d*>/","",$callerIDname);
|
||||
|
||||
echo "$row[0] ~$row[1] ~$row[2] ~$callerIDnum ~$callerIDname ~$call_time_MS|";
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimeseconden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,648 @@
|
||||
<?php
|
||||
# conf_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the meetme conference has live channels connected and which they are
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $ACTION - ('refresh','register')
|
||||
# - $client - ('agc','vdc')
|
||||
# - $conf_exten - ('8600011',...)
|
||||
# - $exten - ('123test',...)
|
||||
# - $auto_dial_level - ('0','1','1.2',...)
|
||||
# - $campagentstdisp - ('YES',...)
|
||||
#
|
||||
|
||||
# changes
|
||||
# 50509-1054 - First build of script
|
||||
# 50511-1112 - Added ability to register a conference room
|
||||
# 50610-1159 - Added NULL check on MySQL results to reduced errors
|
||||
# 50706-1429 - script changed to not use HTTP login vars, user/pass instead
|
||||
# 50706-1525 - Added date-time display for vicidial client display
|
||||
# 50816-1500 - Added random update to vicidial_live_agents table for vdc users
|
||||
# 51121-1353 - Altered echo statements for several small PHP speed optimizations
|
||||
# 60410-1424 - Added ability to grab calls-being-placed and agent status
|
||||
# 60421-1405 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1201 - Added variable filters to close security holes for login form
|
||||
# 61128-2255 - Added update for manual dial vicidial_live_agents
|
||||
# 70319-1542 - Added agent disabled display function
|
||||
# 71122-0205 - Added vicidial_live_agent status output
|
||||
# 80424-0442 - Added non_latin lookup from system_settings
|
||||
# 80519-1425 - Added calls-in-queue tally
|
||||
# 80703-1106 - Added API functionality for Hangup and Dispo
|
||||
# 81104-0229 - Added mysql error logging capability
|
||||
# 81104-1409 - Added multi-retry for some vicidial_live_agents table MySQL queries
|
||||
# 90102-1402 - Added check for system and database time synchronization
|
||||
# 90120-1720 - Added compatibility for API pause/resume and dial a number
|
||||
# 90307-1855 - Added shift enforcement to send logout flag if outside of shift hours
|
||||
# 90408-0020 - Added API vtiger specific callback activity record ability
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
# 90706-1430 - Fixed AGENTDIRECT calls in queue display count
|
||||
# 90908-1037 - Added DEAD call logging
|
||||
# 91130-2022 - Added code for manager override of in-group selection
|
||||
# 91228-1341 - Added API fields update functions
|
||||
#
|
||||
|
||||
$version = '2.2.0-24';
|
||||
$build = '91228-1341';
|
||||
$mel=1; # Mysql Error Log enabled = 1
|
||||
$mysql_log_count=17;
|
||||
$one_mysql_log=0;
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["ACTION"])) {$ACTION=$_GET["ACTION"];}
|
||||
elseif (isset($_POST["ACTION"])) {$ACTION=$_POST["ACTION"];}
|
||||
if (isset($_GET["client"])) {$client=$_GET["client"];}
|
||||
elseif (isset($_POST["client"])) {$client=$_POST["client"];}
|
||||
if (isset($_GET["conf_exten"])) {$conf_exten=$_GET["conf_exten"];}
|
||||
elseif (isset($_POST["conf_exten"])) {$conf_exten=$_POST["conf_exten"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["auto_dial_level"])) {$auto_dial_level=$_GET["auto_dial_level"];}
|
||||
elseif (isset($_POST["auto_dial_level"])) {$auto_dial_level=$_POST["auto_dial_level"];}
|
||||
if (isset($_GET["campagentstdisp"])) {$campagentstdisp=$_GET["campagentstdisp"];}
|
||||
elseif (isset($_POST["campagentstdisp"])) {$campagentstdisp=$_POST["campagentstdisp"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03001',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
}
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($client)) {$client="agc";}
|
||||
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$FILE_TIME = date("Ymd_His");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$random = (rand(1000000, 9999999) + 10000000);
|
||||
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Foutief Gebruikersnaam/Wachtwoord: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Foutief server_ip: |$server_ip| or Foutief session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03002',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Foutief session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIE: $version BUILD: $build MEETME: $conf_exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Conf Extentie Controle";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'refresh')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($conf_exten)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten is niet geldig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if ($client == 'vdc')
|
||||
{
|
||||
$Acount=0;
|
||||
$AexternalDEAD=0;
|
||||
$Aagent_log_id='';
|
||||
$Acallerid='';
|
||||
$DEADcustomer=0;
|
||||
|
||||
### see if the agent has a record in the vicidial_live_agents table
|
||||
$stmt="SELECT count(*) from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03003',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Acount=$row[0];
|
||||
|
||||
if ($Acount > 0)
|
||||
{
|
||||
$stmt="SELECT status,callerid,agent_log_id,campaign_id from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03004',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Astatus = $row[0];
|
||||
$Acallerid = $row[1];
|
||||
$Aagent_log_id = $row[2];
|
||||
$Acampaign_id = $row[3];
|
||||
}
|
||||
# ### find out if external table shows agent should be disabled
|
||||
# $stmt="SELECT count(*) from another_table where user='$user' and status='DEAD';";
|
||||
# if ($DB) {echo "|$stmt|\n";}
|
||||
# $rslt=mysql_query($stmt, $link);
|
||||
# $row=mysql_fetch_row($rslt);
|
||||
# $AexternalDEAD=$row[0];
|
||||
|
||||
if ($auto_dial_level > 0)
|
||||
{
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03005',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9305$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
|
||||
##### BEGIN DEAD logging section #####
|
||||
### find whether the call the agent is op is hung up
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where callerid='$Acallerid';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03018',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$AcalleridCOUNT=$row[0];
|
||||
|
||||
if ( ($AcalleridCOUNT < 1) and (eregi("INCALL",$Astatus)) and (strlen($Aagent_log_id) > 0) )
|
||||
{
|
||||
$DEADcustomer++;
|
||||
### find whether the agent log record has already logged DEAD
|
||||
$stmt="SELECT count(*) from vicidial_agent_log where agent_log_id='$Aagent_log_id' and ( (dead_epoch IS NOT NULL) or (dead_epoch > 10000) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03019',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Aagent_log_idCOUNT=$row[0];
|
||||
|
||||
if ($Aagent_log_idCOUNT < 1)
|
||||
{
|
||||
$NEWdead_epoch = date("U");
|
||||
$deadNOW_TIME = date("Y-m-d H:i:s");
|
||||
$stmt="UPDATE vicidial_agent_log set dead_epoch='$NEWdead_epoch' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03020',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents set last_state_change='$deadNOW_TIME' where agent_log_id='$Aagent_log_id';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03021',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
##### END DEAD logging section #####
|
||||
|
||||
if ($campagentstdisp == 'YES')
|
||||
{
|
||||
$ADsql='';
|
||||
### grab the status of this agent to display
|
||||
$stmt="SELECT status,campaign_id,closer_campaigns from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03006',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$Alogin=$row[0];
|
||||
$Acampaign=$row[1];
|
||||
$AccampSQL=$row[2];
|
||||
$AccampSQL = ereg_replace(' -','', $AccampSQL);
|
||||
$AccampSQL = ereg_replace(' ',"','", $AccampSQL);
|
||||
if (eregi('AGENTDIRECT', $AccampSQL))
|
||||
{
|
||||
$AccampSQL = ereg_replace('AGENTDIRECT','', $AccampSQL);
|
||||
$ADsql = "or ( (campaign_id LIKE \"%AGENTDIRECT%\") and (agent_only='$user') )";
|
||||
}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status IN('LIVE') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) $ADsql);";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03007',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$RingCalls=$row[0];
|
||||
if ($RingCalls > 0) {$RingCalls = "<font class=\"queue_text_red\">Gesprekken in Wachtrij: $RingCalls</font>";}
|
||||
else {$RingCalls = "<font class=\"queue_text\">Gesprekken in Wachtrij: $RingCalls</font>";}
|
||||
|
||||
### grab the number of calls being placed from this server and campaign
|
||||
$stmt="SELECT count(*) from vicidial_auto_calls where status NOT IN('XFER') and ( (campaign_id='$Acampaign') or (campaign_id IN('$AccampSQL')) );";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03008',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$DiaLCalls=$row[0];
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$Alogin='N';
|
||||
$RingCalls='N';
|
||||
$DiaLCalls='N';
|
||||
|
||||
### update the vicidial_live_agents every second with a new random number so it is shown to be alive
|
||||
$stmt="UPDATE vicidial_live_agents set random_id='$random' where user='$user' and server_ip='$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03009',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$retry_count=0;
|
||||
while ( ($errno > 0) and ($retry_count < 5) )
|
||||
{
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$one_mysql_log=1;
|
||||
$errno = mysql_error_logging($NOW_TIME,$link,$mel,$stmt,"9309$retry_count",$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$one_mysql_log=0;
|
||||
$retry_count++;
|
||||
}
|
||||
}
|
||||
|
||||
### grab the API hangup and API dispo fields in vicidial_live_agents
|
||||
$stmt="SELECT external_hangup,external_status,external_pause,external_dial,external_update_fields,external_update_fields_data,external_timer_action,external_timer_action_message,external_timer_action_seconds from vicidial_live_agents where user='$user' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03010',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_hangup = $row[0];
|
||||
$external_status = $row[1];
|
||||
$external_pause = $row[2];
|
||||
$external_dial = $row[3];
|
||||
$external_update_fields = $row[4];
|
||||
$external_update_fields_data = $row[5];
|
||||
$timer_action = $row[6];
|
||||
$timer_action_message = $row[7];
|
||||
$timer_action_seconds = $row[8];
|
||||
|
||||
if (strlen($external_status)<1) {$external_status = '::::::::::';}
|
||||
|
||||
$web_epoch = date("U");
|
||||
$stmt="SELECT UNIX_TIMESTAMP(last_update),UNIX_TIMESTAMP(db_time) from server_updater where server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03014',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$server_epoch = $row[0];
|
||||
$db_epoch = $row[1];
|
||||
$time_diff = ($server_epoch - $db_epoch);
|
||||
$web_diff = ($db_epoch - $web_epoch);
|
||||
|
||||
##### check for in-group change details
|
||||
$InGroupChangeDetails = '0|||';
|
||||
$manager_ingroup_set=0;
|
||||
$stmt="SELECT count(*) FROM vicidial_live_agents where user='$user' and manager_ingroup_set='SET';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03022',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mis_record_ct = mysql_num_rows($rslt);
|
||||
if ($mis_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$manager_ingroup_set = $row[0];
|
||||
}
|
||||
if ($manager_ingroup_set > 0)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET closer_campaigns=external_ingroups, manager_ingroup_set='Y' where user='$user' and manager_ingroup_set='SET';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03023',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMISaffected_rows_update = mysql_affected_rows($link);
|
||||
if ($VLAMISaffected_rows_update > 0)
|
||||
{
|
||||
$stmt="SELECT external_ingroups,external_blended,external_igb_set_user,outbound_autodial,dial_method FROM vicidial_live_agents vla, vicidial_campaigns vc where user='$user' and manager_ingroup_set='Y' and vla.campaign_id=vc.campaign_id;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03024',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$migs_record_ct = mysql_num_rows($rslt);
|
||||
if ($migs_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_ingroups = $row[0];
|
||||
$external_blended = $row[1];
|
||||
$external_igb_set_user = $row[2];
|
||||
$outbound_autodial = $row[3];
|
||||
$dial_method = $row[4];
|
||||
|
||||
$stmt="SELECT full_name FROM vicidial_users where user='$external_igb_set_user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03025',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$mign_record_ct = mysql_num_rows($rslt);
|
||||
if ($mign_record_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$external_igb_set_name = $row[0];
|
||||
}
|
||||
|
||||
$NEWoutbound_autodial='N';
|
||||
if ( ($external_blended > 0) and ($dial_method != "INBOUND_MAN") and ($dial_method != "MANUAL") )
|
||||
{$NEWoutbound_autodial='Y';}
|
||||
|
||||
$stmt="UPDATE vicidial_live_agents SET outbound_autodial='$NEWoutbound_autodial' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03026',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAMIBaffected_rows_update = mysql_affected_rows($link);
|
||||
|
||||
$InGroupChangeDetails = "1|$external_blended|$external_igb_set_user|$external_igb_set_name";
|
||||
|
||||
$stmt="INSERT INTO vicidial_user_closer_log set user='$user',campaign_id='$Acampaign_id',event_date='$NOW_TIME',blended='$external_blended',closer_campaigns='$external_ingroups',manager_change='$external_igb_set_user';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03027',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
##### grab the shift information the agent
|
||||
$stmt="SELECT user_group,agent_shift_enforcement_override from vicidial_users where user='$user';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03015',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$VU_user_group = $row[0];
|
||||
$VU_agent_shift_enforcement_override = $row[1];
|
||||
|
||||
### Gather timeclock and shift enforcement restriction settings
|
||||
$stmt="SELECT shift_enforcement,group_shifts from vicidial_user_groups where user_group='$VU_user_group';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03016',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$shift_enforcement = $row[0];
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ','',$row[1]);
|
||||
$LOGgroup_shiftsSQL = eregi_replace(' ',"','",$LOGgroup_shiftsSQL);
|
||||
$LOGgroup_shiftsSQL = "shift_id IN('$LOGgroup_shiftsSQL')";
|
||||
|
||||
### CHECK TO SEE IF AGENT IS WITHIN THEIR SHIFT IF RESTRICTED, IF NOT, OUTPUT ERROR
|
||||
$Ashift_logout=0;
|
||||
if ( ( (ereg("ALL",$shift_enforcement)) and (!ereg("OFF|START",$VU_agent_shift_enforcement_override)) ) or (ereg("ALL",$VU_agent_shift_enforcement_override)) )
|
||||
{
|
||||
$shift_ok=0;
|
||||
if (strlen($LOGgroup_shiftsSQL) < 3)
|
||||
{$Ashift_logout++;}
|
||||
else
|
||||
{
|
||||
$HHMM = date("Hi");
|
||||
$wday = date("w");
|
||||
|
||||
$stmt="SELECT shift_id,shift_start_time,shift_length,shift_weekdays from vicidial_shifts where $LOGgroup_shiftsSQL order by shift_id";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'3017',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
$shifts_to_print = mysql_num_rows($rslt);
|
||||
|
||||
$o=0;
|
||||
while ( ($shifts_to_print > $o) and ($shift_ok < 1) )
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$shift_id = $rowx[0];
|
||||
$shift_start_time = $rowx[1];
|
||||
$shift_length = $rowx[2];
|
||||
$shift_weekdays = $rowx[3];
|
||||
|
||||
if (eregi("$wday",$shift_weekdays))
|
||||
{
|
||||
$HHshift_length = substr($shift_length,0,2);
|
||||
$MMshift_length = substr($shift_length,3,2);
|
||||
$HHshift_start_time = substr($shift_start_time,0,2);
|
||||
$MMshift_start_time = substr($shift_start_time,2,2);
|
||||
$HHshift_end_time = ($HHshift_length + $HHshift_start_time);
|
||||
$MMshift_end_time = ($MMshift_length + $MMshift_start_time);
|
||||
if ($MMshift_end_time > 59)
|
||||
{
|
||||
$MMshift_end_time = ($MMshift_end_time - 60);
|
||||
$HHshift_end_time++;
|
||||
}
|
||||
if ($HHshift_end_time > 23)
|
||||
{$HHshift_end_time = ($HHshift_end_time - 24);}
|
||||
$HHshift_end_time = sprintf("%02s", $HHshift_end_time);
|
||||
$MMshift_end_time = sprintf("%02s", $MMshift_end_time);
|
||||
$shift_end_time = "$HHshift_end_time$MMshift_end_time";
|
||||
|
||||
if (
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM < $shift_end_time) ) or
|
||||
( ($HHMM < $shift_start_time) and ($HHMM < $shift_end_time) and ($shift_end_time <= $shift_start_time) ) or
|
||||
( ($HHMM >= $shift_start_time) and ($HHMM >= $shift_end_time) and ($shift_end_time <= $shift_start_time) )
|
||||
)
|
||||
{$shift_ok++;}
|
||||
}
|
||||
$o++;
|
||||
}
|
||||
|
||||
if ($shift_ok < 1)
|
||||
{$Ashift_logout++;}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( ( ($time_diff > 8) or ($time_diff < -8) or ($web_diff > 8) or ($web_diff < -8) ) and (eregi("0$",$StarTtime)) )
|
||||
{$Alogin='TIME_SYNC';}
|
||||
if ($Acount < 1)
|
||||
{$Alogin='DEAD_VLA';}
|
||||
if ($AexternalDEAD > 0)
|
||||
{$Alogin='DEAD_EXTERNAL';}
|
||||
if ($Ashift_logout > 0)
|
||||
{$Alogin='SHIFT_UITLOGGEN';}
|
||||
|
||||
echo 'DateTime: ' . $NOW_TIME . '|UnixTime: ' . $StarTtime . '|Logged-in: ' . $Alogin . '|CampCalls: ' . $RingCalls . '|Status: ' . $Astatus . '|DiaLCalls: ' . $DiaLCalls . '|APIHanguP: ' . $external_hangup . '|APIStatuS: ' . $external_status . '|APIPausE: ' . $external_pause . '|APIDiaL: ' . $external_dial . '|DEADcall: ' . $DEADcustomer . '|InGroupChange: ' . $InGroupChangeDetails . '|APIFields: ' . $external_update_fields . '|APIFieldsData: ' . $external_update_fields_data . '|APITimerAction: ' . $timer_action . '|APITimerMessage: ' . $timer_action_message . '|APITimerSeconds: ' . $timer_action_seconds . "\n";
|
||||
|
||||
if (strlen($timer_action) > 3)
|
||||
{
|
||||
$stmt="UPDATE vicidial_live_agents SET external_timer_action='' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03028',$VD_login,$server_ip,$session_name,$one_mysql_log);}
|
||||
$VLAETAaffected_rows_update = mysql_affected_rows($link);
|
||||
}
|
||||
}
|
||||
$total_conf=0;
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03011',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$sip_list = mysql_num_rows($rslt);}
|
||||
# echo "$sip_list|";
|
||||
$loop_count=0;
|
||||
while ($sip_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$KanaalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and extension = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03012',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
# echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++; $total_conf++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$KanaalA[$total_conf] = "$row[0]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] -->";}
|
||||
}
|
||||
}
|
||||
$channels_list = ($channels_list + $sip_list);
|
||||
echo "$channels_list|";
|
||||
|
||||
$counter=0;
|
||||
$countecho='';
|
||||
while($total_conf > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$countecho = "$countecho$KanaalA[$counter] ~";
|
||||
# echo "$KanaalA[$counter] ~";
|
||||
}
|
||||
|
||||
echo "$countecho\n";
|
||||
}
|
||||
|
||||
if ($ACTION == 'register')
|
||||
{
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($conf_exten)<1) || (strlen($exten)<1) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Conf Exten $conf_exten is niet geldig or Exten $exten is niet geldig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="UPDATE conferences set extension='$exten' where server_ip = '$server_ip' and conf_exten = '$conf_exten';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'03013',$user,$server_ip,$session_name,$one_mysql_log);}
|
||||
}
|
||||
echo "Conferentie
|
||||
$conf_exten is geregistreer aan $exten\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimeseconden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
|
||||
##### MySQL Error Logging #####
|
||||
function mysql_error_logging($NOW_TIME,$link,$mel,$stmt,$query_id,$user,$server_ip,$session_name,$one_mysql_log)
|
||||
{
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
# mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00001',$user,$server_ip,$session_name,$one_mysql_log);
|
||||
$errno=''; $error='';
|
||||
if ( ($mel > 0) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$errno = mysql_errno($link);
|
||||
if ( ($errno > 0) or ($mel > 1) or ($one_mysql_log > 0) )
|
||||
{
|
||||
$error = mysql_error($link);
|
||||
$efp = fopen ("./vicidial_mysql_errors.txt", "a");
|
||||
fwrite ($efp, "$NOW_TIME|conf_check |$query_id|$errno|$error|$stmt|$user|$server_ip|$session_name|\n");
|
||||
fclose($efp);
|
||||
}
|
||||
}
|
||||
$one_mysql_log=0;
|
||||
return $errno;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
#
|
||||
# dbconnect.php version 2.2.0
|
||||
#
|
||||
# database connection settings and some global web settings
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
if ( file_exists("/etc/astguiclient.conf") )
|
||||
{
|
||||
$DBCagc = file("/etc/astguiclient.conf");
|
||||
foreach ($DBCagc as $DBCline)
|
||||
{
|
||||
$DBCline = preg_replace("/ |>|\n|\r|\t|\#.*|;.*/","",$DBCline);
|
||||
if (ereg("^PATHlogs", $DBCline))
|
||||
{$PATHlogs = $DBCline; $PATHlogs = preg_replace("/.*=/","",$PATHlogs);}
|
||||
if (ereg("^PATHweb", $DBCline))
|
||||
{$WeBServeRRooT = $DBCline; $WeBServeRRooT = preg_replace("/.*=/","",$WeBServeRRooT);}
|
||||
if (ereg("^VARDB_server", $DBCline))
|
||||
{$VARDB_server = $DBCline; $VARDB_server = preg_replace("/.*=/","",$VARDB_server);}
|
||||
if (ereg("^VARDB_database", $DBCline))
|
||||
{$VARDB_database = $DBCline; $VARDB_database = preg_replace("/.*=/","",$VARDB_database);}
|
||||
if (ereg("^VARDB_user", $DBCline))
|
||||
{$VARDB_user = $DBCline; $VARDB_user = preg_replace("/.*=/","",$VARDB_user);}
|
||||
if (ereg("^VARDB_pass", $DBCline))
|
||||
{$VARDB_pass = $DBCline; $VARDB_pass = preg_replace("/.*=/","",$VARDB_pass);}
|
||||
if (ereg("^VARDB_port", $DBCline))
|
||||
{$VARDB_port = $DBCline; $VARDB_port = preg_replace("/.*=/","",$VARDB_port);}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
#defaults for DB connection
|
||||
$VARDB_server = 'localhost';
|
||||
$VARDB_user = 'cron';
|
||||
$VARDB_pass = '1234';
|
||||
$VARDB_database = '1234';
|
||||
$WeBServeRRooT = '/usr/local/apache2/htdocs';
|
||||
}
|
||||
|
||||
$link=mysql_connect("$VARDB_server", "$VARDB_user", "$VARDB_pass");
|
||||
if (!$link) {
|
||||
die('MySQL connect ERROR: ' . mysql_error());
|
||||
}
|
||||
mysql_select_db("$VARDB_database",$link);
|
||||
|
||||
$local_DEF = 'Local/';
|
||||
$conf_silent_prefix = '7';
|
||||
$local_AMP = '@';
|
||||
$ext_context = 'demo';
|
||||
$recording_exten = '8309';
|
||||
$WeBRooTWritablE = '1';
|
||||
$non_latin = '0'; # set to 1 for UTF rules, overridden by system_settings
|
||||
$flag_channels=0;
|
||||
$flag_string = 'VICIast20';
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,352 @@
|
||||
<?php
|
||||
# inbound_popup.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed to open up when a live_inbound call comes in giving the user
|
||||
# options of what to do with the call or options to lookup the callerID on various web sites
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $uniqueid - ('1234567890.123456',...)
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $ext_context - ('default','demo',...)
|
||||
# - $ext_priority - ('1','2',...)
|
||||
# - $voicemail_dump_exten - ('85026666666666')
|
||||
# - $local_web_callerID_URL_enc - ( rawurlencoded custom callerid lookup URL)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50428-1500 - First build of script display only
|
||||
# 50429-1241 - some formatting, hangup and Vmail redirect, 30s timeout on actions, and CID web lookup links
|
||||
# 50503-1244 - added session_name checking for extra security
|
||||
# 50711-1203 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1043 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
if (isset($_GET["ext_context"])) {$ext_context=$_GET["ext_context"];}
|
||||
elseif (isset($_POST["ext_context"])) {$ext_context=$_POST["ext_context"];}
|
||||
if (isset($_GET["ext_priority"])) {$ext_priority=$_GET["ext_priority"];}
|
||||
elseif (isset($_POST["ext_priority"])) {$ext_priority=$_POST["ext_priority"];}
|
||||
if (isset($_GET["voicemail_dump_exten"])) {$voicemail_dump_exten=$_GET["voicemail_dump_exten"];}
|
||||
elseif (isset($_POST["voicemail_dump_exten"])) {$voicemail_dump_exten=$_POST["voicemail_dump_exten"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_GET["local_web_callerID_URL_enc"];}
|
||||
elseif (isset($_POST["local_web_callerID_URL_enc"])) {$local_web_callerID_URL_enc=$_POST["local_web_callerID_URL_enc"];}
|
||||
if (isset($_GET["local_web_callerID_URL_enc"])) {$local_web_callerID_URL = rawurldecode($local_web_callerID_URL_enc);}
|
||||
else {$local_web_callerID_URL = '';}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.6';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
$DO = '-1';
|
||||
if ( (eregi("^Zap",$channel)) and (!eregi("-",$channel)) ) {$channel = "$channel$DO";}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Foutief Gebruikersnaam/Wachtwoord: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Foutief server_ip: |$server_ip| or Foutief session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Foutief session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$forever_stop=0;
|
||||
$user_abb = "$user$user$user$user";
|
||||
while ( (strlen($user_abb) > 4) and ($forever_stop < 200) )
|
||||
{$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;}
|
||||
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIE: $version BUILD: $build UNIQUEID: $uniqueid server_ip: $server_ip-->\n";
|
||||
?>
|
||||
<script language="Javascript">
|
||||
var server_ip = '<?php echo $server_ip ?>';
|
||||
var epoch_sec = '<?php echo $StarTtime ?>';
|
||||
var user_abb = '<?php echo $user_abb ?>';
|
||||
var vmail_box = '<?php echo $vmail_box ?>';
|
||||
var ext_context = '<?php echo $ext_context ?>';
|
||||
var ext_priority = '<?php echo $ext_priority ?>';
|
||||
var voicemail_dump_exten = '<?php echo $voicemail_dump_exten ?>';
|
||||
var session_name = '<?php echo $session_name ?>';
|
||||
var user = '<?php echo $user ?>';
|
||||
var pass = '<?php echo $pass ?>';
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Hangup command for Live call connected to phone now to Manager
|
||||
function livehangup_send_hangup(taskvar)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "HLagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
livehangup_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Hangup&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(livehangup_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// Send Redirect command for ringing call to go directly to your voicemail
|
||||
function liveredirect_send_vmail(taskvar,taskbox)
|
||||
{
|
||||
var xmlhttp=false;
|
||||
/*@cc_on @*/
|
||||
/*@if (@_jscript_version >= 5)
|
||||
// JScript gives us Conditional compilation, we can cope with old IE versions.
|
||||
// and security blocked creation of the objects.
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
|
||||
} catch (e) {
|
||||
try {
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
} catch (E) {
|
||||
xmlhttp = false;
|
||||
}
|
||||
}
|
||||
@end @*/
|
||||
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
|
||||
{
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
}
|
||||
if (xmlhttp)
|
||||
{
|
||||
var queryCID = "RVagcP" + epoch_sec + user_abb;
|
||||
var hangupvalue = taskvar;
|
||||
var mailboxvalue = taskbox;
|
||||
liveredirect_query = "server_ip=" + server_ip + "&session_name=" + session_name + "&user=" + user + "&pass=" + pass + "&ACTION=Redirect&format=text&channel=" + hangupvalue + "&queryCID=" + queryCID + "&exten=" + voicemail_dump_exten + "" + mailboxvalue + "&ext_context=" + ext_context + "&ext_priority=" + ext_priority;
|
||||
xmlhttp.open('POST', 'manager_send.php');
|
||||
xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8');
|
||||
xmlhttp.send(liveredirect_query);
|
||||
xmlhttp.onreadystatechange = function()
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
|
||||
{
|
||||
Nactiveext = null;
|
||||
Nactiveext = xmlhttp.responseText;
|
||||
alert(xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
delete xmlhttp;
|
||||
}
|
||||
call_action_link_clear();
|
||||
}
|
||||
|
||||
|
||||
// ################################################################################
|
||||
// timeout to deactivate the call action links after 30seconden
|
||||
function link_timeout()
|
||||
{
|
||||
window.focus();
|
||||
setTimeout("call_action_link_clear()", 30000);
|
||||
}
|
||||
|
||||
// ################################################################################
|
||||
// deactivates the call action links
|
||||
function call_action_link_clear()
|
||||
{
|
||||
document.getElementById("callactions").innerHTML = "";
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo "<title>LIVE BINNENKOMEND GESPREK";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=\"#CCC2E0\" marginheight=0 marginwidth=0 leftmargin=0 topmargin=0 onload=\"link_timeout();\">\n";
|
||||
echo "<CENTER><H2>LIVE BINNENKOMEND GESPREK</H2>\n";
|
||||
echo "<B>$NOW_TIME</B><BR><BR>\n";
|
||||
}
|
||||
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if (strlen($uniqueid)<9)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Uniqueid $uniqueid is niet geldig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT uniqueid,channel,server_ip,caller_id,extension,phone_ext,start_time,acknowledged,inbound_number,comment_a,comment_b,comment_c,comment_d,comment_e FROM live_inbound where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$channels_list = mysql_num_rows($rslt);
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
# echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
# Zap/73|"V.I.C.I. MARKET" <7275338730>|2005-04-28 14:01:21|7274514936|Inbound direct to Matt|||||
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
echo "<table width=95% cellpadding=1 cellspacing=3>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Kanaal: </td><td align=left>$row[1]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>CallerID: </td><td align=left>$row[3]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n";
|
||||
|
||||
$phone = eregi_replace(".*\<","",$row[3]);
|
||||
$phone = eregi_replace("\>.*","",$phone);
|
||||
$NPA = substr($phone, 0, 3);
|
||||
$NXX = substr($phone, 3, 3);
|
||||
$XXXX = substr($phone, 6, 4);
|
||||
$D='-';
|
||||
echo "<a href=\"http://www.google.com/search?hl=en&lr=&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial_s&q=$NPA+$NXX+$XXXX&btnG=Search\" target=\"_blank\">GOOGLE</a> - \n";
|
||||
echo "<a href=\"http://www.anywho.com/qry/wp_rl?npa=$NPA&telephone=$NXX$XXXX\" target=\"_blank\">ANYWHO</a> - \n";
|
||||
echo "<a href=\"http://www.switchboard.com/bin/cgirlookup.dll?SR=&MEM=1&LNK=32%3A36&type=BOTH&at=$NPA&e=$NXX&n=$XXXX&search.x=55&search.y=20\" target=\"_blank\">SWITCHBOARD</a> - \n";
|
||||
echo "<a href=\"http://yellowpages.superpages.com/listings.jsp?SRC=&STYPE=&PG=L&CB=&C=&N=&E=&T=&S=&Z=&A=727&X=533&P=8730&AXP=$NPA$NXX$XXXX&R=N&PS=15&search=Find+It\" target=\"_blank\">VERIZON</a> - \n";
|
||||
echo "<a href=\"http://www.whitepages.com/1014/log_click/search/Reverse_Telefoon?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">WHITEPAGES</a> - \n";
|
||||
echo "<a href=\"http://www.411.com/10742/search/Reverse_Telefoon?phone=%28$NPA%29+$NXX$D$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
echo "<a href=\"http://www.phonenumber.com/10006/search/Reverse_Telefoon?npa=$NPA&phone=$NXX$XXXX\" target=\"_blank\">411.COM</a> - \n";
|
||||
|
||||
$local_web_callerID_QUERY_STRING ='';
|
||||
$local_web_callerID_QUERY_STRING.="?callerID_areacode=$NPA";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_prefix=$NXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_last4=$XXXX";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Time=$row[6]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_Kanaal=$row[1]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_uniqueID=$row[0]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_phone_ext=$row[5]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_server_ip=$row[2]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_extension=$row[4]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_inbound_number=$row[8]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_a=$row[9]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_b=$row[10]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_c=$row[11]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_d=$row[12]";
|
||||
$local_web_callerID_QUERY_STRING.="&callerID_comment_e=$row[13]";
|
||||
echo "<a href=\"$local_web_callerID_URL$local_web_callerID_QUERY_STRING\" target=\"_blank\">CUSTOM</a> - \n";
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Nummer Gedraaid: </td><td align=left>$row[8]</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td>Opmerkingen: </td><td align=left>$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|</td></tr>\n";
|
||||
echo "<tr bgcolor=\"#DDDDFF\"><td colspan=2 align=center>\n<span id=\"callactions\">";
|
||||
echo "<a href=\"#\" onclick=\"livehangup_send_hangup('$row[1]');return false;\">OPHANGEN</a> - \n";
|
||||
echo "<a href=\"#\" onclick=\"liveredirect_send_vmail('$row[1]','$vmail_box');return false;\">STUUR NAAR MIJN VOICEMAIL</a>\n";
|
||||
echo "</span></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
|
||||
|
||||
$stmt="UPDATE live_inbound set acknowledged='Y' where server_ip = '$server_ip' and uniqueid = '$uniqueid';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimeseconden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,279 @@
|
||||
<?php
|
||||
# live_exten_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send whether the client channel is live and to what channel it is connected
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50404-1249 - First build of script
|
||||
# 50406-1402 - added connected trunk lookup
|
||||
# 50428-1452 - added live_inbound check for exten on 2nd line of output
|
||||
# 50503-1233 - added session_name checking for extra security
|
||||
# 50524-1429 - added parked calls count
|
||||
# 50610-1204 - Added NULL check on MySQL results to reduced errors
|
||||
# 50711-1204 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60103-1541 - added favorite extens status display
|
||||
# 60421-1359 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1203 - Added variable filters to close security holes for login form
|
||||
# 60825-1029 - Fixed translation variable issue ChannelA
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
if (isset($_GET["favorites_count"])) {$favorites_count=$_GET["favorites_count"];}
|
||||
elseif (isset($_POST["favorites_count"])) {$favorites_count=$_POST["favorites_count"];}
|
||||
if (isset($_GET["favorites_list"])) {$favorites_list=$_GET["favorites_list"];}
|
||||
elseif (isset($_POST["favorites_list"])) {$favorites_list=$_POST["favorites_list"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '2.0.1';
|
||||
$build = '60825-1029';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Foutief Gebruikersnaam/Wachtwoord: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Foutief server_ip: |$server_ip| or Foutief session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Foutief session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIE: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>LIve Extentie Controle";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
echo "DateTime: $NOW_TIME|";
|
||||
echo "UnixTime: $StarTtime|";
|
||||
|
||||
$stmt="SELECT count(*) FROM parked_channels where server_ip = '$server_ip';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|";
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten is niet geldig of protocol $protocol is niet geldig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel,extension FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$protocol/$exten%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
echo "$channels_list|";
|
||||
$loop_count=0;
|
||||
while ($channels_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$ChanneLA[$loop_count] = "$row[0]";
|
||||
$ChanneLB[$loop_count] = "$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
$counter=0;
|
||||
while($loop_count > $counter)
|
||||
{
|
||||
$counter++;
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanaalA: $ChanneLA[$counter] ~";
|
||||
echo "KanaalB: $ChanneLB[$counter] ~";
|
||||
echo "KanaalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel_data = '$ChanneLA[$counter]';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanaalA: $ChanneLA[$counter] ~";
|
||||
echo "KanaalB: $ChanneLB[$counter] ~";
|
||||
echo "KanaalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanaalA: $ChanneLA[$counter] ~";
|
||||
echo "KanaalB: $ChanneLB[$counter] ~";
|
||||
echo "KanaalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT channel FROM live_channels where server_ip = '$server_ip' and channel LIKE \"$ChanneLB[$counter]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$trunk_count = mysql_num_rows($rslt);}
|
||||
if ($trunk_count>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanaalA: $ChanneLA[$counter] ~";
|
||||
echo "KanaalB: $ChanneLB[$counter] ~";
|
||||
echo "KanaalBtrunk: $row[0]|";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Conversation: $counter ~";
|
||||
echo "KanaalA: $ChanneLA[$counter] ~";
|
||||
echo "KanaalB: $ChanneLB[$counter] ~";
|
||||
echo "KanaalBtrunk: $ChanneLA[$counter]|";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
### check for live_inbound entry
|
||||
$stmt="select * from live_inbound where server_ip = '$server_ip' and phone_ext = '$exten' and acknowledged='N';";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($rslt) {$channels_list = mysql_num_rows($rslt);}
|
||||
if ($channels_list>0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$LIuniqueid = "$row[0]";
|
||||
$LIchannel = "$row[1]";
|
||||
$LIcallerid = "$row[3]";
|
||||
$LIdatetime = "$row[6]";
|
||||
echo "$LIuniqueid|$LIchannel|$LIcallerid|$LIdatetime|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]|";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0]|$row[1]|$row[2]|$row[3]|$row[4]|$row[5]|$row[6]|$row[7]|$row[8]|$row[9]|$row[10]|$row[11]|$row[12]|$row[13]| -->";}
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
|
||||
|
||||
### if favorites are present do a lookup to see if any are active
|
||||
if ($favorites_count > 0)
|
||||
{
|
||||
$favorites = explode(',',$favorites_list);
|
||||
$h=0;
|
||||
$favs_print='';
|
||||
while ($favorites_count > $h)
|
||||
{
|
||||
$fav_extension = explode('/',$favorites[$h]);
|
||||
$stmt="SELECT count(*) FROM live_sip_channels where server_ip = '$server_ip' and channel LIKE \"$favorites[$h]%\";";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$favs_print .= "$fav_extension[1]: $row[0] ~";
|
||||
$h++;
|
||||
}
|
||||
echo "$favs_print\n";
|
||||
}
|
||||
|
||||
if ($format=='debug') {echo "\n<!-- |$favorites_count|$favorites_list| -->";}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimeseconden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
# park_calls_display.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to send the details on the parked calls on the server
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $exten - ('cc101','testphone','49-1','1234','913125551212',...)
|
||||
# - $protocol - ('SIP','Zap','IAX2',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50524-1515 - First build of script
|
||||
# 50711-1208 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1111 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1205 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["exten"])) {$exten=$_GET["exten"];}
|
||||
elseif (isset($_POST["exten"])) {$exten=$_POST["exten"];}
|
||||
if (isset($_GET["protocol"])) {$protocol=$_GET["protocol"];}
|
||||
elseif (isset($_POST["protocol"])) {$protocol=$_POST["protocol"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if (!isset($park_limit)) {$park_limit="1000";}
|
||||
|
||||
$version = '0.0.4';
|
||||
$build = '60619-1205';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0) )
|
||||
{
|
||||
echo "Foutief Gebruikersnaam/Wachtwoord: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) ) {
|
||||
echo "Foutief server_ip: |$server_ip| or Foutief session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Foutief session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIE: $version BUILD: $build EXTEN: $exten server_ip: $server_ip-->\n";
|
||||
echo "<title>Geparkeerde Gesprekken Tonen";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
|
||||
$row=''; $rowx='';
|
||||
$channel_live=1;
|
||||
if ( (strlen($exten)<1) or (strlen($protocol)<3) )
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Exten $exten is niet geldig of protocol $protocol is niet geldig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
##### print parked calls from the parked_channels table
|
||||
$stmt="SELECT channel,server_ip,channel_group,extension,parked_by,parked_time from parked_channels where server_ip = '$server_ip' order by parked_time limit $park_limit;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$park_calls_count = mysql_num_rows($rslt);
|
||||
echo "$park_calls_count\n";
|
||||
$loop_count=0;
|
||||
while ($park_calls_count>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0] ~$row[2] ~$row[3] ~$row[4] ~$row[5]|";
|
||||
}
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimeseconden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
@@ -0,0 +1,456 @@
|
||||
<?php
|
||||
# timeclock.php - VICIDIAL system user timeclock
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGELOG
|
||||
# 80523-0134 - First Build
|
||||
# 80524-0225 - Changed event_date to DATETIME, added timestamp field and tcid_link field
|
||||
# 80525-2351 - Added an audit log that is not to be editable
|
||||
# 80602-0641 - Fixed status update bug
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
$version = '2.2.0-5';
|
||||
$build = '90508-0727';
|
||||
|
||||
$StarTtimE = date("U");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$last_action_date = $NOW_TIME;
|
||||
|
||||
$US='_';
|
||||
$CL=':';
|
||||
$AT='@';
|
||||
$DS='-';
|
||||
$date = date("r");
|
||||
$ip = getenv("REMOTE_ADDR");
|
||||
$browser = getenv("HTTP_USER_AGENT");
|
||||
$script_name = getenv("SCRIPT_NAME");
|
||||
$server_name = getenv("SERVER_NAME");
|
||||
$server_port = getenv("SERVER_PORT");
|
||||
if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';}
|
||||
else {$HTTPprotocol = 'http://';}
|
||||
if (($server_port == '80') or ($server_port == '443') ) {$server_port='';}
|
||||
else {$server_port = "$CL$server_port";}
|
||||
$agcPAGE = "$HTTPprotocol$server_name$server_port$script_name";
|
||||
$agcDIR = eregi_replace('timeclock.php','',$agcPAGE);
|
||||
|
||||
|
||||
if (isset($_GET["DB"])) {$DB=$_GET["DB"];}
|
||||
elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["VD_login"])) {$VD_login=$_GET["VD_login"];}
|
||||
elseif (isset($_POST["VD_login"])) {$VD_login=$_POST["VD_login"];}
|
||||
if (isset($_GET["VD_pass"])) {$VD_pass=$_GET["VD_pass"];}
|
||||
elseif (isset($_POST["VD_pass"])) {$VD_pass=$_POST["VD_pass"];}
|
||||
if (isset($_GET["VD_campaign"])) {$VD_campaign=$_GET["VD_campaign"];}
|
||||
elseif (isset($_POST["VD_campaign"])) {$VD_campaign=$_POST["VD_campaign"];}
|
||||
if (isset($_GET["stage"])) {$stage=$_GET["stage"];}
|
||||
elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];}
|
||||
if (isset($_GET["commit"])) {$commit=$_GET["commit"];}
|
||||
elseif (isset($_POST["commit"])) {$commit=$_POST["commit"];}
|
||||
if (isset($_GET["referrer"])) {$referrer=$_GET["referrer"];}
|
||||
elseif (isset($_POST["referrer"])) {$referrer=$_POST["referrer"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
|
||||
if (!isset($phone_login))
|
||||
{
|
||||
if (isset($_GET["pl"])) {$phone_login=$_GET["pl"];}
|
||||
elseif (isset($_POST["pl"])) {$phone_login=$_POST["pl"];}
|
||||
}
|
||||
if (!isset($phone_pass))
|
||||
{
|
||||
if (isset($_GET["pp"])) {$phone_pass=$_GET["pp"];}
|
||||
elseif (isset($_POST["pp"])) {$phone_pass=$_POST["pp"];}
|
||||
}
|
||||
|
||||
### security strip all non-alphanumeric characters out of the variables ###
|
||||
$DB=ereg_replace("[^0-9a-z]","",$DB);
|
||||
$phone_login=ereg_replace("[^\,0-9a-zA-Z]","",$phone_login);
|
||||
$phone_pass=ereg_replace("[^0-9a-zA-Z]","",$phone_pass);
|
||||
$VD_login=ereg_replace("[^0-9a-zA-Z]","",$VD_login);
|
||||
$VD_pass=ereg_replace("[^0-9a-zA-Z]","",$VD_pass);
|
||||
$VD_campaign=ereg_replace("[^0-9a-zA-Z_]","",$VD_campaign);
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
$stage=ereg_replace("[^0-9a-zA-Z]","",$stage);
|
||||
$commit=ereg_replace("[^0-9a-zA-Z]","",$commit);
|
||||
$referrer=ereg_replace("[^0-9a-zA-Z]","",$referrer);
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,admin_home_url FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
$i=0;
|
||||
while ($i < $qm_conf_ct)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$welcomeURL = $row[1];
|
||||
$i++;
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
if ( ($stage == 'login') or ($stage == 'logout') )
|
||||
{
|
||||
### see if user/pass exist for this user in vicidial_users table
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$valid_user=$row[0];
|
||||
print "<!-- vicidial_users active count for $user: |$valid_user| -->\n";
|
||||
|
||||
if ($valid_user < 1)
|
||||
{
|
||||
### NOT A VALID USER/PASS
|
||||
$VDdisplayMESSAGE = "De gebruiker en wachtwoord die je hebt ingevoerd zijn niet actief in het systeem<BR>Probeer aub nogmaals:";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Tijdslot</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Tijdslot </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Gebruiker Inloggen: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Gebruiker Wachtwoord: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=OPSLAAN VALUE=OPSLAAN> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
### VALID USER/PASS, CONTINUE
|
||||
|
||||
### get name and group for this user
|
||||
$stmt="SELECT full_name,user_group from vicidial_users where user='$user' and pass='$pass';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$full_name = $row[0];
|
||||
$user_group = $row[1];
|
||||
print "<!-- vicidial_users name and group for $user: |$full_name|$user_group| -->\n";
|
||||
|
||||
### get vicidial_timeclock_status record count for this user
|
||||
$stmt="SELECT count(*) from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$vts_count = $row[0];
|
||||
|
||||
$last_action_sec=99;
|
||||
|
||||
if ($vts_count > 0)
|
||||
{
|
||||
### vicidial_timeclock_status record found, grab status and date of last activity
|
||||
$stmt="SELECT status,event_epoch from vicidial_timeclock_status where user='$user';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$status = $row[0];
|
||||
$event_epoch = $row[1];
|
||||
$last_action_date = date("Y-m-d H:i:s", $event_epoch);
|
||||
$last_action_sec = ($StarTtimE - $event_epoch);
|
||||
if ($last_action_sec > 0)
|
||||
{
|
||||
$totTIME_H = ($last_action_sec / 3600);
|
||||
$totTIME_H_int = round($totTIME_H, 2);
|
||||
$totTIME_H_int = intval("$totTIME_H");
|
||||
$totTIME_M = ($totTIME_H - $totTIME_H_int);
|
||||
$totTIME_M = ($totTIME_M * 60);
|
||||
$totTIME_M_int = round($totTIME_M, 2);
|
||||
$totTIME_M_int = intval("$totTIME_M");
|
||||
$totTIME_S = ($totTIME_M - $totTIME_M_int);
|
||||
$totTIME_S = ($totTIME_S * 60);
|
||||
$totTIME_S = round($totTIME_S, 0);
|
||||
if (strlen($totTIME_H_int) < 1) {$totTIME_H_int = "0";}
|
||||
if ($totTIME_M_int < 10) {$totTIME_M_int = "0$totTIME_M_int";}
|
||||
if ($totTIME_S < 10) {$totTIME_S = "0$totTIME_S";}
|
||||
$totTIME_HMS = "$totTIME_H_int:$totTIME_M_int:$totTIME_S";
|
||||
}
|
||||
else
|
||||
{
|
||||
$totTIME_HMS='0:00:00';
|
||||
}
|
||||
|
||||
print "<!-- vicidial_timeclock_status previous status for $user: |$status|$event_epoch|$last_action_sec| -->\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
### No vicidial_timeclock_status record found, insert one
|
||||
$stmt="INSERT INTO vicidial_timeclock_status set status='START', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$status='START';
|
||||
$totTIME_HMS='0:00:00';
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NIEUW vicidial_timeclock_status record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
if ( ($last_action_sec < 30) and ($status != 'START') )
|
||||
{
|
||||
### You cannot log in or out within 30seconden of your last login/logout
|
||||
$VDdisplayMESSAGE = "Je kunt niet inloggen binnen 30 seconden na je laatste login of log-uit";
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Tijdslot</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Tijdslot </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Gebruiker Inloggen: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Gebruiker Wachtwoord: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=OPSLAAN VALUE=OPSLAAN> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($commit == 'YES')
|
||||
{
|
||||
if ( ( ($status=='AUTOUITLOGGEN') or ($status=='START') or ($status=='UITLOGGEN') ) and ($stage=='login') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "You have now logged-in";
|
||||
$LOGtimeMESSAGE = "You logged in at $NOW_TIME";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NIEUW vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='LOGIN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='LOGIN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NIEUW vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ($status=='LOGIN') and ($stage=='logout') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Je ben nu uitgelogd";
|
||||
$LOGtimeMESSAGE = "Je bent ingelogd op $NOW_TIME<BR>Tijd die je ingelogd bent geweest: $totTIME_HMS";
|
||||
|
||||
### Add a record to the timeclock log
|
||||
$stmt="INSERT INTO vicidial_timeclock_log set event='UITLOGGEN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
$timeclock_id = mysql_insert_id($link);
|
||||
print "<!-- NIEUW vicidial_timeclock_log record inserted for $user: |$affected_rows|$timeclock_id| -->\n";
|
||||
|
||||
### Update last login record in the timeclock log
|
||||
$stmt="UPDATE vicidial_timeclock_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_log record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update the user's timeclock status record
|
||||
$stmt="UPDATE vicidial_timeclock_status set status='UITLOGGEN', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip' where user='$user';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_status record updated for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Add a record to the timeclock audit log
|
||||
$stmt="INSERT INTO vicidial_timeclock_audit_log set timeclock_id='$timeclock_id', event='UITLOGGEN', user='$user', user_group='$user_group', event_epoch='$StarTtimE', ip_address='$ip', login_sec='$last_action_sec', event_date='$NOW_TIME';";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- NIEUW vicidial_timeclock_audit_log record inserted for $user: |$affected_rows| -->\n";
|
||||
|
||||
### Update last login record in the timeclock audit log
|
||||
$stmt="UPDATE vicidial_timeclock_audit_log set login_sec='$last_action_sec',tcid_link='$timeclock_id' where event='LOGIN' and user='$user' order by timeclock_id desc limit 1;";
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$affected_rows = mysql_affected_rows($link);
|
||||
print "<!-- vicidial_timeclock_audit_log record updated for $user: |$affected_rows| -->\n";
|
||||
}
|
||||
|
||||
if ( ( ( ($status=='AUTOUITLOGGEN') or ($status=='START') or ($status=='UITLOGGEN') ) and ($stage=='logout') ) or ( ($status=='LOGIN') and ($stage=='login') ) )
|
||||
{echo "FOUT: tijdslot log toevoegin reeds gemaakt: $status|$stage"; exit;}
|
||||
|
||||
if ($referrer=='agent')
|
||||
{$BACKlink = "<A HREF=\"./vicidial.php?pl=$phone_login&pp=$phone_pass&VD_login=$user\"><font color=\"#003333\">TERUG naar Agent Inloggen Scherm</font></A>";}
|
||||
if ($referrer=='admin')
|
||||
{$BACKlink = "<A HREF=\"../vicidial/admin.php\"><font color=\"#003333\">TERUG naar Administratie</font></A>";}
|
||||
if ($referrer=='welcome')
|
||||
{$BACKlink = "<A HREF=\"$welcomeURL\"><font color=\"#003333\">TERUG naar Welkomst Scherm</font></A>";}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Tijdslot</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Tijdslot </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><B> $BACKlink <BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ( ($status=='AUTOUITLOGGEN') or ($status=='START') or ($status=='UITLOGGEN') )
|
||||
{
|
||||
$VDdisplayMESSAGE = "Tijd sinds je laatste login: $totTIME_HMS";
|
||||
$log_action = 'login';
|
||||
$button_name = 'LOGIN';
|
||||
$LOGtimeMESSAGE = "Je laatste log-uit was om: $last_action_date<BR><BR>Klik INLOGGEN om in te loggen";
|
||||
}
|
||||
if ($status=='LOGIN')
|
||||
{
|
||||
$VDdisplayMESSAGE = "Tijd dat je bent ingelogged$totTIME_HMS";
|
||||
$log_action = 'logout';
|
||||
$button_name = 'UITLOGGEN';
|
||||
$LOGtimeMESSAGE = "Je bint ingelogged om: $last_action_date<BR>Tijd dat je bent ingelogged$totTIME_HMS<BR><BR>Klik UITLOGGEN om uit te loggen";
|
||||
}
|
||||
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Tijdslot</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"$log_action\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=commit VALUE=\"YES\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=user VALUE=\"$user\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=pass VALUE=\"$pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Tijdslot </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><font size=3><B> $LOGtimeMESSAGE<BR> </B></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=$button_name VALUE=$button_name> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
echo"<HTML><HEAD>\n";
|
||||
echo"<TITLE>Agent Tijdslot</TITLE>\n";
|
||||
echo"<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n";
|
||||
echo"</HEAD>\n";
|
||||
echo "<BODY BGCOLOR=WHITE MARGINHEIGHT=0 MARGINWIDTH=0>\n";
|
||||
echo "<FORM NAME=vicidial_form ID=vicidial_form ACTION=\"$agcPAGE\" METHOD=POST>\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=stage VALUE=\"login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=referrer VALUE=\"$referrer\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=DB VALUE=\"$DB\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_login VALUE=\"$phone_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=phone_pass VALUE=\"$phone_pass\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_login VALUE=\"$VD_login\">\n";
|
||||
echo "<INPUT TYPE=HIDDEN NAME=VD_pass VALUE=\"$VD_pass\">\n";
|
||||
echo "<CENTER><BR><B>$VDdisplayMESSAGE</B><BR><BR>";
|
||||
echo "<TABLE WIDTH=460 CELLPADDING=0 CELLSPACING=0 BGCOLOR=\"#CCFFCC\"><TR BGCOLOR=WHITE>";
|
||||
echo "<TD ALIGN=LEFT VALIGN=BOTTOM><IMG SRC=\"../agc/images/vtc_tab_vicidial.gif\" Border=0></TD>";
|
||||
echo "<TD ALIGN=CENTER VALIGN=MIDDLE><B> Tijdslot </B></TD>";
|
||||
echo "</TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Gebruiker Inloggen: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=TEXT NAME=user SIZE=10 maxlength=20 VALUE=\"$VD_login\"></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=RIGHT>Gebruiker Wachtwoord: </TD>";
|
||||
echo "<TD ALIGN=LEFT><INPUT TYPE=PASSWORD NAME=pass SIZE=10 maxlength=20 VALUE=''></TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=CENTER COLSPAN=2><INPUT TYPE=Submit NAME=OPSLAAN VALUE=OPSLAAN> </TD></TR>\n";
|
||||
echo "<TR><TD ALIGN=LEFT COLSPAN=2><font size=1><BR>VERSIE: $version BUILD: $build</TD></TR>\n";
|
||||
echo "</TABLE>\n";
|
||||
echo "</FORM>\n\n";
|
||||
echo "</body>\n\n";
|
||||
echo "</html>\n\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,401 @@
|
||||
<?php
|
||||
# vdc_script_display.php
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed display the contents of the SCRIPT tab in the agent interface
|
||||
#
|
||||
# CHANGELOG:
|
||||
# 90824-1435 - First build of script
|
||||
# 90827-1548 - Added list override script option
|
||||
# 91204-1913 - Added recording_filename and recording_id variables
|
||||
# 91211-1103 - Added user_custom_... variables
|
||||
#
|
||||
|
||||
$version = '2.2.0-4';
|
||||
$build = '91211-1103';
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
|
||||
if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];}
|
||||
elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];}
|
||||
if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];}
|
||||
elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];}
|
||||
$vendor_lead_code = $vendor_id;
|
||||
if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];}
|
||||
elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];}
|
||||
if (isset($_GET["gmt_offset_now"])) {$gmt_offset_now=$_GET["gmt_offset_now"];}
|
||||
elseif (isset($_POST["gmt_offset_now"])) {$gmt_offset_now=$_POST["gmt_offset_now"];}
|
||||
if (isset($_GET["phone_code"])) {$phone_code=$_GET["phone_code"];}
|
||||
elseif (isset($_POST["phone_code"])) {$phone_code=$_POST["phone_code"];}
|
||||
if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];}
|
||||
elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];}
|
||||
if (isset($_GET["title"])) {$title=$_GET["title"];}
|
||||
elseif (isset($_POST["title"])) {$title=$_POST["title"];}
|
||||
if (isset($_GET["first_name"])) {$first_name=$_GET["first_name"];}
|
||||
elseif (isset($_POST["first_name"])) {$first_name=$_POST["first_name"];}
|
||||
if (isset($_GET["middle_initial"])) {$middle_initial=$_GET["middle_initial"];}
|
||||
elseif (isset($_POST["middle_initial"])) {$middle_initial=$_POST["middle_initial"];}
|
||||
if (isset($_GET["last_name"])) {$last_name=$_GET["last_name"];}
|
||||
elseif (isset($_POST["last_name"])) {$last_name=$_POST["last_name"];}
|
||||
if (isset($_GET["address1"])) {$address1=$_GET["address1"];}
|
||||
elseif (isset($_POST["address1"])) {$address1=$_POST["address1"];}
|
||||
if (isset($_GET["address2"])) {$address2=$_GET["address2"];}
|
||||
elseif (isset($_POST["address2"])) {$address2=$_POST["address2"];}
|
||||
if (isset($_GET["address3"])) {$address3=$_GET["address3"];}
|
||||
elseif (isset($_POST["address3"])) {$address3=$_POST["address3"];}
|
||||
if (isset($_GET["city"])) {$city=$_GET["city"];}
|
||||
elseif (isset($_POST["city"])) {$city=$_POST["city"];}
|
||||
if (isset($_GET["state"])) {$state=$_GET["state"];}
|
||||
elseif (isset($_POST["state"])) {$state=$_POST["state"];}
|
||||
if (isset($_GET["province"])) {$province=$_GET["province"];}
|
||||
elseif (isset($_POST["province"])) {$province=$_POST["province"];}
|
||||
if (isset($_GET["postal_code"])) {$postal_code=$_GET["postal_code"];}
|
||||
elseif (isset($_POST["postal_code"])) {$postal_code=$_POST["postal_code"];}
|
||||
if (isset($_GET["country_code"])) {$country_code=$_GET["country_code"];}
|
||||
elseif (isset($_POST["country_code"])) {$country_code=$_POST["country_code"];}
|
||||
if (isset($_GET["gender"])) {$gender=$_GET["gender"];}
|
||||
elseif (isset($_POST["gender"])) {$gender=$_POST["gender"];}
|
||||
if (isset($_GET["date_of_birth"])) {$date_of_birth=$_GET["date_of_birth"];}
|
||||
elseif (isset($_POST["date_of_birth"])) {$date_of_birth=$_POST["date_of_birth"];}
|
||||
if (isset($_GET["alt_phone"])) {$alt_phone=$_GET["alt_phone"];}
|
||||
elseif (isset($_POST["alt_phone"])) {$alt_phone=$_POST["alt_phone"];}
|
||||
if (isset($_GET["email"])) {$email=$_GET["email"];}
|
||||
elseif (isset($_POST["email"])) {$email=$_POST["email"];}
|
||||
if (isset($_GET["security_phrase"])) {$security_phrase=$_GET["security_phrase"];}
|
||||
elseif (isset($_POST["security_phrase"])) {$security_phrase=$_POST["security_phrase"];}
|
||||
if (isset($_GET["comments"])) {$comments=$_GET["comments"];}
|
||||
elseif (isset($_POST["comments"])) {$comments=$_POST["comments"];}
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];}
|
||||
elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];}
|
||||
if (isset($_GET["phone_login"])) {$phone_login=$_GET["phone_login"];}
|
||||
elseif (isset($_POST["phone_login"])) {$phone_login=$_POST["phone_login"];}
|
||||
if (isset($_GET["original_phone_login"])) {$original_phone_login=$_GET["original_phone_login"];}
|
||||
elseif (isset($_POST["original_phone_login"])) {$original_phone_login=$_POST["original_phone_login"];}
|
||||
if (isset($_GET["phone_pass"])) {$phone_pass=$_GET["phone_pass"];}
|
||||
elseif (isset($_POST["phone_pass"])) {$phone_pass=$_POST["phone_pass"];}
|
||||
if (isset($_GET["fronter"])) {$fronter=$_GET["fronter"];}
|
||||
elseif (isset($_POST["fronter"])) {$fronter=$_POST["fronter"];}
|
||||
if (isset($_GET["closer"])) {$closer=$_GET["closer"];}
|
||||
elseif (isset($_POST["closer"])) {$closer=$_POST["closer"];}
|
||||
if (isset($_GET["group"])) {$group=$_GET["group"];}
|
||||
elseif (isset($_POST["group"])) {$group=$_POST["group"];}
|
||||
if (isset($_GET["channel_group"])) {$channel_group=$_GET["channel_group"];}
|
||||
elseif (isset($_POST["channel_group"])) {$channel_group=$_POST["channel_group"];}
|
||||
if (isset($_GET["SQLdate"])) {$SQLdate=$_GET["SQLdate"];}
|
||||
elseif (isset($_POST["SQLdate"])) {$SQLdate=$_POST["SQLdate"];}
|
||||
if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];}
|
||||
elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];}
|
||||
if (isset($_GET["uniqueid"])) {$uniqueid=$_GET["uniqueid"];}
|
||||
elseif (isset($_POST["uniqueid"])) {$uniqueid=$_POST["uniqueid"];}
|
||||
if (isset($_GET["customer_zap_channel"])) {$customer_zap_channel=$_GET["customer_zap_channel"];}
|
||||
elseif (isset($_POST["customer_zap_channel"])) {$customer_zap_channel=$_POST["customer_zap_channel"];}
|
||||
if (isset($_GET["customer_server_ip"])) {$customer_server_ip=$_GET["customer_server_ip"];}
|
||||
elseif (isset($_POST["customer_server_ip"])) {$customer_server_ip=$_POST["customer_server_ip"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["SIPexten"])) {$SIPexten=$_GET["SIPexten"];}
|
||||
elseif (isset($_POST["SIPexten"])) {$SIPexten=$_POST["SIPexten"];}
|
||||
if (isset($_GET["session_id"])) {$session_id=$_GET["session_id"];}
|
||||
elseif (isset($_POST["session_id"])) {$session_id=$_POST["session_id"];}
|
||||
if (isset($_GET["phone"])) {$phone=$_GET["phone"];}
|
||||
elseif (isset($_POST["phone"])) {$phone=$_POST["phone"];}
|
||||
if (isset($_GET["parked_by"])) {$parked_by=$_GET["parked_by"];}
|
||||
elseif (isset($_POST["parked_by"])) {$parked_by=$_POST["parked_by"];}
|
||||
if (isset($_GET["dispo"])) {$dispo=$_GET["dispo"];}
|
||||
elseif (isset($_POST["dispo"])) {$dispo=$_POST["dispo"];}
|
||||
if (isset($_GET["dialed_number"])) {$dialed_number=$_GET["dialed_number"];}
|
||||
elseif (isset($_POST["dialed_number"])) {$dialed_number=$_POST["dialed_number"];}
|
||||
if (isset($_GET["dialed_label"])) {$dialed_label=$_GET["dialed_label"];}
|
||||
elseif (isset($_POST["dialed_label"])) {$dialed_label=$_POST["dialed_label"];}
|
||||
if (isset($_GET["source_id"])) {$source_id=$_GET["source_id"];}
|
||||
elseif (isset($_POST["source_id"])) {$source_id=$_POST["source_id"];}
|
||||
if (isset($_GET["rank"])) {$rank=$_GET["rank"];}
|
||||
elseif (isset($_POST["rank"])) {$rank=$_POST["rank"];}
|
||||
if (isset($_GET["owner"])) {$owner=$_GET["owner"];}
|
||||
elseif (isset($_POST["owner"])) {$owner=$_POST["owner"];}
|
||||
if (isset($_GET["camp_script"])) {$camp_script=$_GET["camp_script"];}
|
||||
elseif (isset($_POST["camp_script"])) {$camp_script=$_POST["camp_script"];}
|
||||
if (isset($_GET["in_script"])) {$in_script=$_GET["in_script"];}
|
||||
elseif (isset($_POST["in_script"])) {$in_script=$_POST["in_script"];}
|
||||
if (isset($_GET["script_width"])) {$script_width=$_GET["script_width"];}
|
||||
elseif (isset($_POST["script_width"])) {$script_width=$_POST["script_width"];}
|
||||
if (isset($_GET["script_height"])) {$script_height=$_GET["script_height"];}
|
||||
elseif (isset($_POST["script_height"])) {$script_height=$_POST["script_height"];}
|
||||
if (isset($_GET["fullname"])) {$fullname=$_GET["fullname"];}
|
||||
elseif (isset($_POST["fullname"])) {$fullname=$_POST["fullname"];}
|
||||
if (isset($_GET["recording_filename"])) {$recording_filename=$_GET["recording_filename"];}
|
||||
elseif (isset($_POST["recording_filename"])) {$recording_filename=$_POST["recording_filename"];}
|
||||
if (isset($_GET["recording_id"])) {$recording_id=$_GET["recording_id"];}
|
||||
elseif (isset($_POST["recording_id"])) {$recording_id=$_POST["recording_id"];}
|
||||
if (isset($_GET["user_custom_one"])) {$user_custom_one=$_GET["user_custom_one"];}
|
||||
elseif (isset($_POST["user_custom_one"])) {$user_custom_one=$_POST["user_custom_one"];}
|
||||
if (isset($_GET["user_custom_two"])) {$user_custom_two=$_GET["user_custom_two"];}
|
||||
elseif (isset($_POST["user_custom_two"])) {$user_custom_two=$_POST["user_custom_two"];}
|
||||
if (isset($_GET["user_custom_three"])) {$user_custom_three=$_GET["user_custom_three"];}
|
||||
elseif (isset($_POST["user_custom_three"])) {$user_custom_three=$_POST["user_custom_three"];}
|
||||
if (isset($_GET["user_custom_four"])) {$user_custom_four=$_GET["user_custom_four"];}
|
||||
elseif (isset($_POST["user_custom_four"])) {$user_custom_four=$_POST["user_custom_four"];}
|
||||
if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];}
|
||||
elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];}
|
||||
|
||||
if (isset($_GET["ScrollDIV"])) {$ScrollDIV=$_GET["ScrollDIV"];}
|
||||
elseif (isset($_POST["ScrollDIV"])) {$ScrollDIV=$_POST["ScrollDIV"];}
|
||||
if (isset($_GET["ignore_list_script"])) {$ignore_list_script=$_GET["ignore_list_script"];}
|
||||
elseif (isset($_POST["ignore_list_script"])) {$ignore_list_script=$_POST["ignore_list_script"];}
|
||||
|
||||
header ("Content-type: text/html; charset=utf-8");
|
||||
header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
|
||||
header ("Pragma: no-cache"); // HTTP/1.0
|
||||
|
||||
$txt = '.txt';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
$CIDdate = date("mdHis");
|
||||
$ENTRYdate = date("YmdHis");
|
||||
$MT[0]='';
|
||||
$agents='@agents';
|
||||
|
||||
$IFRAME=0;
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,timeclock_end_of_day,agentonly_callback_campaign_lock FROM system_settings;";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
if ($DB) {echo "$stmt\n";}
|
||||
$qm_conf_ct = mysql_num_rows($rslt);
|
||||
if ($qm_conf_ct > 0)
|
||||
{
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$non_latin = $row[0];
|
||||
$timeclock_end_of_day = $row[1];
|
||||
$agentonly_callback_campaign_lock = $row[2];
|
||||
}
|
||||
##### END SETTINGS LOOKUP #####
|
||||
###########################################
|
||||
|
||||
if ($non_latin < 1)
|
||||
{
|
||||
$user=ereg_replace("[^-_0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^-_0-9a-zA-Z]","",$pass);
|
||||
$length_in_sec = ereg_replace("[^0-9]","",$length_in_sec);
|
||||
$phone_code = ereg_replace("[^0-9]","",$phone_code);
|
||||
$phone_number = ereg_replace("[^0-9]","",$phone_number);
|
||||
}
|
||||
else
|
||||
{
|
||||
$user = ereg_replace("'|\"|\\\\|;","",$user);
|
||||
$pass = ereg_replace("'|\"|\\\\|;","",$pass);
|
||||
}
|
||||
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
if ($format == 'debug') {$DB=1;}
|
||||
if (!isset($ACTION)) {$ACTION="refresh";}
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Invalid Username/Password: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSION: $version BUILD: $build USER: $user server_ip: $server_ip-->\n";
|
||||
echo "<title>VICIDiaL Script Display Script";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
if (strlen($in_script) < 1)
|
||||
{$call_script = $camp_script;}
|
||||
else
|
||||
{$call_script = $in_script;}
|
||||
|
||||
if ($ignore_list_script < 1)
|
||||
{
|
||||
$stmt="SELECT agent_script_override from vicidial_lists where list_id='$list_id';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$agent_script_override = $row[0];
|
||||
if (strlen($agent_script_override) > 0)
|
||||
{$call_script = $agent_script_override;}
|
||||
}
|
||||
|
||||
$stmt="SELECT script_name,script_text from vicidial_scripts where script_id='$call_script';";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$script_name = $row[0];
|
||||
$script_text = stripslashes($row[1]);
|
||||
|
||||
if (eregi("iframe src",$script_text))
|
||||
{
|
||||
$IFRAME=1;
|
||||
$lead_id = eregi_replace(' ','+',$lead_id);
|
||||
$vendor_id = eregi_replace(' ','+',$vendor_id);
|
||||
$vendor_lead_code = eregi_replace(' ','+',$vendor_lead_code);
|
||||
$list_id = eregi_replace(' ','+',$list_id);
|
||||
$gmt_offset_now = eregi_replace(' ','+',$gmt_offset_now);
|
||||
$phone_code = eregi_replace(' ','+',$phone_code);
|
||||
$phone_number = eregi_replace(' ','+',$phone_number);
|
||||
$title = eregi_replace(' ','+',$title);
|
||||
$first_name = eregi_replace(' ','+',$first_name);
|
||||
$middle_initial = eregi_replace(' ','+',$middle_initial);
|
||||
$last_name = eregi_replace(' ','+',$last_name);
|
||||
$address1 = eregi_replace(' ','+',$address1);
|
||||
$address2 = eregi_replace(' ','+',$address2);
|
||||
$address3 = eregi_replace(' ','+',$address3);
|
||||
$city = eregi_replace(' ','+',$city);
|
||||
$state = eregi_replace(' ','+',$state);
|
||||
$province = eregi_replace(' ','+',$province);
|
||||
$postal_code = eregi_replace(' ','+',$postal_code);
|
||||
$country_code = eregi_replace(' ','+',$country_code);
|
||||
$gender = eregi_replace(' ','+',$gender);
|
||||
$date_of_birth = eregi_replace(' ','+',$date_of_birth);
|
||||
$alt_phone = eregi_replace(' ','+',$alt_phone);
|
||||
$email = eregi_replace(' ','+',$email);
|
||||
$security_phrase = eregi_replace(' ','+',$security_phrase);
|
||||
$comments = eregi_replace(' ','+',$comments);
|
||||
$user = eregi_replace(' ','+',$user);
|
||||
$pass = eregi_replace(' ','+',$pass);
|
||||
$campaign = eregi_replace(' ','+',$campaign);
|
||||
$phone_login = eregi_replace(' ','+',$phone_login);
|
||||
$original_phone_login = eregi_replace(' ','+',$original_phone_login);
|
||||
$phone_pass = eregi_replace(' ','+',$phone_pass);
|
||||
$fronter = eregi_replace(' ','+',$fronter);
|
||||
$closer = eregi_replace(' ','+',$closer);
|
||||
$group = eregi_replace(' ','+',$group);
|
||||
$channel_group = eregi_replace(' ','+',$channel_group);
|
||||
$SQLdate = eregi_replace(' ','+',$SQLdate);
|
||||
$epoch = eregi_replace(' ','+',$epoch);
|
||||
$uniqueid = eregi_replace(' ','+',$uniqueid);
|
||||
$customer_zap_channel = eregi_replace(' ','+',$customer_zap_channel);
|
||||
$customer_server_ip = eregi_replace(' ','+',$customer_server_ip);
|
||||
$server_ip = eregi_replace(' ','+',$server_ip);
|
||||
$SIPexten = eregi_replace(' ','+',$SIPexten);
|
||||
$session_id = eregi_replace(' ','+',$session_id);
|
||||
$phone = eregi_replace(' ','+',$phone);
|
||||
$parked_by = eregi_replace(' ','+',$parked_by);
|
||||
$dispo = eregi_replace(' ','+',$dispo);
|
||||
$dialed_number = eregi_replace(' ','+',$dialed_number);
|
||||
$dialed_label = eregi_replace(' ','+',$dialed_label);
|
||||
$source_id = eregi_replace(' ','+',$source_id);
|
||||
$rank = eregi_replace(' ','+',$rank);
|
||||
$owner = eregi_replace(' ','+',$owner);
|
||||
$camp_script = eregi_replace(' ','+',$camp_script);
|
||||
$in_script = eregi_replace(' ','+',$in_script);
|
||||
$script_width = eregi_replace(' ','+',$script_width);
|
||||
$script_height = eregi_replace(' ','+',$script_height);
|
||||
$fullname = eregi_replace(' ','+',$fullname);
|
||||
$recording_filename = eregi_replace(' ','+',$recording_filename);
|
||||
$recording_id = eregi_replace(' ','+',$recording_id);
|
||||
$user_custom_one = eregi_replace(' ','+',$user_custom_one);
|
||||
$user_custom_two = eregi_replace(' ','+',$user_custom_two);
|
||||
$user_custom_three = eregi_replace(' ','+',$user_custom_three);
|
||||
$user_custom_four = eregi_replace(' ','+',$user_custom_four);
|
||||
$user_custom_five = eregi_replace(' ','+',$user_custom_five);
|
||||
}
|
||||
|
||||
$script_text = eregi_replace('--A--lead_id--B--',"$lead_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_id--B--',"$vendor_id",$script_text);
|
||||
$script_text = eregi_replace('--A--vendor_lead_code--B--',"$vendor_lead_code",$script_text);
|
||||
$script_text = eregi_replace('--A--list_id--B--',"$list_id",$script_text);
|
||||
$script_text = eregi_replace('--A--gmt_offset_now--B--',"$gmt_offset_now",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_code--B--',"$phone_code",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_number--B--',"$phone_number",$script_text);
|
||||
$script_text = eregi_replace('--A--title--B--',"$title",$script_text);
|
||||
$script_text = eregi_replace('--A--first_name--B--',"$first_name",$script_text);
|
||||
$script_text = eregi_replace('--A--middle_initial--B--',"$middle_initial",$script_text);
|
||||
$script_text = eregi_replace('--A--last_name--B--',"$last_name",$script_text);
|
||||
$script_text = eregi_replace('--A--address1--B--',"$address1",$script_text);
|
||||
$script_text = eregi_replace('--A--address2--B--',"$address2",$script_text);
|
||||
$script_text = eregi_replace('--A--address3--B--',"$address3",$script_text);
|
||||
$script_text = eregi_replace('--A--city--B--',"$city",$script_text);
|
||||
$script_text = eregi_replace('--A--state--B--',"$state",$script_text);
|
||||
$script_text = eregi_replace('--A--province--B--',"$province",$script_text);
|
||||
$script_text = eregi_replace('--A--postal_code--B--',"$postal_code",$script_text);
|
||||
$script_text = eregi_replace('--A--country_code--B--',"$country_code",$script_text);
|
||||
$script_text = eregi_replace('--A--gender--B--',"$gender",$script_text);
|
||||
$script_text = eregi_replace('--A--date_of_birth--B--',"$date_of_birth",$script_text);
|
||||
$script_text = eregi_replace('--A--alt_phone--B--',"$alt_phone",$script_text);
|
||||
$script_text = eregi_replace('--A--email--B--',"$email",$script_text);
|
||||
$script_text = eregi_replace('--A--security_phrase--B--',"$security_phrase",$script_text);
|
||||
$script_text = eregi_replace('--A--comments--B--',"$comments",$script_text);
|
||||
$script_text = eregi_replace('--A--user--B--',"$user",$script_text);
|
||||
$script_text = eregi_replace('--A--pass--B--',"$pass",$script_text);
|
||||
$script_text = eregi_replace('--A--campaign--B--',"$campaign",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_login--B--',"$phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--original_phone_login--B--',"$original_phone_login",$script_text);
|
||||
$script_text = eregi_replace('--A--phone_pass--B--',"$phone_pass",$script_text);
|
||||
$script_text = eregi_replace('--A--fronter--B--',"$fronter",$script_text);
|
||||
$script_text = eregi_replace('--A--closer--B--',"$closer",$script_text);
|
||||
$script_text = eregi_replace('--A--group--B--',"$group",$script_text);
|
||||
$script_text = eregi_replace('--A--channel_group--B--',"$channel_group",$script_text);
|
||||
$script_text = eregi_replace('--A--SQLdate--B--',"$SQLdate",$script_text);
|
||||
$script_text = eregi_replace('--A--epoch--B--',"$epoch",$script_text);
|
||||
$script_text = eregi_replace('--A--uniqueid--B--',"$uniqueid",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_zap_channel--B--',"$customer_zap_channel",$script_text);
|
||||
$script_text = eregi_replace('--A--customer_server_ip--B--',"$customer_server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--server_ip--B--',"$server_ip",$script_text);
|
||||
$script_text = eregi_replace('--A--SIPexten--B--',"$SIPexten",$script_text);
|
||||
$script_text = eregi_replace('--A--session_id--B--',"$session_id",$script_text);
|
||||
$script_text = eregi_replace('--A--phone--B--',"$phone",$script_text);
|
||||
$script_text = eregi_replace('--A--parked_by--B--',"$parked_by",$script_text);
|
||||
$script_text = eregi_replace('--A--dispo--B--',"$dispo",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_number--B--',"$dialed_number",$script_text);
|
||||
$script_text = eregi_replace('--A--dialed_label--B--',"$dialed_label",$script_text);
|
||||
$script_text = eregi_replace('--A--source_id--B--',"$source_id",$script_text);
|
||||
$script_text = eregi_replace('--A--rank--B--',"$rank",$script_text);
|
||||
$script_text = eregi_replace('--A--owner--B--',"$owner",$script_text);
|
||||
$script_text = eregi_replace('--A--camp_script--B--',"$camp_script",$script_text);
|
||||
$script_text = eregi_replace('--A--in_script--B--',"$in_script",$script_text);
|
||||
$script_text = eregi_replace('--A--script_width--B--',"$script_width",$script_text);
|
||||
$script_text = eregi_replace('--A--script_height--B--',"$script_height",$script_text);
|
||||
$script_text = eregi_replace('--A--fullname--B--',"$fullname",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_filename--B--',"$recording_filename",$script_text);
|
||||
$script_text = eregi_replace('--A--recording_id--B--',"$recording_id",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_one--B--',"$user_custom_one",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_two--B--',"$user_custom_two",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_three--B--',"$user_custom_three",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_four--B--',"$user_custom_four",$script_text);
|
||||
$script_text = eregi_replace('--A--user_custom_five--B--',"$user_custom_five",$script_text);
|
||||
$script_text = eregi_replace("\n","<BR>",$script_text);
|
||||
$script_text = stripslashes($script_text);
|
||||
|
||||
|
||||
echo "<!-- IFRAME$IFRAME -->\n";
|
||||
echo "<!-- $script_id -->\n";
|
||||
echo "<TABLE WIDTH=$script_width><TR><TD>\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "<div class=\"scroll_script\" id=\"NewScriptContents\">";}
|
||||
echo "<center><B>$script_name</B><BR></center>\n";
|
||||
echo "$script_text\n";
|
||||
if ( ($IFRAME < 1) and ($ScrollDIV > 0) )
|
||||
{ echo "</div>";}
|
||||
echo "</TD></TR></TABLE>\n";
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
# voicemail_check.php version 2.2.0
|
||||
#
|
||||
# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# This script is designed purely to check whether the voicemail box on the server defined has new and old messages
|
||||
# This script depends on the server_ip being sent and also needs to have a valid user/pass from the vicidial_users table
|
||||
#
|
||||
# required variables:
|
||||
# - $server_ip
|
||||
# - $session_name
|
||||
# - $user
|
||||
# - $pass
|
||||
# optional variables:
|
||||
# - $format - ('text','debug')
|
||||
# - $vmail_box - ('101','1234',...)
|
||||
#
|
||||
#
|
||||
# changes
|
||||
# 50422-1147 - First build of script
|
||||
# 50503-1241 - added session_name checking for extra security
|
||||
# 50711-1201 - removed HTTP authentication in favor of user/pass vars
|
||||
# 60421-1147 - check GET/POST vars lines with isset to not trigger PHP NOTICES
|
||||
# 60619-1204 - Added variable filters to close security holes for login form
|
||||
# 90508-0727 - Changed to PHP long tags
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
|
||||
### If you have globals turned off uncomment these lines
|
||||
if (isset($_GET["user"])) {$user=$_GET["user"];}
|
||||
elseif (isset($_POST["user"])) {$user=$_POST["user"];}
|
||||
if (isset($_GET["pass"])) {$pass=$_GET["pass"];}
|
||||
elseif (isset($_POST["pass"])) {$pass=$_POST["pass"];}
|
||||
if (isset($_GET["server_ip"])) {$server_ip=$_GET["server_ip"];}
|
||||
elseif (isset($_POST["server_ip"])) {$server_ip=$_POST["server_ip"];}
|
||||
if (isset($_GET["session_name"])) {$session_name=$_GET["session_name"];}
|
||||
elseif (isset($_POST["session_name"])) {$session_name=$_POST["session_name"];}
|
||||
if (isset($_GET["format"])) {$format=$_GET["format"];}
|
||||
elseif (isset($_POST["format"])) {$format=$_POST["format"];}
|
||||
if (isset($_GET["vmail_box"])) {$vmail_box=$_GET["vmail_box"];}
|
||||
elseif (isset($_POST["vmail_box"])) {$vmail_box=$_POST["vmail_box"];}
|
||||
|
||||
$user=ereg_replace("[^0-9a-zA-Z]","",$user);
|
||||
$pass=ereg_replace("[^0-9a-zA-Z]","",$pass);
|
||||
|
||||
# default optional vars if not set
|
||||
if (!isset($format)) {$format="text";}
|
||||
|
||||
$version = '0.0.5';
|
||||
$build = '60619-1204';
|
||||
$StarTtime = date("U");
|
||||
$NOW_DATE = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
if (!isset($query_date)) {$query_date = $NOW_DATE;}
|
||||
|
||||
$stmt="SELECT count(*) from vicidial_users where user='$user' and pass='$pass' and user_level > 0;";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$auth=$row[0];
|
||||
|
||||
if( (strlen($user)<2) or (strlen($pass)<2) or ($auth==0))
|
||||
{
|
||||
echo "Foutief Gebruikersnaam/Wachtwoord: |$user|$pass|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if( (strlen($server_ip)<6) or (!isset($server_ip)) or ( (strlen($session_name)<12) or (!isset($session_name)) ) )
|
||||
{
|
||||
echo "Foutief server_ip: |$server_ip| or Foutief session_name: |$session_name|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT count(*) from web_client_sessions where session_name='$session_name' and server_ip='$server_ip';";
|
||||
if ($DB) {echo "|$stmt|\n";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$row=mysql_fetch_row($rslt);
|
||||
$SNauth=$row[0];
|
||||
if($SNauth==0)
|
||||
{
|
||||
echo "Foutief session_name: |$session_name|$server_ip|\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
# do nothing for now
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
echo "<html>\n";
|
||||
echo "<head>\n";
|
||||
echo "<!-- VERSIE: $version BUILD: $build VMBOX: $vmail_box server_ip: $server_ip-->\n";
|
||||
echo "<title>Voicemail Check";
|
||||
echo "</title>\n";
|
||||
echo "</head>\n";
|
||||
echo "<BODY BGCOLOR=white marginheight=0 marginwidth=0 leftmargin=0 topmargin=0>\n";
|
||||
}
|
||||
|
||||
$MT[0]='';
|
||||
$row=''; $rowx='';
|
||||
if (strlen($vmail_box)<1)
|
||||
{
|
||||
$channel_live=0;
|
||||
echo "Voicemail Box $vmail_box is niet geldig\n";
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$stmt="SELECT messages,old_messages FROM phones where server_ip='$server_ip' and voicemail_id='$vmail_box' limit 1;";
|
||||
if ($format=='debug') {echo "\n<!-- $stmt -->";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$vmails_list = mysql_num_rows($rslt);
|
||||
$loop_count=0;
|
||||
while ($vmails_list>$loop_count)
|
||||
{
|
||||
$loop_count++;
|
||||
$row=mysql_fetch_row($rslt);
|
||||
echo "$row[0]|$row[1]";
|
||||
if ($format=='debug') {echo "\n<!-- $row[0] $row[1] -->";}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($format=='debug')
|
||||
{
|
||||
$ENDtime = date("U");
|
||||
$RUNtime = ($ENDtime - $StarTtime);
|
||||
echo "\n<!-- script runtime: $RUNtimeseconden -->";
|
||||
echo "\n</body>\n</html>\n";
|
||||
}
|
||||
|
||||
exit;
|
||||
|
||||
?>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user